vagrant for real (codemotion rome 2016)

99
Vagrant for Real

Upload: michele-orselli

Post on 16-Jan-2017

36.066 views

Category:

Software


0 download

TRANSCRIPT

Vagrant for Real

Michele OrselliCTOIdeato

_orso_

micheleorselli ideatosrl

moideatoit

httpmitchellhcomthe-tao-of-vagrant

1) clone repo

2) vagrant up

3) therersquos no 3

1) clone repo

2) vagrant up

tips

vagrantfile configs vm performance

app config tips provisionpackaging

Portable configuration tips

Donrsquot use local names for your boxes

configvmbox = base

cvmbox = hashicorpprecise64

cvmbox_url = httpyour_box

Avoid absolute paths

cvmsynced_folder ldquomyProjvarwwwmyProj

configvmsynced_folder varwwwmyProj

Move host specific configuration outside

Vagrantfile

ram 2048 cpus 2 ipaddress 10101010

vagrantfile-local-configyml

require lsquoyaml

_config = YAMLload(Fileopen(Filejoin(Filedirname(__FILE__) ldquovagrantfile-local-configymlrdquo) FileRDONLY)read) CONF = _config

configvmprovider virtualbox do |vb| vbcustomize[modifyvmidldquo--memory CONF[ram]] vbcustomize [modifyvmid--cpus CONF[ldquocpus]] hellip end

As rule of thumb you could assign the half cpus and a quarter of the memory based on your host machine

httpsstefanwrobelcomhow-to-make-vagrant-performance-not-suck

Force a specific provider

ENV[VAGRANT_DEFAULT_PROVIDER] = virtualbox

Support multiple providers

configvmprovider virtualbox do |vb| vbcustomize [modifyvmid --memory CONF[ram]] vbcustomize [modifyvmid --cpus CONF[cpus]] end configvmprovider vmware_fusion do |v| vvmx[memsize] = CONF[ram] vvmx[numvcpus] = CONF[cpus] end

Projectrsquos directories organization

myproject -- hellip -- vagrant -- Vagrantfile

single git repository

cvmsynced_folder ldquordquordquovarwwwmyproject

myproject -- project --hellip -- vagrant -- Vagrantfile

single git repository

cvmsynced_folder ldquoprojectrdquordquovarwwwprojectrdquo

myproject -- vagrant -- www -- project1 -- project2 -- Vagrantfile

singlemultiple git repositories

cvmsynced_folder ldquowwwrdquordquovarwwwrdquo

vagrant plugin install HostsUpdater

(or HostManager)

etchosts

10101040 host1lo VAGRANT e2bca7c8bf6d76cbcf6ee48998c16f

if Vagranthas_plugin(HostsUpdater) confighostsupdateraliases = [host1lo] else puts --- WARNING --- puts ldquoYou should install HostsUpdaterrdquo end

Multi-VM Configuration

configvmdefine web do |web| webvmnetwork private_network ip 10002 webvmprovider virtualbox do |v| vcustomize [modifyvm id --memory 2048] end webvmsynced_folder ldquovarwww end configvmdefine db do |db| dbvmnetwork private_network ip 10003 dbvmprovision shell path =gt vagrantdbsh end

Dealing with shared folders

no share

native share- slow - os indipendent-ish

nfs- fast - win support -(

rsync- no real share - update

VM Performance

run testshellip

still runninghellip

mitchellhcomcomparing-filesystem-performance-in-virtual-machines

Virtualbox vs VmWare

Virtualbox 22 min

VmWare 15 min

Virtualbox 22 min

VmWare 15 min+30

use VmWare if you can(it will cost you a few $)

use nfs if you can

vagrant plugin install vbguest

keeps guest addition updated

unless Vagranthas_plugin(ldquovagrant-vbguest) raise rdquoplease install vagrant-vbguestrdquo end

On VM IO is the bottleneck

loading webpages running testsuites are READ heavy

move IO outside shared folders

Default provider virtualbox

3 PHP test suites with unit functional integration mix

small (sf1) build runs in ~25 sec

medium (zf2) build runs in ~2 mins

large (sf2) build runs ~ 20 mins

IO logs cache

class AppKernel extends Kernel public function getCacheDir() if (in_array($this-gtenvironment array(dev test))) return devshmappnamecache $this-gtenvironment

return parentgetCacheDir()

public function getLogDir() if (in_array($this-gtenvironment array(dev lsquotest))) return devshmappnamelogs

return parentgetLogDir()

class AppKernel extends Kernel public function getCacheDir() if (in_array($this-gtenvironment array(dev test))) return devshmappnamecache $this-gtenvironment

return parentgetCacheDir()

public function getLogDir() if (in_array($this-gtenvironment array(dev lsquotest))) return devshmappnamelogs

return parentgetLogDir()

+13-16

IO move DB on RAMif you use sqlite move it on devshm

vagrant plugin install vagrantcachier

if Vagranthas_plugin(vagrant-cachier) configcachescope = box

configcachesynced_folder_opts = type nfs mount_options [rwvers=3tcpnolock] end

Vagrantfile

if Vagranthas_plugin(vagrant-cachier) configcachescope = box

configcachesynced_folder_opts = type nfs mount_options [rwvers=3tcpnolock] end

Vagrantfile

+30for reprovisioning a box with git php apache mysql

use cachefilesd for nfs

- name Install cachefilesd apt pkg=cachefilesd state=present

- name Enable cachefilesd lineinfile dest=etcdefaultcachefilesd line=ldquoRUN=yesrdquo

- name Start cachefilesd service service name=cachefilesd state=restarted

configvmsynced_folder varwww id ldquovagrant-rootrdquo type ldquonfsrdquo mount_options [rwvers=3tcpfsc]

Vagrantfile

configvmsynced_folder varwww id ldquovagrant-rootrdquo type ldquonfsrdquo mount_options [rwvers=3tcpfsc]

Vagrantfile

-15+10

should you trust these numbers

Application Management

How to access mysql

- name add mysql user mysql_user name=ideato host= password=ideato priv=ALLGRANT login_user=root login_password=

- name config bind address to allow remote remote connections lineinfile dest=etcmysqlmycnf state=present regexp=bind-address = 127001 line=bind-address = 0000 backup=yes

- name restart mysql service name=mysql state=restarted

Permissions management in shared folders

configvmsynced_folder varwww id vagrant-root owner vagrant group vagrant mount_options [dmode=777fmode=777]

Use host ssh keys

configsshforward_agent = true

ForwardAgent yes

check ssh config file in your host machine

gruntgulp watch

httpwwwsebastien-hanfrblog20121218noac-performance-impact-on-web-applications

configvmsynced_folder varwww id ldquovagrant-rootrdquo type ldquonfsrdquo mount_options [lsquorwrsquovers=3tcpfsc actimeo=1]

Provisioning

to phansible or not to phansible

quick and easy way to start

theyrsquore general

old platforms are not supported

a lot of a good ideas you can steal from

if which(ansible-playbook) configvmprovision ansible do |ansible| ansibleplaybook = ansibleplaybookyml ansibleinventory_path = ansibleinventoriesdev ansiblelimit = all ansibleextra_vars = private_interface 1921683399 hostname default end else configvmprovision shell path ansiblewindowssh args [default] end

can you assume everyone in your team have the same version

if which(ansible-playbook) configvmprovision ansible do |ansible| ansibleplaybook = ansibleplaybookyml ansibleinventory_path = ansibleinventoriesdev ansiblelimit = all ansibleextra_vars = private_interface 1921683399 hostname default end else configvmprovision shell path ansiblewindowssh args [default] end

the provisioning tool is a moving part wanna update be careful

create Vagrant indipendent provision

scripts

configvmprovision shell path =gt scriptsbootstrapsh args =gt varwww

configvmprovision shell path =gt ldquoscriptsprovisionsh args =gt varwww

create your own template

httpsgithubcomideatosrlvagrant-php-template

yoursquore in control of provisioning command

you can perform additional checks on host machine

Distributing VMs

provisioning does not create immutable vm by default

eg package update on LTS

live on the edge and fix provision script

use stable package repositories

httpsspeakerdeckcommitchellhvagrant-usage-patterns

Create and distribute your own VM

Golden image

vagrant package - -name myboxbox

publish it somewhere (http atlas)

cvmbox_url = ldquohttpmyboxboxrdquo

- Donrsquot make assumptions about the host

- Provision first then bake your own image

- The more moving part the harder will get

Keep it simple

Thank you

_orso_

micheleorselli ideatosrl

moideatoit

Michele OrselliCTOIdeato

_orso_

micheleorselli ideatosrl

moideatoit

httpmitchellhcomthe-tao-of-vagrant

1) clone repo

2) vagrant up

3) therersquos no 3

1) clone repo

2) vagrant up

tips

vagrantfile configs vm performance

app config tips provisionpackaging

Portable configuration tips

Donrsquot use local names for your boxes

configvmbox = base

cvmbox = hashicorpprecise64

cvmbox_url = httpyour_box

Avoid absolute paths

cvmsynced_folder ldquomyProjvarwwwmyProj

configvmsynced_folder varwwwmyProj

Move host specific configuration outside

Vagrantfile

ram 2048 cpus 2 ipaddress 10101010

vagrantfile-local-configyml

require lsquoyaml

_config = YAMLload(Fileopen(Filejoin(Filedirname(__FILE__) ldquovagrantfile-local-configymlrdquo) FileRDONLY)read) CONF = _config

configvmprovider virtualbox do |vb| vbcustomize[modifyvmidldquo--memory CONF[ram]] vbcustomize [modifyvmid--cpus CONF[ldquocpus]] hellip end

As rule of thumb you could assign the half cpus and a quarter of the memory based on your host machine

httpsstefanwrobelcomhow-to-make-vagrant-performance-not-suck

Force a specific provider

ENV[VAGRANT_DEFAULT_PROVIDER] = virtualbox

Support multiple providers

configvmprovider virtualbox do |vb| vbcustomize [modifyvmid --memory CONF[ram]] vbcustomize [modifyvmid --cpus CONF[cpus]] end configvmprovider vmware_fusion do |v| vvmx[memsize] = CONF[ram] vvmx[numvcpus] = CONF[cpus] end

Projectrsquos directories organization

myproject -- hellip -- vagrant -- Vagrantfile

single git repository

cvmsynced_folder ldquordquordquovarwwwmyproject

myproject -- project --hellip -- vagrant -- Vagrantfile

single git repository

cvmsynced_folder ldquoprojectrdquordquovarwwwprojectrdquo

myproject -- vagrant -- www -- project1 -- project2 -- Vagrantfile

singlemultiple git repositories

cvmsynced_folder ldquowwwrdquordquovarwwwrdquo

vagrant plugin install HostsUpdater

(or HostManager)

etchosts

10101040 host1lo VAGRANT e2bca7c8bf6d76cbcf6ee48998c16f

if Vagranthas_plugin(HostsUpdater) confighostsupdateraliases = [host1lo] else puts --- WARNING --- puts ldquoYou should install HostsUpdaterrdquo end

Multi-VM Configuration

configvmdefine web do |web| webvmnetwork private_network ip 10002 webvmprovider virtualbox do |v| vcustomize [modifyvm id --memory 2048] end webvmsynced_folder ldquovarwww end configvmdefine db do |db| dbvmnetwork private_network ip 10003 dbvmprovision shell path =gt vagrantdbsh end

Dealing with shared folders

no share

native share- slow - os indipendent-ish

nfs- fast - win support -(

rsync- no real share - update

VM Performance

run testshellip

still runninghellip

mitchellhcomcomparing-filesystem-performance-in-virtual-machines

Virtualbox vs VmWare

Virtualbox 22 min

VmWare 15 min

Virtualbox 22 min

VmWare 15 min+30

use VmWare if you can(it will cost you a few $)

use nfs if you can

vagrant plugin install vbguest

keeps guest addition updated

unless Vagranthas_plugin(ldquovagrant-vbguest) raise rdquoplease install vagrant-vbguestrdquo end

On VM IO is the bottleneck

loading webpages running testsuites are READ heavy

move IO outside shared folders

Default provider virtualbox

3 PHP test suites with unit functional integration mix

small (sf1) build runs in ~25 sec

medium (zf2) build runs in ~2 mins

large (sf2) build runs ~ 20 mins

IO logs cache

class AppKernel extends Kernel public function getCacheDir() if (in_array($this-gtenvironment array(dev test))) return devshmappnamecache $this-gtenvironment

return parentgetCacheDir()

public function getLogDir() if (in_array($this-gtenvironment array(dev lsquotest))) return devshmappnamelogs

return parentgetLogDir()

class AppKernel extends Kernel public function getCacheDir() if (in_array($this-gtenvironment array(dev test))) return devshmappnamecache $this-gtenvironment

return parentgetCacheDir()

public function getLogDir() if (in_array($this-gtenvironment array(dev lsquotest))) return devshmappnamelogs

return parentgetLogDir()

+13-16

IO move DB on RAMif you use sqlite move it on devshm

vagrant plugin install vagrantcachier

if Vagranthas_plugin(vagrant-cachier) configcachescope = box

configcachesynced_folder_opts = type nfs mount_options [rwvers=3tcpnolock] end

Vagrantfile

if Vagranthas_plugin(vagrant-cachier) configcachescope = box

configcachesynced_folder_opts = type nfs mount_options [rwvers=3tcpnolock] end

Vagrantfile

+30for reprovisioning a box with git php apache mysql

use cachefilesd for nfs

- name Install cachefilesd apt pkg=cachefilesd state=present

- name Enable cachefilesd lineinfile dest=etcdefaultcachefilesd line=ldquoRUN=yesrdquo

- name Start cachefilesd service service name=cachefilesd state=restarted

configvmsynced_folder varwww id ldquovagrant-rootrdquo type ldquonfsrdquo mount_options [rwvers=3tcpfsc]

Vagrantfile

configvmsynced_folder varwww id ldquovagrant-rootrdquo type ldquonfsrdquo mount_options [rwvers=3tcpfsc]

Vagrantfile

-15+10

should you trust these numbers

Application Management

How to access mysql

- name add mysql user mysql_user name=ideato host= password=ideato priv=ALLGRANT login_user=root login_password=

- name config bind address to allow remote remote connections lineinfile dest=etcmysqlmycnf state=present regexp=bind-address = 127001 line=bind-address = 0000 backup=yes

- name restart mysql service name=mysql state=restarted

Permissions management in shared folders

configvmsynced_folder varwww id vagrant-root owner vagrant group vagrant mount_options [dmode=777fmode=777]

Use host ssh keys

configsshforward_agent = true

ForwardAgent yes

check ssh config file in your host machine

gruntgulp watch

httpwwwsebastien-hanfrblog20121218noac-performance-impact-on-web-applications

configvmsynced_folder varwww id ldquovagrant-rootrdquo type ldquonfsrdquo mount_options [lsquorwrsquovers=3tcpfsc actimeo=1]

Provisioning

to phansible or not to phansible

quick and easy way to start

theyrsquore general

old platforms are not supported

a lot of a good ideas you can steal from

if which(ansible-playbook) configvmprovision ansible do |ansible| ansibleplaybook = ansibleplaybookyml ansibleinventory_path = ansibleinventoriesdev ansiblelimit = all ansibleextra_vars = private_interface 1921683399 hostname default end else configvmprovision shell path ansiblewindowssh args [default] end

can you assume everyone in your team have the same version

if which(ansible-playbook) configvmprovision ansible do |ansible| ansibleplaybook = ansibleplaybookyml ansibleinventory_path = ansibleinventoriesdev ansiblelimit = all ansibleextra_vars = private_interface 1921683399 hostname default end else configvmprovision shell path ansiblewindowssh args [default] end

the provisioning tool is a moving part wanna update be careful

create Vagrant indipendent provision

scripts

configvmprovision shell path =gt scriptsbootstrapsh args =gt varwww

configvmprovision shell path =gt ldquoscriptsprovisionsh args =gt varwww

create your own template

httpsgithubcomideatosrlvagrant-php-template

yoursquore in control of provisioning command

you can perform additional checks on host machine

Distributing VMs

provisioning does not create immutable vm by default

eg package update on LTS

live on the edge and fix provision script

use stable package repositories

httpsspeakerdeckcommitchellhvagrant-usage-patterns

Create and distribute your own VM

Golden image

vagrant package - -name myboxbox

publish it somewhere (http atlas)

cvmbox_url = ldquohttpmyboxboxrdquo

- Donrsquot make assumptions about the host

- Provision first then bake your own image

- The more moving part the harder will get

Keep it simple

Thank you

_orso_

micheleorselli ideatosrl

moideatoit

httpmitchellhcomthe-tao-of-vagrant

1) clone repo

2) vagrant up

3) therersquos no 3

1) clone repo

2) vagrant up

tips

vagrantfile configs vm performance

app config tips provisionpackaging

Portable configuration tips

Donrsquot use local names for your boxes

configvmbox = base

cvmbox = hashicorpprecise64

cvmbox_url = httpyour_box

Avoid absolute paths

cvmsynced_folder ldquomyProjvarwwwmyProj

configvmsynced_folder varwwwmyProj

Move host specific configuration outside

Vagrantfile

ram 2048 cpus 2 ipaddress 10101010

vagrantfile-local-configyml

require lsquoyaml

_config = YAMLload(Fileopen(Filejoin(Filedirname(__FILE__) ldquovagrantfile-local-configymlrdquo) FileRDONLY)read) CONF = _config

configvmprovider virtualbox do |vb| vbcustomize[modifyvmidldquo--memory CONF[ram]] vbcustomize [modifyvmid--cpus CONF[ldquocpus]] hellip end

As rule of thumb you could assign the half cpus and a quarter of the memory based on your host machine

httpsstefanwrobelcomhow-to-make-vagrant-performance-not-suck

Force a specific provider

ENV[VAGRANT_DEFAULT_PROVIDER] = virtualbox

Support multiple providers

configvmprovider virtualbox do |vb| vbcustomize [modifyvmid --memory CONF[ram]] vbcustomize [modifyvmid --cpus CONF[cpus]] end configvmprovider vmware_fusion do |v| vvmx[memsize] = CONF[ram] vvmx[numvcpus] = CONF[cpus] end

Projectrsquos directories organization

myproject -- hellip -- vagrant -- Vagrantfile

single git repository

cvmsynced_folder ldquordquordquovarwwwmyproject

myproject -- project --hellip -- vagrant -- Vagrantfile

single git repository

cvmsynced_folder ldquoprojectrdquordquovarwwwprojectrdquo

myproject -- vagrant -- www -- project1 -- project2 -- Vagrantfile

singlemultiple git repositories

cvmsynced_folder ldquowwwrdquordquovarwwwrdquo

vagrant plugin install HostsUpdater

(or HostManager)

etchosts

10101040 host1lo VAGRANT e2bca7c8bf6d76cbcf6ee48998c16f

if Vagranthas_plugin(HostsUpdater) confighostsupdateraliases = [host1lo] else puts --- WARNING --- puts ldquoYou should install HostsUpdaterrdquo end

Multi-VM Configuration

configvmdefine web do |web| webvmnetwork private_network ip 10002 webvmprovider virtualbox do |v| vcustomize [modifyvm id --memory 2048] end webvmsynced_folder ldquovarwww end configvmdefine db do |db| dbvmnetwork private_network ip 10003 dbvmprovision shell path =gt vagrantdbsh end

Dealing with shared folders

no share

native share- slow - os indipendent-ish

nfs- fast - win support -(

rsync- no real share - update

VM Performance

run testshellip

still runninghellip

mitchellhcomcomparing-filesystem-performance-in-virtual-machines

Virtualbox vs VmWare

Virtualbox 22 min

VmWare 15 min

Virtualbox 22 min

VmWare 15 min+30

use VmWare if you can(it will cost you a few $)

use nfs if you can

vagrant plugin install vbguest

keeps guest addition updated

unless Vagranthas_plugin(ldquovagrant-vbguest) raise rdquoplease install vagrant-vbguestrdquo end

On VM IO is the bottleneck

loading webpages running testsuites are READ heavy

move IO outside shared folders

Default provider virtualbox

3 PHP test suites with unit functional integration mix

small (sf1) build runs in ~25 sec

medium (zf2) build runs in ~2 mins

large (sf2) build runs ~ 20 mins

IO logs cache

class AppKernel extends Kernel public function getCacheDir() if (in_array($this-gtenvironment array(dev test))) return devshmappnamecache $this-gtenvironment

return parentgetCacheDir()

public function getLogDir() if (in_array($this-gtenvironment array(dev lsquotest))) return devshmappnamelogs

return parentgetLogDir()

class AppKernel extends Kernel public function getCacheDir() if (in_array($this-gtenvironment array(dev test))) return devshmappnamecache $this-gtenvironment

return parentgetCacheDir()

public function getLogDir() if (in_array($this-gtenvironment array(dev lsquotest))) return devshmappnamelogs

return parentgetLogDir()

+13-16

IO move DB on RAMif you use sqlite move it on devshm

vagrant plugin install vagrantcachier

if Vagranthas_plugin(vagrant-cachier) configcachescope = box

configcachesynced_folder_opts = type nfs mount_options [rwvers=3tcpnolock] end

Vagrantfile

if Vagranthas_plugin(vagrant-cachier) configcachescope = box

configcachesynced_folder_opts = type nfs mount_options [rwvers=3tcpnolock] end

Vagrantfile

+30for reprovisioning a box with git php apache mysql

use cachefilesd for nfs

- name Install cachefilesd apt pkg=cachefilesd state=present

- name Enable cachefilesd lineinfile dest=etcdefaultcachefilesd line=ldquoRUN=yesrdquo

- name Start cachefilesd service service name=cachefilesd state=restarted

configvmsynced_folder varwww id ldquovagrant-rootrdquo type ldquonfsrdquo mount_options [rwvers=3tcpfsc]

Vagrantfile

configvmsynced_folder varwww id ldquovagrant-rootrdquo type ldquonfsrdquo mount_options [rwvers=3tcpfsc]

Vagrantfile

-15+10

should you trust these numbers

Application Management

How to access mysql

- name add mysql user mysql_user name=ideato host= password=ideato priv=ALLGRANT login_user=root login_password=

- name config bind address to allow remote remote connections lineinfile dest=etcmysqlmycnf state=present regexp=bind-address = 127001 line=bind-address = 0000 backup=yes

- name restart mysql service name=mysql state=restarted

Permissions management in shared folders

configvmsynced_folder varwww id vagrant-root owner vagrant group vagrant mount_options [dmode=777fmode=777]

Use host ssh keys

configsshforward_agent = true

ForwardAgent yes

check ssh config file in your host machine

gruntgulp watch

httpwwwsebastien-hanfrblog20121218noac-performance-impact-on-web-applications

configvmsynced_folder varwww id ldquovagrant-rootrdquo type ldquonfsrdquo mount_options [lsquorwrsquovers=3tcpfsc actimeo=1]

Provisioning

to phansible or not to phansible

quick and easy way to start

theyrsquore general

old platforms are not supported

a lot of a good ideas you can steal from

if which(ansible-playbook) configvmprovision ansible do |ansible| ansibleplaybook = ansibleplaybookyml ansibleinventory_path = ansibleinventoriesdev ansiblelimit = all ansibleextra_vars = private_interface 1921683399 hostname default end else configvmprovision shell path ansiblewindowssh args [default] end

can you assume everyone in your team have the same version

if which(ansible-playbook) configvmprovision ansible do |ansible| ansibleplaybook = ansibleplaybookyml ansibleinventory_path = ansibleinventoriesdev ansiblelimit = all ansibleextra_vars = private_interface 1921683399 hostname default end else configvmprovision shell path ansiblewindowssh args [default] end

the provisioning tool is a moving part wanna update be careful

create Vagrant indipendent provision

scripts

configvmprovision shell path =gt scriptsbootstrapsh args =gt varwww

configvmprovision shell path =gt ldquoscriptsprovisionsh args =gt varwww

create your own template

httpsgithubcomideatosrlvagrant-php-template

yoursquore in control of provisioning command

you can perform additional checks on host machine

Distributing VMs

provisioning does not create immutable vm by default

eg package update on LTS

live on the edge and fix provision script

use stable package repositories

httpsspeakerdeckcommitchellhvagrant-usage-patterns

Create and distribute your own VM

Golden image

vagrant package - -name myboxbox

publish it somewhere (http atlas)

cvmbox_url = ldquohttpmyboxboxrdquo

- Donrsquot make assumptions about the host

- Provision first then bake your own image

- The more moving part the harder will get

Keep it simple

Thank you

_orso_

micheleorselli ideatosrl

moideatoit

1) clone repo

2) vagrant up

3) therersquos no 3

1) clone repo

2) vagrant up

tips

vagrantfile configs vm performance

app config tips provisionpackaging

Portable configuration tips

Donrsquot use local names for your boxes

configvmbox = base

cvmbox = hashicorpprecise64

cvmbox_url = httpyour_box

Avoid absolute paths

cvmsynced_folder ldquomyProjvarwwwmyProj

configvmsynced_folder varwwwmyProj

Move host specific configuration outside

Vagrantfile

ram 2048 cpus 2 ipaddress 10101010

vagrantfile-local-configyml

require lsquoyaml

_config = YAMLload(Fileopen(Filejoin(Filedirname(__FILE__) ldquovagrantfile-local-configymlrdquo) FileRDONLY)read) CONF = _config

configvmprovider virtualbox do |vb| vbcustomize[modifyvmidldquo--memory CONF[ram]] vbcustomize [modifyvmid--cpus CONF[ldquocpus]] hellip end

As rule of thumb you could assign the half cpus and a quarter of the memory based on your host machine

httpsstefanwrobelcomhow-to-make-vagrant-performance-not-suck

Force a specific provider

ENV[VAGRANT_DEFAULT_PROVIDER] = virtualbox

Support multiple providers

configvmprovider virtualbox do |vb| vbcustomize [modifyvmid --memory CONF[ram]] vbcustomize [modifyvmid --cpus CONF[cpus]] end configvmprovider vmware_fusion do |v| vvmx[memsize] = CONF[ram] vvmx[numvcpus] = CONF[cpus] end

Projectrsquos directories organization

myproject -- hellip -- vagrant -- Vagrantfile

single git repository

cvmsynced_folder ldquordquordquovarwwwmyproject

myproject -- project --hellip -- vagrant -- Vagrantfile

single git repository

cvmsynced_folder ldquoprojectrdquordquovarwwwprojectrdquo

myproject -- vagrant -- www -- project1 -- project2 -- Vagrantfile

singlemultiple git repositories

cvmsynced_folder ldquowwwrdquordquovarwwwrdquo

vagrant plugin install HostsUpdater

(or HostManager)

etchosts

10101040 host1lo VAGRANT e2bca7c8bf6d76cbcf6ee48998c16f

if Vagranthas_plugin(HostsUpdater) confighostsupdateraliases = [host1lo] else puts --- WARNING --- puts ldquoYou should install HostsUpdaterrdquo end

Multi-VM Configuration

configvmdefine web do |web| webvmnetwork private_network ip 10002 webvmprovider virtualbox do |v| vcustomize [modifyvm id --memory 2048] end webvmsynced_folder ldquovarwww end configvmdefine db do |db| dbvmnetwork private_network ip 10003 dbvmprovision shell path =gt vagrantdbsh end

Dealing with shared folders

no share

native share- slow - os indipendent-ish

nfs- fast - win support -(

rsync- no real share - update

VM Performance

run testshellip

still runninghellip

mitchellhcomcomparing-filesystem-performance-in-virtual-machines

Virtualbox vs VmWare

Virtualbox 22 min

VmWare 15 min

Virtualbox 22 min

VmWare 15 min+30

use VmWare if you can(it will cost you a few $)

use nfs if you can

vagrant plugin install vbguest

keeps guest addition updated

unless Vagranthas_plugin(ldquovagrant-vbguest) raise rdquoplease install vagrant-vbguestrdquo end

On VM IO is the bottleneck

loading webpages running testsuites are READ heavy

move IO outside shared folders

Default provider virtualbox

3 PHP test suites with unit functional integration mix

small (sf1) build runs in ~25 sec

medium (zf2) build runs in ~2 mins

large (sf2) build runs ~ 20 mins

IO logs cache

class AppKernel extends Kernel public function getCacheDir() if (in_array($this-gtenvironment array(dev test))) return devshmappnamecache $this-gtenvironment

return parentgetCacheDir()

public function getLogDir() if (in_array($this-gtenvironment array(dev lsquotest))) return devshmappnamelogs

return parentgetLogDir()

class AppKernel extends Kernel public function getCacheDir() if (in_array($this-gtenvironment array(dev test))) return devshmappnamecache $this-gtenvironment

return parentgetCacheDir()

public function getLogDir() if (in_array($this-gtenvironment array(dev lsquotest))) return devshmappnamelogs

return parentgetLogDir()

+13-16

IO move DB on RAMif you use sqlite move it on devshm

vagrant plugin install vagrantcachier

if Vagranthas_plugin(vagrant-cachier) configcachescope = box

configcachesynced_folder_opts = type nfs mount_options [rwvers=3tcpnolock] end

Vagrantfile

if Vagranthas_plugin(vagrant-cachier) configcachescope = box

configcachesynced_folder_opts = type nfs mount_options [rwvers=3tcpnolock] end

Vagrantfile

+30for reprovisioning a box with git php apache mysql

use cachefilesd for nfs

- name Install cachefilesd apt pkg=cachefilesd state=present

- name Enable cachefilesd lineinfile dest=etcdefaultcachefilesd line=ldquoRUN=yesrdquo

- name Start cachefilesd service service name=cachefilesd state=restarted

configvmsynced_folder varwww id ldquovagrant-rootrdquo type ldquonfsrdquo mount_options [rwvers=3tcpfsc]

Vagrantfile

configvmsynced_folder varwww id ldquovagrant-rootrdquo type ldquonfsrdquo mount_options [rwvers=3tcpfsc]

Vagrantfile

-15+10

should you trust these numbers

Application Management

How to access mysql

- name add mysql user mysql_user name=ideato host= password=ideato priv=ALLGRANT login_user=root login_password=

- name config bind address to allow remote remote connections lineinfile dest=etcmysqlmycnf state=present regexp=bind-address = 127001 line=bind-address = 0000 backup=yes

- name restart mysql service name=mysql state=restarted

Permissions management in shared folders

configvmsynced_folder varwww id vagrant-root owner vagrant group vagrant mount_options [dmode=777fmode=777]

Use host ssh keys

configsshforward_agent = true

ForwardAgent yes

check ssh config file in your host machine

gruntgulp watch

httpwwwsebastien-hanfrblog20121218noac-performance-impact-on-web-applications

configvmsynced_folder varwww id ldquovagrant-rootrdquo type ldquonfsrdquo mount_options [lsquorwrsquovers=3tcpfsc actimeo=1]

Provisioning

to phansible or not to phansible

quick and easy way to start

theyrsquore general

old platforms are not supported

a lot of a good ideas you can steal from

if which(ansible-playbook) configvmprovision ansible do |ansible| ansibleplaybook = ansibleplaybookyml ansibleinventory_path = ansibleinventoriesdev ansiblelimit = all ansibleextra_vars = private_interface 1921683399 hostname default end else configvmprovision shell path ansiblewindowssh args [default] end

can you assume everyone in your team have the same version

if which(ansible-playbook) configvmprovision ansible do |ansible| ansibleplaybook = ansibleplaybookyml ansibleinventory_path = ansibleinventoriesdev ansiblelimit = all ansibleextra_vars = private_interface 1921683399 hostname default end else configvmprovision shell path ansiblewindowssh args [default] end

the provisioning tool is a moving part wanna update be careful

create Vagrant indipendent provision

scripts

configvmprovision shell path =gt scriptsbootstrapsh args =gt varwww

configvmprovision shell path =gt ldquoscriptsprovisionsh args =gt varwww

create your own template

httpsgithubcomideatosrlvagrant-php-template

yoursquore in control of provisioning command

you can perform additional checks on host machine

Distributing VMs

provisioning does not create immutable vm by default

eg package update on LTS

live on the edge and fix provision script

use stable package repositories

httpsspeakerdeckcommitchellhvagrant-usage-patterns

Create and distribute your own VM

Golden image

vagrant package - -name myboxbox

publish it somewhere (http atlas)

cvmbox_url = ldquohttpmyboxboxrdquo

- Donrsquot make assumptions about the host

- Provision first then bake your own image

- The more moving part the harder will get

Keep it simple

Thank you

_orso_

micheleorselli ideatosrl

moideatoit

1) clone repo

2) vagrant up

tips

vagrantfile configs vm performance

app config tips provisionpackaging

Portable configuration tips

Donrsquot use local names for your boxes

configvmbox = base

cvmbox = hashicorpprecise64

cvmbox_url = httpyour_box

Avoid absolute paths

cvmsynced_folder ldquomyProjvarwwwmyProj

configvmsynced_folder varwwwmyProj

Move host specific configuration outside

Vagrantfile

ram 2048 cpus 2 ipaddress 10101010

vagrantfile-local-configyml

require lsquoyaml

_config = YAMLload(Fileopen(Filejoin(Filedirname(__FILE__) ldquovagrantfile-local-configymlrdquo) FileRDONLY)read) CONF = _config

configvmprovider virtualbox do |vb| vbcustomize[modifyvmidldquo--memory CONF[ram]] vbcustomize [modifyvmid--cpus CONF[ldquocpus]] hellip end

As rule of thumb you could assign the half cpus and a quarter of the memory based on your host machine

httpsstefanwrobelcomhow-to-make-vagrant-performance-not-suck

Force a specific provider

ENV[VAGRANT_DEFAULT_PROVIDER] = virtualbox

Support multiple providers

configvmprovider virtualbox do |vb| vbcustomize [modifyvmid --memory CONF[ram]] vbcustomize [modifyvmid --cpus CONF[cpus]] end configvmprovider vmware_fusion do |v| vvmx[memsize] = CONF[ram] vvmx[numvcpus] = CONF[cpus] end

Projectrsquos directories organization

myproject -- hellip -- vagrant -- Vagrantfile

single git repository

cvmsynced_folder ldquordquordquovarwwwmyproject

myproject -- project --hellip -- vagrant -- Vagrantfile

single git repository

cvmsynced_folder ldquoprojectrdquordquovarwwwprojectrdquo

myproject -- vagrant -- www -- project1 -- project2 -- Vagrantfile

singlemultiple git repositories

cvmsynced_folder ldquowwwrdquordquovarwwwrdquo

vagrant plugin install HostsUpdater

(or HostManager)

etchosts

10101040 host1lo VAGRANT e2bca7c8bf6d76cbcf6ee48998c16f

if Vagranthas_plugin(HostsUpdater) confighostsupdateraliases = [host1lo] else puts --- WARNING --- puts ldquoYou should install HostsUpdaterrdquo end

Multi-VM Configuration

configvmdefine web do |web| webvmnetwork private_network ip 10002 webvmprovider virtualbox do |v| vcustomize [modifyvm id --memory 2048] end webvmsynced_folder ldquovarwww end configvmdefine db do |db| dbvmnetwork private_network ip 10003 dbvmprovision shell path =gt vagrantdbsh end

Dealing with shared folders

no share

native share- slow - os indipendent-ish

nfs- fast - win support -(

rsync- no real share - update

VM Performance

run testshellip

still runninghellip

mitchellhcomcomparing-filesystem-performance-in-virtual-machines

Virtualbox vs VmWare

Virtualbox 22 min

VmWare 15 min

Virtualbox 22 min

VmWare 15 min+30

use VmWare if you can(it will cost you a few $)

use nfs if you can

vagrant plugin install vbguest

keeps guest addition updated

unless Vagranthas_plugin(ldquovagrant-vbguest) raise rdquoplease install vagrant-vbguestrdquo end

On VM IO is the bottleneck

loading webpages running testsuites are READ heavy

move IO outside shared folders

Default provider virtualbox

3 PHP test suites with unit functional integration mix

small (sf1) build runs in ~25 sec

medium (zf2) build runs in ~2 mins

large (sf2) build runs ~ 20 mins

IO logs cache

class AppKernel extends Kernel public function getCacheDir() if (in_array($this-gtenvironment array(dev test))) return devshmappnamecache $this-gtenvironment

return parentgetCacheDir()

public function getLogDir() if (in_array($this-gtenvironment array(dev lsquotest))) return devshmappnamelogs

return parentgetLogDir()

class AppKernel extends Kernel public function getCacheDir() if (in_array($this-gtenvironment array(dev test))) return devshmappnamecache $this-gtenvironment

return parentgetCacheDir()

public function getLogDir() if (in_array($this-gtenvironment array(dev lsquotest))) return devshmappnamelogs

return parentgetLogDir()

+13-16

IO move DB on RAMif you use sqlite move it on devshm

vagrant plugin install vagrantcachier

if Vagranthas_plugin(vagrant-cachier) configcachescope = box

configcachesynced_folder_opts = type nfs mount_options [rwvers=3tcpnolock] end

Vagrantfile

if Vagranthas_plugin(vagrant-cachier) configcachescope = box

configcachesynced_folder_opts = type nfs mount_options [rwvers=3tcpnolock] end

Vagrantfile

+30for reprovisioning a box with git php apache mysql

use cachefilesd for nfs

- name Install cachefilesd apt pkg=cachefilesd state=present

- name Enable cachefilesd lineinfile dest=etcdefaultcachefilesd line=ldquoRUN=yesrdquo

- name Start cachefilesd service service name=cachefilesd state=restarted

configvmsynced_folder varwww id ldquovagrant-rootrdquo type ldquonfsrdquo mount_options [rwvers=3tcpfsc]

Vagrantfile

configvmsynced_folder varwww id ldquovagrant-rootrdquo type ldquonfsrdquo mount_options [rwvers=3tcpfsc]

Vagrantfile

-15+10

should you trust these numbers

Application Management

How to access mysql

- name add mysql user mysql_user name=ideato host= password=ideato priv=ALLGRANT login_user=root login_password=

- name config bind address to allow remote remote connections lineinfile dest=etcmysqlmycnf state=present regexp=bind-address = 127001 line=bind-address = 0000 backup=yes

- name restart mysql service name=mysql state=restarted

Permissions management in shared folders

configvmsynced_folder varwww id vagrant-root owner vagrant group vagrant mount_options [dmode=777fmode=777]

Use host ssh keys

configsshforward_agent = true

ForwardAgent yes

check ssh config file in your host machine

gruntgulp watch

httpwwwsebastien-hanfrblog20121218noac-performance-impact-on-web-applications

configvmsynced_folder varwww id ldquovagrant-rootrdquo type ldquonfsrdquo mount_options [lsquorwrsquovers=3tcpfsc actimeo=1]

Provisioning

to phansible or not to phansible

quick and easy way to start

theyrsquore general

old platforms are not supported

a lot of a good ideas you can steal from

if which(ansible-playbook) configvmprovision ansible do |ansible| ansibleplaybook = ansibleplaybookyml ansibleinventory_path = ansibleinventoriesdev ansiblelimit = all ansibleextra_vars = private_interface 1921683399 hostname default end else configvmprovision shell path ansiblewindowssh args [default] end

can you assume everyone in your team have the same version

if which(ansible-playbook) configvmprovision ansible do |ansible| ansibleplaybook = ansibleplaybookyml ansibleinventory_path = ansibleinventoriesdev ansiblelimit = all ansibleextra_vars = private_interface 1921683399 hostname default end else configvmprovision shell path ansiblewindowssh args [default] end

the provisioning tool is a moving part wanna update be careful

create Vagrant indipendent provision

scripts

configvmprovision shell path =gt scriptsbootstrapsh args =gt varwww

configvmprovision shell path =gt ldquoscriptsprovisionsh args =gt varwww

create your own template

httpsgithubcomideatosrlvagrant-php-template

yoursquore in control of provisioning command

you can perform additional checks on host machine

Distributing VMs

provisioning does not create immutable vm by default

eg package update on LTS

live on the edge and fix provision script

use stable package repositories

httpsspeakerdeckcommitchellhvagrant-usage-patterns

Create and distribute your own VM

Golden image

vagrant package - -name myboxbox

publish it somewhere (http atlas)

cvmbox_url = ldquohttpmyboxboxrdquo

- Donrsquot make assumptions about the host

- Provision first then bake your own image

- The more moving part the harder will get

Keep it simple

Thank you

_orso_

micheleorselli ideatosrl

moideatoit

tips

vagrantfile configs vm performance

app config tips provisionpackaging

Portable configuration tips

Donrsquot use local names for your boxes

configvmbox = base

cvmbox = hashicorpprecise64

cvmbox_url = httpyour_box

Avoid absolute paths

cvmsynced_folder ldquomyProjvarwwwmyProj

configvmsynced_folder varwwwmyProj

Move host specific configuration outside

Vagrantfile

ram 2048 cpus 2 ipaddress 10101010

vagrantfile-local-configyml

require lsquoyaml

_config = YAMLload(Fileopen(Filejoin(Filedirname(__FILE__) ldquovagrantfile-local-configymlrdquo) FileRDONLY)read) CONF = _config

configvmprovider virtualbox do |vb| vbcustomize[modifyvmidldquo--memory CONF[ram]] vbcustomize [modifyvmid--cpus CONF[ldquocpus]] hellip end

As rule of thumb you could assign the half cpus and a quarter of the memory based on your host machine

httpsstefanwrobelcomhow-to-make-vagrant-performance-not-suck

Force a specific provider

ENV[VAGRANT_DEFAULT_PROVIDER] = virtualbox

Support multiple providers

configvmprovider virtualbox do |vb| vbcustomize [modifyvmid --memory CONF[ram]] vbcustomize [modifyvmid --cpus CONF[cpus]] end configvmprovider vmware_fusion do |v| vvmx[memsize] = CONF[ram] vvmx[numvcpus] = CONF[cpus] end

Projectrsquos directories organization

myproject -- hellip -- vagrant -- Vagrantfile

single git repository

cvmsynced_folder ldquordquordquovarwwwmyproject

myproject -- project --hellip -- vagrant -- Vagrantfile

single git repository

cvmsynced_folder ldquoprojectrdquordquovarwwwprojectrdquo

myproject -- vagrant -- www -- project1 -- project2 -- Vagrantfile

singlemultiple git repositories

cvmsynced_folder ldquowwwrdquordquovarwwwrdquo

vagrant plugin install HostsUpdater

(or HostManager)

etchosts

10101040 host1lo VAGRANT e2bca7c8bf6d76cbcf6ee48998c16f

if Vagranthas_plugin(HostsUpdater) confighostsupdateraliases = [host1lo] else puts --- WARNING --- puts ldquoYou should install HostsUpdaterrdquo end

Multi-VM Configuration

configvmdefine web do |web| webvmnetwork private_network ip 10002 webvmprovider virtualbox do |v| vcustomize [modifyvm id --memory 2048] end webvmsynced_folder ldquovarwww end configvmdefine db do |db| dbvmnetwork private_network ip 10003 dbvmprovision shell path =gt vagrantdbsh end

Dealing with shared folders

no share

native share- slow - os indipendent-ish

nfs- fast - win support -(

rsync- no real share - update

VM Performance

run testshellip

still runninghellip

mitchellhcomcomparing-filesystem-performance-in-virtual-machines

Virtualbox vs VmWare

Virtualbox 22 min

VmWare 15 min

Virtualbox 22 min

VmWare 15 min+30

use VmWare if you can(it will cost you a few $)

use nfs if you can

vagrant plugin install vbguest

keeps guest addition updated

unless Vagranthas_plugin(ldquovagrant-vbguest) raise rdquoplease install vagrant-vbguestrdquo end

On VM IO is the bottleneck

loading webpages running testsuites are READ heavy

move IO outside shared folders

Default provider virtualbox

3 PHP test suites with unit functional integration mix

small (sf1) build runs in ~25 sec

medium (zf2) build runs in ~2 mins

large (sf2) build runs ~ 20 mins

IO logs cache

class AppKernel extends Kernel public function getCacheDir() if (in_array($this-gtenvironment array(dev test))) return devshmappnamecache $this-gtenvironment

return parentgetCacheDir()

public function getLogDir() if (in_array($this-gtenvironment array(dev lsquotest))) return devshmappnamelogs

return parentgetLogDir()

class AppKernel extends Kernel public function getCacheDir() if (in_array($this-gtenvironment array(dev test))) return devshmappnamecache $this-gtenvironment

return parentgetCacheDir()

public function getLogDir() if (in_array($this-gtenvironment array(dev lsquotest))) return devshmappnamelogs

return parentgetLogDir()

+13-16

IO move DB on RAMif you use sqlite move it on devshm

vagrant plugin install vagrantcachier

if Vagranthas_plugin(vagrant-cachier) configcachescope = box

configcachesynced_folder_opts = type nfs mount_options [rwvers=3tcpnolock] end

Vagrantfile

if Vagranthas_plugin(vagrant-cachier) configcachescope = box

configcachesynced_folder_opts = type nfs mount_options [rwvers=3tcpnolock] end

Vagrantfile

+30for reprovisioning a box with git php apache mysql

use cachefilesd for nfs

- name Install cachefilesd apt pkg=cachefilesd state=present

- name Enable cachefilesd lineinfile dest=etcdefaultcachefilesd line=ldquoRUN=yesrdquo

- name Start cachefilesd service service name=cachefilesd state=restarted

configvmsynced_folder varwww id ldquovagrant-rootrdquo type ldquonfsrdquo mount_options [rwvers=3tcpfsc]

Vagrantfile

configvmsynced_folder varwww id ldquovagrant-rootrdquo type ldquonfsrdquo mount_options [rwvers=3tcpfsc]

Vagrantfile

-15+10

should you trust these numbers

Application Management

How to access mysql

- name add mysql user mysql_user name=ideato host= password=ideato priv=ALLGRANT login_user=root login_password=

- name config bind address to allow remote remote connections lineinfile dest=etcmysqlmycnf state=present regexp=bind-address = 127001 line=bind-address = 0000 backup=yes

- name restart mysql service name=mysql state=restarted

Permissions management in shared folders

configvmsynced_folder varwww id vagrant-root owner vagrant group vagrant mount_options [dmode=777fmode=777]

Use host ssh keys

configsshforward_agent = true

ForwardAgent yes

check ssh config file in your host machine

gruntgulp watch

httpwwwsebastien-hanfrblog20121218noac-performance-impact-on-web-applications

configvmsynced_folder varwww id ldquovagrant-rootrdquo type ldquonfsrdquo mount_options [lsquorwrsquovers=3tcpfsc actimeo=1]

Provisioning

to phansible or not to phansible

quick and easy way to start

theyrsquore general

old platforms are not supported

a lot of a good ideas you can steal from

if which(ansible-playbook) configvmprovision ansible do |ansible| ansibleplaybook = ansibleplaybookyml ansibleinventory_path = ansibleinventoriesdev ansiblelimit = all ansibleextra_vars = private_interface 1921683399 hostname default end else configvmprovision shell path ansiblewindowssh args [default] end

can you assume everyone in your team have the same version

if which(ansible-playbook) configvmprovision ansible do |ansible| ansibleplaybook = ansibleplaybookyml ansibleinventory_path = ansibleinventoriesdev ansiblelimit = all ansibleextra_vars = private_interface 1921683399 hostname default end else configvmprovision shell path ansiblewindowssh args [default] end

the provisioning tool is a moving part wanna update be careful

create Vagrant indipendent provision

scripts

configvmprovision shell path =gt scriptsbootstrapsh args =gt varwww

configvmprovision shell path =gt ldquoscriptsprovisionsh args =gt varwww

create your own template

httpsgithubcomideatosrlvagrant-php-template

yoursquore in control of provisioning command

you can perform additional checks on host machine

Distributing VMs

provisioning does not create immutable vm by default

eg package update on LTS

live on the edge and fix provision script

use stable package repositories

httpsspeakerdeckcommitchellhvagrant-usage-patterns

Create and distribute your own VM

Golden image

vagrant package - -name myboxbox

publish it somewhere (http atlas)

cvmbox_url = ldquohttpmyboxboxrdquo

- Donrsquot make assumptions about the host

- Provision first then bake your own image

- The more moving part the harder will get

Keep it simple

Thank you

_orso_

micheleorselli ideatosrl

moideatoit

vagrantfile configs vm performance

app config tips provisionpackaging

Portable configuration tips

Donrsquot use local names for your boxes

configvmbox = base

cvmbox = hashicorpprecise64

cvmbox_url = httpyour_box

Avoid absolute paths

cvmsynced_folder ldquomyProjvarwwwmyProj

configvmsynced_folder varwwwmyProj

Move host specific configuration outside

Vagrantfile

ram 2048 cpus 2 ipaddress 10101010

vagrantfile-local-configyml

require lsquoyaml

_config = YAMLload(Fileopen(Filejoin(Filedirname(__FILE__) ldquovagrantfile-local-configymlrdquo) FileRDONLY)read) CONF = _config

configvmprovider virtualbox do |vb| vbcustomize[modifyvmidldquo--memory CONF[ram]] vbcustomize [modifyvmid--cpus CONF[ldquocpus]] hellip end

As rule of thumb you could assign the half cpus and a quarter of the memory based on your host machine

httpsstefanwrobelcomhow-to-make-vagrant-performance-not-suck

Force a specific provider

ENV[VAGRANT_DEFAULT_PROVIDER] = virtualbox

Support multiple providers

configvmprovider virtualbox do |vb| vbcustomize [modifyvmid --memory CONF[ram]] vbcustomize [modifyvmid --cpus CONF[cpus]] end configvmprovider vmware_fusion do |v| vvmx[memsize] = CONF[ram] vvmx[numvcpus] = CONF[cpus] end

Projectrsquos directories organization

myproject -- hellip -- vagrant -- Vagrantfile

single git repository

cvmsynced_folder ldquordquordquovarwwwmyproject

myproject -- project --hellip -- vagrant -- Vagrantfile

single git repository

cvmsynced_folder ldquoprojectrdquordquovarwwwprojectrdquo

myproject -- vagrant -- www -- project1 -- project2 -- Vagrantfile

singlemultiple git repositories

cvmsynced_folder ldquowwwrdquordquovarwwwrdquo

vagrant plugin install HostsUpdater

(or HostManager)

etchosts

10101040 host1lo VAGRANT e2bca7c8bf6d76cbcf6ee48998c16f

if Vagranthas_plugin(HostsUpdater) confighostsupdateraliases = [host1lo] else puts --- WARNING --- puts ldquoYou should install HostsUpdaterrdquo end

Multi-VM Configuration

configvmdefine web do |web| webvmnetwork private_network ip 10002 webvmprovider virtualbox do |v| vcustomize [modifyvm id --memory 2048] end webvmsynced_folder ldquovarwww end configvmdefine db do |db| dbvmnetwork private_network ip 10003 dbvmprovision shell path =gt vagrantdbsh end

Dealing with shared folders

no share

native share- slow - os indipendent-ish

nfs- fast - win support -(

rsync- no real share - update

VM Performance

run testshellip

still runninghellip

mitchellhcomcomparing-filesystem-performance-in-virtual-machines

Virtualbox vs VmWare

Virtualbox 22 min

VmWare 15 min

Virtualbox 22 min

VmWare 15 min+30

use VmWare if you can(it will cost you a few $)

use nfs if you can

vagrant plugin install vbguest

keeps guest addition updated

unless Vagranthas_plugin(ldquovagrant-vbguest) raise rdquoplease install vagrant-vbguestrdquo end

On VM IO is the bottleneck

loading webpages running testsuites are READ heavy

move IO outside shared folders

Default provider virtualbox

3 PHP test suites with unit functional integration mix

small (sf1) build runs in ~25 sec

medium (zf2) build runs in ~2 mins

large (sf2) build runs ~ 20 mins

IO logs cache

class AppKernel extends Kernel public function getCacheDir() if (in_array($this-gtenvironment array(dev test))) return devshmappnamecache $this-gtenvironment

return parentgetCacheDir()

public function getLogDir() if (in_array($this-gtenvironment array(dev lsquotest))) return devshmappnamelogs

return parentgetLogDir()

class AppKernel extends Kernel public function getCacheDir() if (in_array($this-gtenvironment array(dev test))) return devshmappnamecache $this-gtenvironment

return parentgetCacheDir()

public function getLogDir() if (in_array($this-gtenvironment array(dev lsquotest))) return devshmappnamelogs

return parentgetLogDir()

+13-16

IO move DB on RAMif you use sqlite move it on devshm

vagrant plugin install vagrantcachier

if Vagranthas_plugin(vagrant-cachier) configcachescope = box

configcachesynced_folder_opts = type nfs mount_options [rwvers=3tcpnolock] end

Vagrantfile

if Vagranthas_plugin(vagrant-cachier) configcachescope = box

configcachesynced_folder_opts = type nfs mount_options [rwvers=3tcpnolock] end

Vagrantfile

+30for reprovisioning a box with git php apache mysql

use cachefilesd for nfs

- name Install cachefilesd apt pkg=cachefilesd state=present

- name Enable cachefilesd lineinfile dest=etcdefaultcachefilesd line=ldquoRUN=yesrdquo

- name Start cachefilesd service service name=cachefilesd state=restarted

configvmsynced_folder varwww id ldquovagrant-rootrdquo type ldquonfsrdquo mount_options [rwvers=3tcpfsc]

Vagrantfile

configvmsynced_folder varwww id ldquovagrant-rootrdquo type ldquonfsrdquo mount_options [rwvers=3tcpfsc]

Vagrantfile

-15+10

should you trust these numbers

Application Management

How to access mysql

- name add mysql user mysql_user name=ideato host= password=ideato priv=ALLGRANT login_user=root login_password=

- name config bind address to allow remote remote connections lineinfile dest=etcmysqlmycnf state=present regexp=bind-address = 127001 line=bind-address = 0000 backup=yes

- name restart mysql service name=mysql state=restarted

Permissions management in shared folders

configvmsynced_folder varwww id vagrant-root owner vagrant group vagrant mount_options [dmode=777fmode=777]

Use host ssh keys

configsshforward_agent = true

ForwardAgent yes

check ssh config file in your host machine

gruntgulp watch

httpwwwsebastien-hanfrblog20121218noac-performance-impact-on-web-applications

configvmsynced_folder varwww id ldquovagrant-rootrdquo type ldquonfsrdquo mount_options [lsquorwrsquovers=3tcpfsc actimeo=1]

Provisioning

to phansible or not to phansible

quick and easy way to start

theyrsquore general

old platforms are not supported

a lot of a good ideas you can steal from

if which(ansible-playbook) configvmprovision ansible do |ansible| ansibleplaybook = ansibleplaybookyml ansibleinventory_path = ansibleinventoriesdev ansiblelimit = all ansibleextra_vars = private_interface 1921683399 hostname default end else configvmprovision shell path ansiblewindowssh args [default] end

can you assume everyone in your team have the same version

if which(ansible-playbook) configvmprovision ansible do |ansible| ansibleplaybook = ansibleplaybookyml ansibleinventory_path = ansibleinventoriesdev ansiblelimit = all ansibleextra_vars = private_interface 1921683399 hostname default end else configvmprovision shell path ansiblewindowssh args [default] end

the provisioning tool is a moving part wanna update be careful

create Vagrant indipendent provision

scripts

configvmprovision shell path =gt scriptsbootstrapsh args =gt varwww

configvmprovision shell path =gt ldquoscriptsprovisionsh args =gt varwww

create your own template

httpsgithubcomideatosrlvagrant-php-template

yoursquore in control of provisioning command

you can perform additional checks on host machine

Distributing VMs

provisioning does not create immutable vm by default

eg package update on LTS

live on the edge and fix provision script

use stable package repositories

httpsspeakerdeckcommitchellhvagrant-usage-patterns

Create and distribute your own VM

Golden image

vagrant package - -name myboxbox

publish it somewhere (http atlas)

cvmbox_url = ldquohttpmyboxboxrdquo

- Donrsquot make assumptions about the host

- Provision first then bake your own image

- The more moving part the harder will get

Keep it simple

Thank you

_orso_

micheleorselli ideatosrl

moideatoit

Portable configuration tips

Donrsquot use local names for your boxes

configvmbox = base

cvmbox = hashicorpprecise64

cvmbox_url = httpyour_box

Avoid absolute paths

cvmsynced_folder ldquomyProjvarwwwmyProj

configvmsynced_folder varwwwmyProj

Move host specific configuration outside

Vagrantfile

ram 2048 cpus 2 ipaddress 10101010

vagrantfile-local-configyml

require lsquoyaml

_config = YAMLload(Fileopen(Filejoin(Filedirname(__FILE__) ldquovagrantfile-local-configymlrdquo) FileRDONLY)read) CONF = _config

configvmprovider virtualbox do |vb| vbcustomize[modifyvmidldquo--memory CONF[ram]] vbcustomize [modifyvmid--cpus CONF[ldquocpus]] hellip end

As rule of thumb you could assign the half cpus and a quarter of the memory based on your host machine

httpsstefanwrobelcomhow-to-make-vagrant-performance-not-suck

Force a specific provider

ENV[VAGRANT_DEFAULT_PROVIDER] = virtualbox

Support multiple providers

configvmprovider virtualbox do |vb| vbcustomize [modifyvmid --memory CONF[ram]] vbcustomize [modifyvmid --cpus CONF[cpus]] end configvmprovider vmware_fusion do |v| vvmx[memsize] = CONF[ram] vvmx[numvcpus] = CONF[cpus] end

Projectrsquos directories organization

myproject -- hellip -- vagrant -- Vagrantfile

single git repository

cvmsynced_folder ldquordquordquovarwwwmyproject

myproject -- project --hellip -- vagrant -- Vagrantfile

single git repository

cvmsynced_folder ldquoprojectrdquordquovarwwwprojectrdquo

myproject -- vagrant -- www -- project1 -- project2 -- Vagrantfile

singlemultiple git repositories

cvmsynced_folder ldquowwwrdquordquovarwwwrdquo

vagrant plugin install HostsUpdater

(or HostManager)

etchosts

10101040 host1lo VAGRANT e2bca7c8bf6d76cbcf6ee48998c16f

if Vagranthas_plugin(HostsUpdater) confighostsupdateraliases = [host1lo] else puts --- WARNING --- puts ldquoYou should install HostsUpdaterrdquo end

Multi-VM Configuration

configvmdefine web do |web| webvmnetwork private_network ip 10002 webvmprovider virtualbox do |v| vcustomize [modifyvm id --memory 2048] end webvmsynced_folder ldquovarwww end configvmdefine db do |db| dbvmnetwork private_network ip 10003 dbvmprovision shell path =gt vagrantdbsh end

Dealing with shared folders

no share

native share- slow - os indipendent-ish

nfs- fast - win support -(

rsync- no real share - update

VM Performance

run testshellip

still runninghellip

mitchellhcomcomparing-filesystem-performance-in-virtual-machines

Virtualbox vs VmWare

Virtualbox 22 min

VmWare 15 min

Virtualbox 22 min

VmWare 15 min+30

use VmWare if you can(it will cost you a few $)

use nfs if you can

vagrant plugin install vbguest

keeps guest addition updated

unless Vagranthas_plugin(ldquovagrant-vbguest) raise rdquoplease install vagrant-vbguestrdquo end

On VM IO is the bottleneck

loading webpages running testsuites are READ heavy

move IO outside shared folders

Default provider virtualbox

3 PHP test suites with unit functional integration mix

small (sf1) build runs in ~25 sec

medium (zf2) build runs in ~2 mins

large (sf2) build runs ~ 20 mins

IO logs cache

class AppKernel extends Kernel public function getCacheDir() if (in_array($this-gtenvironment array(dev test))) return devshmappnamecache $this-gtenvironment

return parentgetCacheDir()

public function getLogDir() if (in_array($this-gtenvironment array(dev lsquotest))) return devshmappnamelogs

return parentgetLogDir()

class AppKernel extends Kernel public function getCacheDir() if (in_array($this-gtenvironment array(dev test))) return devshmappnamecache $this-gtenvironment

return parentgetCacheDir()

public function getLogDir() if (in_array($this-gtenvironment array(dev lsquotest))) return devshmappnamelogs

return parentgetLogDir()

+13-16

IO move DB on RAMif you use sqlite move it on devshm

vagrant plugin install vagrantcachier

if Vagranthas_plugin(vagrant-cachier) configcachescope = box

configcachesynced_folder_opts = type nfs mount_options [rwvers=3tcpnolock] end

Vagrantfile

if Vagranthas_plugin(vagrant-cachier) configcachescope = box

configcachesynced_folder_opts = type nfs mount_options [rwvers=3tcpnolock] end

Vagrantfile

+30for reprovisioning a box with git php apache mysql

use cachefilesd for nfs

- name Install cachefilesd apt pkg=cachefilesd state=present

- name Enable cachefilesd lineinfile dest=etcdefaultcachefilesd line=ldquoRUN=yesrdquo

- name Start cachefilesd service service name=cachefilesd state=restarted

configvmsynced_folder varwww id ldquovagrant-rootrdquo type ldquonfsrdquo mount_options [rwvers=3tcpfsc]

Vagrantfile

configvmsynced_folder varwww id ldquovagrant-rootrdquo type ldquonfsrdquo mount_options [rwvers=3tcpfsc]

Vagrantfile

-15+10

should you trust these numbers

Application Management

How to access mysql

- name add mysql user mysql_user name=ideato host= password=ideato priv=ALLGRANT login_user=root login_password=

- name config bind address to allow remote remote connections lineinfile dest=etcmysqlmycnf state=present regexp=bind-address = 127001 line=bind-address = 0000 backup=yes

- name restart mysql service name=mysql state=restarted

Permissions management in shared folders

configvmsynced_folder varwww id vagrant-root owner vagrant group vagrant mount_options [dmode=777fmode=777]

Use host ssh keys

configsshforward_agent = true

ForwardAgent yes

check ssh config file in your host machine

gruntgulp watch

httpwwwsebastien-hanfrblog20121218noac-performance-impact-on-web-applications

configvmsynced_folder varwww id ldquovagrant-rootrdquo type ldquonfsrdquo mount_options [lsquorwrsquovers=3tcpfsc actimeo=1]

Provisioning

to phansible or not to phansible

quick and easy way to start

theyrsquore general

old platforms are not supported

a lot of a good ideas you can steal from

if which(ansible-playbook) configvmprovision ansible do |ansible| ansibleplaybook = ansibleplaybookyml ansibleinventory_path = ansibleinventoriesdev ansiblelimit = all ansibleextra_vars = private_interface 1921683399 hostname default end else configvmprovision shell path ansiblewindowssh args [default] end

can you assume everyone in your team have the same version

if which(ansible-playbook) configvmprovision ansible do |ansible| ansibleplaybook = ansibleplaybookyml ansibleinventory_path = ansibleinventoriesdev ansiblelimit = all ansibleextra_vars = private_interface 1921683399 hostname default end else configvmprovision shell path ansiblewindowssh args [default] end

the provisioning tool is a moving part wanna update be careful

create Vagrant indipendent provision

scripts

configvmprovision shell path =gt scriptsbootstrapsh args =gt varwww

configvmprovision shell path =gt ldquoscriptsprovisionsh args =gt varwww

create your own template

httpsgithubcomideatosrlvagrant-php-template

yoursquore in control of provisioning command

you can perform additional checks on host machine

Distributing VMs

provisioning does not create immutable vm by default

eg package update on LTS

live on the edge and fix provision script

use stable package repositories

httpsspeakerdeckcommitchellhvagrant-usage-patterns

Create and distribute your own VM

Golden image

vagrant package - -name myboxbox

publish it somewhere (http atlas)

cvmbox_url = ldquohttpmyboxboxrdquo

- Donrsquot make assumptions about the host

- Provision first then bake your own image

- The more moving part the harder will get

Keep it simple

Thank you

_orso_

micheleorselli ideatosrl

moideatoit

Donrsquot use local names for your boxes

configvmbox = base

cvmbox = hashicorpprecise64

cvmbox_url = httpyour_box

Avoid absolute paths

cvmsynced_folder ldquomyProjvarwwwmyProj

configvmsynced_folder varwwwmyProj

Move host specific configuration outside

Vagrantfile

ram 2048 cpus 2 ipaddress 10101010

vagrantfile-local-configyml

require lsquoyaml

_config = YAMLload(Fileopen(Filejoin(Filedirname(__FILE__) ldquovagrantfile-local-configymlrdquo) FileRDONLY)read) CONF = _config

configvmprovider virtualbox do |vb| vbcustomize[modifyvmidldquo--memory CONF[ram]] vbcustomize [modifyvmid--cpus CONF[ldquocpus]] hellip end

As rule of thumb you could assign the half cpus and a quarter of the memory based on your host machine

httpsstefanwrobelcomhow-to-make-vagrant-performance-not-suck

Force a specific provider

ENV[VAGRANT_DEFAULT_PROVIDER] = virtualbox

Support multiple providers

configvmprovider virtualbox do |vb| vbcustomize [modifyvmid --memory CONF[ram]] vbcustomize [modifyvmid --cpus CONF[cpus]] end configvmprovider vmware_fusion do |v| vvmx[memsize] = CONF[ram] vvmx[numvcpus] = CONF[cpus] end

Projectrsquos directories organization

myproject -- hellip -- vagrant -- Vagrantfile

single git repository

cvmsynced_folder ldquordquordquovarwwwmyproject

myproject -- project --hellip -- vagrant -- Vagrantfile

single git repository

cvmsynced_folder ldquoprojectrdquordquovarwwwprojectrdquo

myproject -- vagrant -- www -- project1 -- project2 -- Vagrantfile

singlemultiple git repositories

cvmsynced_folder ldquowwwrdquordquovarwwwrdquo

vagrant plugin install HostsUpdater

(or HostManager)

etchosts

10101040 host1lo VAGRANT e2bca7c8bf6d76cbcf6ee48998c16f

if Vagranthas_plugin(HostsUpdater) confighostsupdateraliases = [host1lo] else puts --- WARNING --- puts ldquoYou should install HostsUpdaterrdquo end

Multi-VM Configuration

configvmdefine web do |web| webvmnetwork private_network ip 10002 webvmprovider virtualbox do |v| vcustomize [modifyvm id --memory 2048] end webvmsynced_folder ldquovarwww end configvmdefine db do |db| dbvmnetwork private_network ip 10003 dbvmprovision shell path =gt vagrantdbsh end

Dealing with shared folders

no share

native share- slow - os indipendent-ish

nfs- fast - win support -(

rsync- no real share - update

VM Performance

run testshellip

still runninghellip

mitchellhcomcomparing-filesystem-performance-in-virtual-machines

Virtualbox vs VmWare

Virtualbox 22 min

VmWare 15 min

Virtualbox 22 min

VmWare 15 min+30

use VmWare if you can(it will cost you a few $)

use nfs if you can

vagrant plugin install vbguest

keeps guest addition updated

unless Vagranthas_plugin(ldquovagrant-vbguest) raise rdquoplease install vagrant-vbguestrdquo end

On VM IO is the bottleneck

loading webpages running testsuites are READ heavy

move IO outside shared folders

Default provider virtualbox

3 PHP test suites with unit functional integration mix

small (sf1) build runs in ~25 sec

medium (zf2) build runs in ~2 mins

large (sf2) build runs ~ 20 mins

IO logs cache

class AppKernel extends Kernel public function getCacheDir() if (in_array($this-gtenvironment array(dev test))) return devshmappnamecache $this-gtenvironment

return parentgetCacheDir()

public function getLogDir() if (in_array($this-gtenvironment array(dev lsquotest))) return devshmappnamelogs

return parentgetLogDir()

class AppKernel extends Kernel public function getCacheDir() if (in_array($this-gtenvironment array(dev test))) return devshmappnamecache $this-gtenvironment

return parentgetCacheDir()

public function getLogDir() if (in_array($this-gtenvironment array(dev lsquotest))) return devshmappnamelogs

return parentgetLogDir()

+13-16

IO move DB on RAMif you use sqlite move it on devshm

vagrant plugin install vagrantcachier

if Vagranthas_plugin(vagrant-cachier) configcachescope = box

configcachesynced_folder_opts = type nfs mount_options [rwvers=3tcpnolock] end

Vagrantfile

if Vagranthas_plugin(vagrant-cachier) configcachescope = box

configcachesynced_folder_opts = type nfs mount_options [rwvers=3tcpnolock] end

Vagrantfile

+30for reprovisioning a box with git php apache mysql

use cachefilesd for nfs

- name Install cachefilesd apt pkg=cachefilesd state=present

- name Enable cachefilesd lineinfile dest=etcdefaultcachefilesd line=ldquoRUN=yesrdquo

- name Start cachefilesd service service name=cachefilesd state=restarted

configvmsynced_folder varwww id ldquovagrant-rootrdquo type ldquonfsrdquo mount_options [rwvers=3tcpfsc]

Vagrantfile

configvmsynced_folder varwww id ldquovagrant-rootrdquo type ldquonfsrdquo mount_options [rwvers=3tcpfsc]

Vagrantfile

-15+10

should you trust these numbers

Application Management

How to access mysql

- name add mysql user mysql_user name=ideato host= password=ideato priv=ALLGRANT login_user=root login_password=

- name config bind address to allow remote remote connections lineinfile dest=etcmysqlmycnf state=present regexp=bind-address = 127001 line=bind-address = 0000 backup=yes

- name restart mysql service name=mysql state=restarted

Permissions management in shared folders

configvmsynced_folder varwww id vagrant-root owner vagrant group vagrant mount_options [dmode=777fmode=777]

Use host ssh keys

configsshforward_agent = true

ForwardAgent yes

check ssh config file in your host machine

gruntgulp watch

httpwwwsebastien-hanfrblog20121218noac-performance-impact-on-web-applications

configvmsynced_folder varwww id ldquovagrant-rootrdquo type ldquonfsrdquo mount_options [lsquorwrsquovers=3tcpfsc actimeo=1]

Provisioning

to phansible or not to phansible

quick and easy way to start

theyrsquore general

old platforms are not supported

a lot of a good ideas you can steal from

if which(ansible-playbook) configvmprovision ansible do |ansible| ansibleplaybook = ansibleplaybookyml ansibleinventory_path = ansibleinventoriesdev ansiblelimit = all ansibleextra_vars = private_interface 1921683399 hostname default end else configvmprovision shell path ansiblewindowssh args [default] end

can you assume everyone in your team have the same version

if which(ansible-playbook) configvmprovision ansible do |ansible| ansibleplaybook = ansibleplaybookyml ansibleinventory_path = ansibleinventoriesdev ansiblelimit = all ansibleextra_vars = private_interface 1921683399 hostname default end else configvmprovision shell path ansiblewindowssh args [default] end

the provisioning tool is a moving part wanna update be careful

create Vagrant indipendent provision

scripts

configvmprovision shell path =gt scriptsbootstrapsh args =gt varwww

configvmprovision shell path =gt ldquoscriptsprovisionsh args =gt varwww

create your own template

httpsgithubcomideatosrlvagrant-php-template

yoursquore in control of provisioning command

you can perform additional checks on host machine

Distributing VMs

provisioning does not create immutable vm by default

eg package update on LTS

live on the edge and fix provision script

use stable package repositories

httpsspeakerdeckcommitchellhvagrant-usage-patterns

Create and distribute your own VM

Golden image

vagrant package - -name myboxbox

publish it somewhere (http atlas)

cvmbox_url = ldquohttpmyboxboxrdquo

- Donrsquot make assumptions about the host

- Provision first then bake your own image

- The more moving part the harder will get

Keep it simple

Thank you

_orso_

micheleorselli ideatosrl

moideatoit

cvmbox = hashicorpprecise64

cvmbox_url = httpyour_box

Avoid absolute paths

cvmsynced_folder ldquomyProjvarwwwmyProj

configvmsynced_folder varwwwmyProj

Move host specific configuration outside

Vagrantfile

ram 2048 cpus 2 ipaddress 10101010

vagrantfile-local-configyml

require lsquoyaml

_config = YAMLload(Fileopen(Filejoin(Filedirname(__FILE__) ldquovagrantfile-local-configymlrdquo) FileRDONLY)read) CONF = _config

configvmprovider virtualbox do |vb| vbcustomize[modifyvmidldquo--memory CONF[ram]] vbcustomize [modifyvmid--cpus CONF[ldquocpus]] hellip end

As rule of thumb you could assign the half cpus and a quarter of the memory based on your host machine

httpsstefanwrobelcomhow-to-make-vagrant-performance-not-suck

Force a specific provider

ENV[VAGRANT_DEFAULT_PROVIDER] = virtualbox

Support multiple providers

configvmprovider virtualbox do |vb| vbcustomize [modifyvmid --memory CONF[ram]] vbcustomize [modifyvmid --cpus CONF[cpus]] end configvmprovider vmware_fusion do |v| vvmx[memsize] = CONF[ram] vvmx[numvcpus] = CONF[cpus] end

Projectrsquos directories organization

myproject -- hellip -- vagrant -- Vagrantfile

single git repository

cvmsynced_folder ldquordquordquovarwwwmyproject

myproject -- project --hellip -- vagrant -- Vagrantfile

single git repository

cvmsynced_folder ldquoprojectrdquordquovarwwwprojectrdquo

myproject -- vagrant -- www -- project1 -- project2 -- Vagrantfile

singlemultiple git repositories

cvmsynced_folder ldquowwwrdquordquovarwwwrdquo

vagrant plugin install HostsUpdater

(or HostManager)

etchosts

10101040 host1lo VAGRANT e2bca7c8bf6d76cbcf6ee48998c16f

if Vagranthas_plugin(HostsUpdater) confighostsupdateraliases = [host1lo] else puts --- WARNING --- puts ldquoYou should install HostsUpdaterrdquo end

Multi-VM Configuration

configvmdefine web do |web| webvmnetwork private_network ip 10002 webvmprovider virtualbox do |v| vcustomize [modifyvm id --memory 2048] end webvmsynced_folder ldquovarwww end configvmdefine db do |db| dbvmnetwork private_network ip 10003 dbvmprovision shell path =gt vagrantdbsh end

Dealing with shared folders

no share

native share- slow - os indipendent-ish

nfs- fast - win support -(

rsync- no real share - update

VM Performance

run testshellip

still runninghellip

mitchellhcomcomparing-filesystem-performance-in-virtual-machines

Virtualbox vs VmWare

Virtualbox 22 min

VmWare 15 min

Virtualbox 22 min

VmWare 15 min+30

use VmWare if you can(it will cost you a few $)

use nfs if you can

vagrant plugin install vbguest

keeps guest addition updated

unless Vagranthas_plugin(ldquovagrant-vbguest) raise rdquoplease install vagrant-vbguestrdquo end

On VM IO is the bottleneck

loading webpages running testsuites are READ heavy

move IO outside shared folders

Default provider virtualbox

3 PHP test suites with unit functional integration mix

small (sf1) build runs in ~25 sec

medium (zf2) build runs in ~2 mins

large (sf2) build runs ~ 20 mins

IO logs cache

class AppKernel extends Kernel public function getCacheDir() if (in_array($this-gtenvironment array(dev test))) return devshmappnamecache $this-gtenvironment

return parentgetCacheDir()

public function getLogDir() if (in_array($this-gtenvironment array(dev lsquotest))) return devshmappnamelogs

return parentgetLogDir()

class AppKernel extends Kernel public function getCacheDir() if (in_array($this-gtenvironment array(dev test))) return devshmappnamecache $this-gtenvironment

return parentgetCacheDir()

public function getLogDir() if (in_array($this-gtenvironment array(dev lsquotest))) return devshmappnamelogs

return parentgetLogDir()

+13-16

IO move DB on RAMif you use sqlite move it on devshm

vagrant plugin install vagrantcachier

if Vagranthas_plugin(vagrant-cachier) configcachescope = box

configcachesynced_folder_opts = type nfs mount_options [rwvers=3tcpnolock] end

Vagrantfile

if Vagranthas_plugin(vagrant-cachier) configcachescope = box

configcachesynced_folder_opts = type nfs mount_options [rwvers=3tcpnolock] end

Vagrantfile

+30for reprovisioning a box with git php apache mysql

use cachefilesd for nfs

- name Install cachefilesd apt pkg=cachefilesd state=present

- name Enable cachefilesd lineinfile dest=etcdefaultcachefilesd line=ldquoRUN=yesrdquo

- name Start cachefilesd service service name=cachefilesd state=restarted

configvmsynced_folder varwww id ldquovagrant-rootrdquo type ldquonfsrdquo mount_options [rwvers=3tcpfsc]

Vagrantfile

configvmsynced_folder varwww id ldquovagrant-rootrdquo type ldquonfsrdquo mount_options [rwvers=3tcpfsc]

Vagrantfile

-15+10

should you trust these numbers

Application Management

How to access mysql

- name add mysql user mysql_user name=ideato host= password=ideato priv=ALLGRANT login_user=root login_password=

- name config bind address to allow remote remote connections lineinfile dest=etcmysqlmycnf state=present regexp=bind-address = 127001 line=bind-address = 0000 backup=yes

- name restart mysql service name=mysql state=restarted

Permissions management in shared folders

configvmsynced_folder varwww id vagrant-root owner vagrant group vagrant mount_options [dmode=777fmode=777]

Use host ssh keys

configsshforward_agent = true

ForwardAgent yes

check ssh config file in your host machine

gruntgulp watch

httpwwwsebastien-hanfrblog20121218noac-performance-impact-on-web-applications

configvmsynced_folder varwww id ldquovagrant-rootrdquo type ldquonfsrdquo mount_options [lsquorwrsquovers=3tcpfsc actimeo=1]

Provisioning

to phansible or not to phansible

quick and easy way to start

theyrsquore general

old platforms are not supported

a lot of a good ideas you can steal from

if which(ansible-playbook) configvmprovision ansible do |ansible| ansibleplaybook = ansibleplaybookyml ansibleinventory_path = ansibleinventoriesdev ansiblelimit = all ansibleextra_vars = private_interface 1921683399 hostname default end else configvmprovision shell path ansiblewindowssh args [default] end

can you assume everyone in your team have the same version

if which(ansible-playbook) configvmprovision ansible do |ansible| ansibleplaybook = ansibleplaybookyml ansibleinventory_path = ansibleinventoriesdev ansiblelimit = all ansibleextra_vars = private_interface 1921683399 hostname default end else configvmprovision shell path ansiblewindowssh args [default] end

the provisioning tool is a moving part wanna update be careful

create Vagrant indipendent provision

scripts

configvmprovision shell path =gt scriptsbootstrapsh args =gt varwww

configvmprovision shell path =gt ldquoscriptsprovisionsh args =gt varwww

create your own template

httpsgithubcomideatosrlvagrant-php-template

yoursquore in control of provisioning command

you can perform additional checks on host machine

Distributing VMs

provisioning does not create immutable vm by default

eg package update on LTS

live on the edge and fix provision script

use stable package repositories

httpsspeakerdeckcommitchellhvagrant-usage-patterns

Create and distribute your own VM

Golden image

vagrant package - -name myboxbox

publish it somewhere (http atlas)

cvmbox_url = ldquohttpmyboxboxrdquo

- Donrsquot make assumptions about the host

- Provision first then bake your own image

- The more moving part the harder will get

Keep it simple

Thank you

_orso_

micheleorselli ideatosrl

moideatoit

cvmbox_url = httpyour_box

Avoid absolute paths

cvmsynced_folder ldquomyProjvarwwwmyProj

configvmsynced_folder varwwwmyProj

Move host specific configuration outside

Vagrantfile

ram 2048 cpus 2 ipaddress 10101010

vagrantfile-local-configyml

require lsquoyaml

_config = YAMLload(Fileopen(Filejoin(Filedirname(__FILE__) ldquovagrantfile-local-configymlrdquo) FileRDONLY)read) CONF = _config

configvmprovider virtualbox do |vb| vbcustomize[modifyvmidldquo--memory CONF[ram]] vbcustomize [modifyvmid--cpus CONF[ldquocpus]] hellip end

As rule of thumb you could assign the half cpus and a quarter of the memory based on your host machine

httpsstefanwrobelcomhow-to-make-vagrant-performance-not-suck

Force a specific provider

ENV[VAGRANT_DEFAULT_PROVIDER] = virtualbox

Support multiple providers

configvmprovider virtualbox do |vb| vbcustomize [modifyvmid --memory CONF[ram]] vbcustomize [modifyvmid --cpus CONF[cpus]] end configvmprovider vmware_fusion do |v| vvmx[memsize] = CONF[ram] vvmx[numvcpus] = CONF[cpus] end

Projectrsquos directories organization

myproject -- hellip -- vagrant -- Vagrantfile

single git repository

cvmsynced_folder ldquordquordquovarwwwmyproject

myproject -- project --hellip -- vagrant -- Vagrantfile

single git repository

cvmsynced_folder ldquoprojectrdquordquovarwwwprojectrdquo

myproject -- vagrant -- www -- project1 -- project2 -- Vagrantfile

singlemultiple git repositories

cvmsynced_folder ldquowwwrdquordquovarwwwrdquo

vagrant plugin install HostsUpdater

(or HostManager)

etchosts

10101040 host1lo VAGRANT e2bca7c8bf6d76cbcf6ee48998c16f

if Vagranthas_plugin(HostsUpdater) confighostsupdateraliases = [host1lo] else puts --- WARNING --- puts ldquoYou should install HostsUpdaterrdquo end

Multi-VM Configuration

configvmdefine web do |web| webvmnetwork private_network ip 10002 webvmprovider virtualbox do |v| vcustomize [modifyvm id --memory 2048] end webvmsynced_folder ldquovarwww end configvmdefine db do |db| dbvmnetwork private_network ip 10003 dbvmprovision shell path =gt vagrantdbsh end

Dealing with shared folders

no share

native share- slow - os indipendent-ish

nfs- fast - win support -(

rsync- no real share - update

VM Performance

run testshellip

still runninghellip

mitchellhcomcomparing-filesystem-performance-in-virtual-machines

Virtualbox vs VmWare

Virtualbox 22 min

VmWare 15 min

Virtualbox 22 min

VmWare 15 min+30

use VmWare if you can(it will cost you a few $)

use nfs if you can

vagrant plugin install vbguest

keeps guest addition updated

unless Vagranthas_plugin(ldquovagrant-vbguest) raise rdquoplease install vagrant-vbguestrdquo end

On VM IO is the bottleneck

loading webpages running testsuites are READ heavy

move IO outside shared folders

Default provider virtualbox

3 PHP test suites with unit functional integration mix

small (sf1) build runs in ~25 sec

medium (zf2) build runs in ~2 mins

large (sf2) build runs ~ 20 mins

IO logs cache

class AppKernel extends Kernel public function getCacheDir() if (in_array($this-gtenvironment array(dev test))) return devshmappnamecache $this-gtenvironment

return parentgetCacheDir()

public function getLogDir() if (in_array($this-gtenvironment array(dev lsquotest))) return devshmappnamelogs

return parentgetLogDir()

class AppKernel extends Kernel public function getCacheDir() if (in_array($this-gtenvironment array(dev test))) return devshmappnamecache $this-gtenvironment

return parentgetCacheDir()

public function getLogDir() if (in_array($this-gtenvironment array(dev lsquotest))) return devshmappnamelogs

return parentgetLogDir()

+13-16

IO move DB on RAMif you use sqlite move it on devshm

vagrant plugin install vagrantcachier

if Vagranthas_plugin(vagrant-cachier) configcachescope = box

configcachesynced_folder_opts = type nfs mount_options [rwvers=3tcpnolock] end

Vagrantfile

if Vagranthas_plugin(vagrant-cachier) configcachescope = box

configcachesynced_folder_opts = type nfs mount_options [rwvers=3tcpnolock] end

Vagrantfile

+30for reprovisioning a box with git php apache mysql

use cachefilesd for nfs

- name Install cachefilesd apt pkg=cachefilesd state=present

- name Enable cachefilesd lineinfile dest=etcdefaultcachefilesd line=ldquoRUN=yesrdquo

- name Start cachefilesd service service name=cachefilesd state=restarted

configvmsynced_folder varwww id ldquovagrant-rootrdquo type ldquonfsrdquo mount_options [rwvers=3tcpfsc]

Vagrantfile

configvmsynced_folder varwww id ldquovagrant-rootrdquo type ldquonfsrdquo mount_options [rwvers=3tcpfsc]

Vagrantfile

-15+10

should you trust these numbers

Application Management

How to access mysql

- name add mysql user mysql_user name=ideato host= password=ideato priv=ALLGRANT login_user=root login_password=

- name config bind address to allow remote remote connections lineinfile dest=etcmysqlmycnf state=present regexp=bind-address = 127001 line=bind-address = 0000 backup=yes

- name restart mysql service name=mysql state=restarted

Permissions management in shared folders

configvmsynced_folder varwww id vagrant-root owner vagrant group vagrant mount_options [dmode=777fmode=777]

Use host ssh keys

configsshforward_agent = true

ForwardAgent yes

check ssh config file in your host machine

gruntgulp watch

httpwwwsebastien-hanfrblog20121218noac-performance-impact-on-web-applications

configvmsynced_folder varwww id ldquovagrant-rootrdquo type ldquonfsrdquo mount_options [lsquorwrsquovers=3tcpfsc actimeo=1]

Provisioning

to phansible or not to phansible

quick and easy way to start

theyrsquore general

old platforms are not supported

a lot of a good ideas you can steal from

if which(ansible-playbook) configvmprovision ansible do |ansible| ansibleplaybook = ansibleplaybookyml ansibleinventory_path = ansibleinventoriesdev ansiblelimit = all ansibleextra_vars = private_interface 1921683399 hostname default end else configvmprovision shell path ansiblewindowssh args [default] end

can you assume everyone in your team have the same version

if which(ansible-playbook) configvmprovision ansible do |ansible| ansibleplaybook = ansibleplaybookyml ansibleinventory_path = ansibleinventoriesdev ansiblelimit = all ansibleextra_vars = private_interface 1921683399 hostname default end else configvmprovision shell path ansiblewindowssh args [default] end

the provisioning tool is a moving part wanna update be careful

create Vagrant indipendent provision

scripts

configvmprovision shell path =gt scriptsbootstrapsh args =gt varwww

configvmprovision shell path =gt ldquoscriptsprovisionsh args =gt varwww

create your own template

httpsgithubcomideatosrlvagrant-php-template

yoursquore in control of provisioning command

you can perform additional checks on host machine

Distributing VMs

provisioning does not create immutable vm by default

eg package update on LTS

live on the edge and fix provision script

use stable package repositories

httpsspeakerdeckcommitchellhvagrant-usage-patterns

Create and distribute your own VM

Golden image

vagrant package - -name myboxbox

publish it somewhere (http atlas)

cvmbox_url = ldquohttpmyboxboxrdquo

- Donrsquot make assumptions about the host

- Provision first then bake your own image

- The more moving part the harder will get

Keep it simple

Thank you

_orso_

micheleorselli ideatosrl

moideatoit

Avoid absolute paths

cvmsynced_folder ldquomyProjvarwwwmyProj

configvmsynced_folder varwwwmyProj

Move host specific configuration outside

Vagrantfile

ram 2048 cpus 2 ipaddress 10101010

vagrantfile-local-configyml

require lsquoyaml

_config = YAMLload(Fileopen(Filejoin(Filedirname(__FILE__) ldquovagrantfile-local-configymlrdquo) FileRDONLY)read) CONF = _config

configvmprovider virtualbox do |vb| vbcustomize[modifyvmidldquo--memory CONF[ram]] vbcustomize [modifyvmid--cpus CONF[ldquocpus]] hellip end

As rule of thumb you could assign the half cpus and a quarter of the memory based on your host machine

httpsstefanwrobelcomhow-to-make-vagrant-performance-not-suck

Force a specific provider

ENV[VAGRANT_DEFAULT_PROVIDER] = virtualbox

Support multiple providers

configvmprovider virtualbox do |vb| vbcustomize [modifyvmid --memory CONF[ram]] vbcustomize [modifyvmid --cpus CONF[cpus]] end configvmprovider vmware_fusion do |v| vvmx[memsize] = CONF[ram] vvmx[numvcpus] = CONF[cpus] end

Projectrsquos directories organization

myproject -- hellip -- vagrant -- Vagrantfile

single git repository

cvmsynced_folder ldquordquordquovarwwwmyproject

myproject -- project --hellip -- vagrant -- Vagrantfile

single git repository

cvmsynced_folder ldquoprojectrdquordquovarwwwprojectrdquo

myproject -- vagrant -- www -- project1 -- project2 -- Vagrantfile

singlemultiple git repositories

cvmsynced_folder ldquowwwrdquordquovarwwwrdquo

vagrant plugin install HostsUpdater

(or HostManager)

etchosts

10101040 host1lo VAGRANT e2bca7c8bf6d76cbcf6ee48998c16f

if Vagranthas_plugin(HostsUpdater) confighostsupdateraliases = [host1lo] else puts --- WARNING --- puts ldquoYou should install HostsUpdaterrdquo end

Multi-VM Configuration

configvmdefine web do |web| webvmnetwork private_network ip 10002 webvmprovider virtualbox do |v| vcustomize [modifyvm id --memory 2048] end webvmsynced_folder ldquovarwww end configvmdefine db do |db| dbvmnetwork private_network ip 10003 dbvmprovision shell path =gt vagrantdbsh end

Dealing with shared folders

no share

native share- slow - os indipendent-ish

nfs- fast - win support -(

rsync- no real share - update

VM Performance

run testshellip

still runninghellip

mitchellhcomcomparing-filesystem-performance-in-virtual-machines

Virtualbox vs VmWare

Virtualbox 22 min

VmWare 15 min

Virtualbox 22 min

VmWare 15 min+30

use VmWare if you can(it will cost you a few $)

use nfs if you can

vagrant plugin install vbguest

keeps guest addition updated

unless Vagranthas_plugin(ldquovagrant-vbguest) raise rdquoplease install vagrant-vbguestrdquo end

On VM IO is the bottleneck

loading webpages running testsuites are READ heavy

move IO outside shared folders

Default provider virtualbox

3 PHP test suites with unit functional integration mix

small (sf1) build runs in ~25 sec

medium (zf2) build runs in ~2 mins

large (sf2) build runs ~ 20 mins

IO logs cache

class AppKernel extends Kernel public function getCacheDir() if (in_array($this-gtenvironment array(dev test))) return devshmappnamecache $this-gtenvironment

return parentgetCacheDir()

public function getLogDir() if (in_array($this-gtenvironment array(dev lsquotest))) return devshmappnamelogs

return parentgetLogDir()

class AppKernel extends Kernel public function getCacheDir() if (in_array($this-gtenvironment array(dev test))) return devshmappnamecache $this-gtenvironment

return parentgetCacheDir()

public function getLogDir() if (in_array($this-gtenvironment array(dev lsquotest))) return devshmappnamelogs

return parentgetLogDir()

+13-16

IO move DB on RAMif you use sqlite move it on devshm

vagrant plugin install vagrantcachier

if Vagranthas_plugin(vagrant-cachier) configcachescope = box

configcachesynced_folder_opts = type nfs mount_options [rwvers=3tcpnolock] end

Vagrantfile

if Vagranthas_plugin(vagrant-cachier) configcachescope = box

configcachesynced_folder_opts = type nfs mount_options [rwvers=3tcpnolock] end

Vagrantfile

+30for reprovisioning a box with git php apache mysql

use cachefilesd for nfs

- name Install cachefilesd apt pkg=cachefilesd state=present

- name Enable cachefilesd lineinfile dest=etcdefaultcachefilesd line=ldquoRUN=yesrdquo

- name Start cachefilesd service service name=cachefilesd state=restarted

configvmsynced_folder varwww id ldquovagrant-rootrdquo type ldquonfsrdquo mount_options [rwvers=3tcpfsc]

Vagrantfile

configvmsynced_folder varwww id ldquovagrant-rootrdquo type ldquonfsrdquo mount_options [rwvers=3tcpfsc]

Vagrantfile

-15+10

should you trust these numbers

Application Management

How to access mysql

- name add mysql user mysql_user name=ideato host= password=ideato priv=ALLGRANT login_user=root login_password=

- name config bind address to allow remote remote connections lineinfile dest=etcmysqlmycnf state=present regexp=bind-address = 127001 line=bind-address = 0000 backup=yes

- name restart mysql service name=mysql state=restarted

Permissions management in shared folders

configvmsynced_folder varwww id vagrant-root owner vagrant group vagrant mount_options [dmode=777fmode=777]

Use host ssh keys

configsshforward_agent = true

ForwardAgent yes

check ssh config file in your host machine

gruntgulp watch

httpwwwsebastien-hanfrblog20121218noac-performance-impact-on-web-applications

configvmsynced_folder varwww id ldquovagrant-rootrdquo type ldquonfsrdquo mount_options [lsquorwrsquovers=3tcpfsc actimeo=1]

Provisioning

to phansible or not to phansible

quick and easy way to start

theyrsquore general

old platforms are not supported

a lot of a good ideas you can steal from

if which(ansible-playbook) configvmprovision ansible do |ansible| ansibleplaybook = ansibleplaybookyml ansibleinventory_path = ansibleinventoriesdev ansiblelimit = all ansibleextra_vars = private_interface 1921683399 hostname default end else configvmprovision shell path ansiblewindowssh args [default] end

can you assume everyone in your team have the same version

if which(ansible-playbook) configvmprovision ansible do |ansible| ansibleplaybook = ansibleplaybookyml ansibleinventory_path = ansibleinventoriesdev ansiblelimit = all ansibleextra_vars = private_interface 1921683399 hostname default end else configvmprovision shell path ansiblewindowssh args [default] end

the provisioning tool is a moving part wanna update be careful

create Vagrant indipendent provision

scripts

configvmprovision shell path =gt scriptsbootstrapsh args =gt varwww

configvmprovision shell path =gt ldquoscriptsprovisionsh args =gt varwww

create your own template

httpsgithubcomideatosrlvagrant-php-template

yoursquore in control of provisioning command

you can perform additional checks on host machine

Distributing VMs

provisioning does not create immutable vm by default

eg package update on LTS

live on the edge and fix provision script

use stable package repositories

httpsspeakerdeckcommitchellhvagrant-usage-patterns

Create and distribute your own VM

Golden image

vagrant package - -name myboxbox

publish it somewhere (http atlas)

cvmbox_url = ldquohttpmyboxboxrdquo

- Donrsquot make assumptions about the host

- Provision first then bake your own image

- The more moving part the harder will get

Keep it simple

Thank you

_orso_

micheleorselli ideatosrl

moideatoit

cvmsynced_folder ldquomyProjvarwwwmyProj

configvmsynced_folder varwwwmyProj

Move host specific configuration outside

Vagrantfile

ram 2048 cpus 2 ipaddress 10101010

vagrantfile-local-configyml

require lsquoyaml

_config = YAMLload(Fileopen(Filejoin(Filedirname(__FILE__) ldquovagrantfile-local-configymlrdquo) FileRDONLY)read) CONF = _config

configvmprovider virtualbox do |vb| vbcustomize[modifyvmidldquo--memory CONF[ram]] vbcustomize [modifyvmid--cpus CONF[ldquocpus]] hellip end

As rule of thumb you could assign the half cpus and a quarter of the memory based on your host machine

httpsstefanwrobelcomhow-to-make-vagrant-performance-not-suck

Force a specific provider

ENV[VAGRANT_DEFAULT_PROVIDER] = virtualbox

Support multiple providers

configvmprovider virtualbox do |vb| vbcustomize [modifyvmid --memory CONF[ram]] vbcustomize [modifyvmid --cpus CONF[cpus]] end configvmprovider vmware_fusion do |v| vvmx[memsize] = CONF[ram] vvmx[numvcpus] = CONF[cpus] end

Projectrsquos directories organization

myproject -- hellip -- vagrant -- Vagrantfile

single git repository

cvmsynced_folder ldquordquordquovarwwwmyproject

myproject -- project --hellip -- vagrant -- Vagrantfile

single git repository

cvmsynced_folder ldquoprojectrdquordquovarwwwprojectrdquo

myproject -- vagrant -- www -- project1 -- project2 -- Vagrantfile

singlemultiple git repositories

cvmsynced_folder ldquowwwrdquordquovarwwwrdquo

vagrant plugin install HostsUpdater

(or HostManager)

etchosts

10101040 host1lo VAGRANT e2bca7c8bf6d76cbcf6ee48998c16f

if Vagranthas_plugin(HostsUpdater) confighostsupdateraliases = [host1lo] else puts --- WARNING --- puts ldquoYou should install HostsUpdaterrdquo end

Multi-VM Configuration

configvmdefine web do |web| webvmnetwork private_network ip 10002 webvmprovider virtualbox do |v| vcustomize [modifyvm id --memory 2048] end webvmsynced_folder ldquovarwww end configvmdefine db do |db| dbvmnetwork private_network ip 10003 dbvmprovision shell path =gt vagrantdbsh end

Dealing with shared folders

no share

native share- slow - os indipendent-ish

nfs- fast - win support -(

rsync- no real share - update

VM Performance

run testshellip

still runninghellip

mitchellhcomcomparing-filesystem-performance-in-virtual-machines

Virtualbox vs VmWare

Virtualbox 22 min

VmWare 15 min

Virtualbox 22 min

VmWare 15 min+30

use VmWare if you can(it will cost you a few $)

use nfs if you can

vagrant plugin install vbguest

keeps guest addition updated

unless Vagranthas_plugin(ldquovagrant-vbguest) raise rdquoplease install vagrant-vbguestrdquo end

On VM IO is the bottleneck

loading webpages running testsuites are READ heavy

move IO outside shared folders

Default provider virtualbox

3 PHP test suites with unit functional integration mix

small (sf1) build runs in ~25 sec

medium (zf2) build runs in ~2 mins

large (sf2) build runs ~ 20 mins

IO logs cache

class AppKernel extends Kernel public function getCacheDir() if (in_array($this-gtenvironment array(dev test))) return devshmappnamecache $this-gtenvironment

return parentgetCacheDir()

public function getLogDir() if (in_array($this-gtenvironment array(dev lsquotest))) return devshmappnamelogs

return parentgetLogDir()

class AppKernel extends Kernel public function getCacheDir() if (in_array($this-gtenvironment array(dev test))) return devshmappnamecache $this-gtenvironment

return parentgetCacheDir()

public function getLogDir() if (in_array($this-gtenvironment array(dev lsquotest))) return devshmappnamelogs

return parentgetLogDir()

+13-16

IO move DB on RAMif you use sqlite move it on devshm

vagrant plugin install vagrantcachier

if Vagranthas_plugin(vagrant-cachier) configcachescope = box

configcachesynced_folder_opts = type nfs mount_options [rwvers=3tcpnolock] end

Vagrantfile

if Vagranthas_plugin(vagrant-cachier) configcachescope = box

configcachesynced_folder_opts = type nfs mount_options [rwvers=3tcpnolock] end

Vagrantfile

+30for reprovisioning a box with git php apache mysql

use cachefilesd for nfs

- name Install cachefilesd apt pkg=cachefilesd state=present

- name Enable cachefilesd lineinfile dest=etcdefaultcachefilesd line=ldquoRUN=yesrdquo

- name Start cachefilesd service service name=cachefilesd state=restarted

configvmsynced_folder varwww id ldquovagrant-rootrdquo type ldquonfsrdquo mount_options [rwvers=3tcpfsc]

Vagrantfile

configvmsynced_folder varwww id ldquovagrant-rootrdquo type ldquonfsrdquo mount_options [rwvers=3tcpfsc]

Vagrantfile

-15+10

should you trust these numbers

Application Management

How to access mysql

- name add mysql user mysql_user name=ideato host= password=ideato priv=ALLGRANT login_user=root login_password=

- name config bind address to allow remote remote connections lineinfile dest=etcmysqlmycnf state=present regexp=bind-address = 127001 line=bind-address = 0000 backup=yes

- name restart mysql service name=mysql state=restarted

Permissions management in shared folders

configvmsynced_folder varwww id vagrant-root owner vagrant group vagrant mount_options [dmode=777fmode=777]

Use host ssh keys

configsshforward_agent = true

ForwardAgent yes

check ssh config file in your host machine

gruntgulp watch

httpwwwsebastien-hanfrblog20121218noac-performance-impact-on-web-applications

configvmsynced_folder varwww id ldquovagrant-rootrdquo type ldquonfsrdquo mount_options [lsquorwrsquovers=3tcpfsc actimeo=1]

Provisioning

to phansible or not to phansible

quick and easy way to start

theyrsquore general

old platforms are not supported

a lot of a good ideas you can steal from

if which(ansible-playbook) configvmprovision ansible do |ansible| ansibleplaybook = ansibleplaybookyml ansibleinventory_path = ansibleinventoriesdev ansiblelimit = all ansibleextra_vars = private_interface 1921683399 hostname default end else configvmprovision shell path ansiblewindowssh args [default] end

can you assume everyone in your team have the same version

if which(ansible-playbook) configvmprovision ansible do |ansible| ansibleplaybook = ansibleplaybookyml ansibleinventory_path = ansibleinventoriesdev ansiblelimit = all ansibleextra_vars = private_interface 1921683399 hostname default end else configvmprovision shell path ansiblewindowssh args [default] end

the provisioning tool is a moving part wanna update be careful

create Vagrant indipendent provision

scripts

configvmprovision shell path =gt scriptsbootstrapsh args =gt varwww

configvmprovision shell path =gt ldquoscriptsprovisionsh args =gt varwww

create your own template

httpsgithubcomideatosrlvagrant-php-template

yoursquore in control of provisioning command

you can perform additional checks on host machine

Distributing VMs

provisioning does not create immutable vm by default

eg package update on LTS

live on the edge and fix provision script

use stable package repositories

httpsspeakerdeckcommitchellhvagrant-usage-patterns

Create and distribute your own VM

Golden image

vagrant package - -name myboxbox

publish it somewhere (http atlas)

cvmbox_url = ldquohttpmyboxboxrdquo

- Donrsquot make assumptions about the host

- Provision first then bake your own image

- The more moving part the harder will get

Keep it simple

Thank you

_orso_

micheleorselli ideatosrl

moideatoit

configvmsynced_folder varwwwmyProj

Move host specific configuration outside

Vagrantfile

ram 2048 cpus 2 ipaddress 10101010

vagrantfile-local-configyml

require lsquoyaml

_config = YAMLload(Fileopen(Filejoin(Filedirname(__FILE__) ldquovagrantfile-local-configymlrdquo) FileRDONLY)read) CONF = _config

configvmprovider virtualbox do |vb| vbcustomize[modifyvmidldquo--memory CONF[ram]] vbcustomize [modifyvmid--cpus CONF[ldquocpus]] hellip end

As rule of thumb you could assign the half cpus and a quarter of the memory based on your host machine

httpsstefanwrobelcomhow-to-make-vagrant-performance-not-suck

Force a specific provider

ENV[VAGRANT_DEFAULT_PROVIDER] = virtualbox

Support multiple providers

configvmprovider virtualbox do |vb| vbcustomize [modifyvmid --memory CONF[ram]] vbcustomize [modifyvmid --cpus CONF[cpus]] end configvmprovider vmware_fusion do |v| vvmx[memsize] = CONF[ram] vvmx[numvcpus] = CONF[cpus] end

Projectrsquos directories organization

myproject -- hellip -- vagrant -- Vagrantfile

single git repository

cvmsynced_folder ldquordquordquovarwwwmyproject

myproject -- project --hellip -- vagrant -- Vagrantfile

single git repository

cvmsynced_folder ldquoprojectrdquordquovarwwwprojectrdquo

myproject -- vagrant -- www -- project1 -- project2 -- Vagrantfile

singlemultiple git repositories

cvmsynced_folder ldquowwwrdquordquovarwwwrdquo

vagrant plugin install HostsUpdater

(or HostManager)

etchosts

10101040 host1lo VAGRANT e2bca7c8bf6d76cbcf6ee48998c16f

if Vagranthas_plugin(HostsUpdater) confighostsupdateraliases = [host1lo] else puts --- WARNING --- puts ldquoYou should install HostsUpdaterrdquo end

Multi-VM Configuration

configvmdefine web do |web| webvmnetwork private_network ip 10002 webvmprovider virtualbox do |v| vcustomize [modifyvm id --memory 2048] end webvmsynced_folder ldquovarwww end configvmdefine db do |db| dbvmnetwork private_network ip 10003 dbvmprovision shell path =gt vagrantdbsh end

Dealing with shared folders

no share

native share- slow - os indipendent-ish

nfs- fast - win support -(

rsync- no real share - update

VM Performance

run testshellip

still runninghellip

mitchellhcomcomparing-filesystem-performance-in-virtual-machines

Virtualbox vs VmWare

Virtualbox 22 min

VmWare 15 min

Virtualbox 22 min

VmWare 15 min+30

use VmWare if you can(it will cost you a few $)

use nfs if you can

vagrant plugin install vbguest

keeps guest addition updated

unless Vagranthas_plugin(ldquovagrant-vbguest) raise rdquoplease install vagrant-vbguestrdquo end

On VM IO is the bottleneck

loading webpages running testsuites are READ heavy

move IO outside shared folders

Default provider virtualbox

3 PHP test suites with unit functional integration mix

small (sf1) build runs in ~25 sec

medium (zf2) build runs in ~2 mins

large (sf2) build runs ~ 20 mins

IO logs cache

class AppKernel extends Kernel public function getCacheDir() if (in_array($this-gtenvironment array(dev test))) return devshmappnamecache $this-gtenvironment

return parentgetCacheDir()

public function getLogDir() if (in_array($this-gtenvironment array(dev lsquotest))) return devshmappnamelogs

return parentgetLogDir()

class AppKernel extends Kernel public function getCacheDir() if (in_array($this-gtenvironment array(dev test))) return devshmappnamecache $this-gtenvironment

return parentgetCacheDir()

public function getLogDir() if (in_array($this-gtenvironment array(dev lsquotest))) return devshmappnamelogs

return parentgetLogDir()

+13-16

IO move DB on RAMif you use sqlite move it on devshm

vagrant plugin install vagrantcachier

if Vagranthas_plugin(vagrant-cachier) configcachescope = box

configcachesynced_folder_opts = type nfs mount_options [rwvers=3tcpnolock] end

Vagrantfile

if Vagranthas_plugin(vagrant-cachier) configcachescope = box

configcachesynced_folder_opts = type nfs mount_options [rwvers=3tcpnolock] end

Vagrantfile

+30for reprovisioning a box with git php apache mysql

use cachefilesd for nfs

- name Install cachefilesd apt pkg=cachefilesd state=present

- name Enable cachefilesd lineinfile dest=etcdefaultcachefilesd line=ldquoRUN=yesrdquo

- name Start cachefilesd service service name=cachefilesd state=restarted

configvmsynced_folder varwww id ldquovagrant-rootrdquo type ldquonfsrdquo mount_options [rwvers=3tcpfsc]

Vagrantfile

configvmsynced_folder varwww id ldquovagrant-rootrdquo type ldquonfsrdquo mount_options [rwvers=3tcpfsc]

Vagrantfile

-15+10

should you trust these numbers

Application Management

How to access mysql

- name add mysql user mysql_user name=ideato host= password=ideato priv=ALLGRANT login_user=root login_password=

- name config bind address to allow remote remote connections lineinfile dest=etcmysqlmycnf state=present regexp=bind-address = 127001 line=bind-address = 0000 backup=yes

- name restart mysql service name=mysql state=restarted

Permissions management in shared folders

configvmsynced_folder varwww id vagrant-root owner vagrant group vagrant mount_options [dmode=777fmode=777]

Use host ssh keys

configsshforward_agent = true

ForwardAgent yes

check ssh config file in your host machine

gruntgulp watch

httpwwwsebastien-hanfrblog20121218noac-performance-impact-on-web-applications

configvmsynced_folder varwww id ldquovagrant-rootrdquo type ldquonfsrdquo mount_options [lsquorwrsquovers=3tcpfsc actimeo=1]

Provisioning

to phansible or not to phansible

quick and easy way to start

theyrsquore general

old platforms are not supported

a lot of a good ideas you can steal from

if which(ansible-playbook) configvmprovision ansible do |ansible| ansibleplaybook = ansibleplaybookyml ansibleinventory_path = ansibleinventoriesdev ansiblelimit = all ansibleextra_vars = private_interface 1921683399 hostname default end else configvmprovision shell path ansiblewindowssh args [default] end

can you assume everyone in your team have the same version

if which(ansible-playbook) configvmprovision ansible do |ansible| ansibleplaybook = ansibleplaybookyml ansibleinventory_path = ansibleinventoriesdev ansiblelimit = all ansibleextra_vars = private_interface 1921683399 hostname default end else configvmprovision shell path ansiblewindowssh args [default] end

the provisioning tool is a moving part wanna update be careful

create Vagrant indipendent provision

scripts

configvmprovision shell path =gt scriptsbootstrapsh args =gt varwww

configvmprovision shell path =gt ldquoscriptsprovisionsh args =gt varwww

create your own template

httpsgithubcomideatosrlvagrant-php-template

yoursquore in control of provisioning command

you can perform additional checks on host machine

Distributing VMs

provisioning does not create immutable vm by default

eg package update on LTS

live on the edge and fix provision script

use stable package repositories

httpsspeakerdeckcommitchellhvagrant-usage-patterns

Create and distribute your own VM

Golden image

vagrant package - -name myboxbox

publish it somewhere (http atlas)

cvmbox_url = ldquohttpmyboxboxrdquo

- Donrsquot make assumptions about the host

- Provision first then bake your own image

- The more moving part the harder will get

Keep it simple

Thank you

_orso_

micheleorselli ideatosrl

moideatoit

Move host specific configuration outside

Vagrantfile

ram 2048 cpus 2 ipaddress 10101010

vagrantfile-local-configyml

require lsquoyaml

_config = YAMLload(Fileopen(Filejoin(Filedirname(__FILE__) ldquovagrantfile-local-configymlrdquo) FileRDONLY)read) CONF = _config

configvmprovider virtualbox do |vb| vbcustomize[modifyvmidldquo--memory CONF[ram]] vbcustomize [modifyvmid--cpus CONF[ldquocpus]] hellip end

As rule of thumb you could assign the half cpus and a quarter of the memory based on your host machine

httpsstefanwrobelcomhow-to-make-vagrant-performance-not-suck

Force a specific provider

ENV[VAGRANT_DEFAULT_PROVIDER] = virtualbox

Support multiple providers

configvmprovider virtualbox do |vb| vbcustomize [modifyvmid --memory CONF[ram]] vbcustomize [modifyvmid --cpus CONF[cpus]] end configvmprovider vmware_fusion do |v| vvmx[memsize] = CONF[ram] vvmx[numvcpus] = CONF[cpus] end

Projectrsquos directories organization

myproject -- hellip -- vagrant -- Vagrantfile

single git repository

cvmsynced_folder ldquordquordquovarwwwmyproject

myproject -- project --hellip -- vagrant -- Vagrantfile

single git repository

cvmsynced_folder ldquoprojectrdquordquovarwwwprojectrdquo

myproject -- vagrant -- www -- project1 -- project2 -- Vagrantfile

singlemultiple git repositories

cvmsynced_folder ldquowwwrdquordquovarwwwrdquo

vagrant plugin install HostsUpdater

(or HostManager)

etchosts

10101040 host1lo VAGRANT e2bca7c8bf6d76cbcf6ee48998c16f

if Vagranthas_plugin(HostsUpdater) confighostsupdateraliases = [host1lo] else puts --- WARNING --- puts ldquoYou should install HostsUpdaterrdquo end

Multi-VM Configuration

configvmdefine web do |web| webvmnetwork private_network ip 10002 webvmprovider virtualbox do |v| vcustomize [modifyvm id --memory 2048] end webvmsynced_folder ldquovarwww end configvmdefine db do |db| dbvmnetwork private_network ip 10003 dbvmprovision shell path =gt vagrantdbsh end

Dealing with shared folders

no share

native share- slow - os indipendent-ish

nfs- fast - win support -(

rsync- no real share - update

VM Performance

run testshellip

still runninghellip

mitchellhcomcomparing-filesystem-performance-in-virtual-machines

Virtualbox vs VmWare

Virtualbox 22 min

VmWare 15 min

Virtualbox 22 min

VmWare 15 min+30

use VmWare if you can(it will cost you a few $)

use nfs if you can

vagrant plugin install vbguest

keeps guest addition updated

unless Vagranthas_plugin(ldquovagrant-vbguest) raise rdquoplease install vagrant-vbguestrdquo end

On VM IO is the bottleneck

loading webpages running testsuites are READ heavy

move IO outside shared folders

Default provider virtualbox

3 PHP test suites with unit functional integration mix

small (sf1) build runs in ~25 sec

medium (zf2) build runs in ~2 mins

large (sf2) build runs ~ 20 mins

IO logs cache

class AppKernel extends Kernel public function getCacheDir() if (in_array($this-gtenvironment array(dev test))) return devshmappnamecache $this-gtenvironment

return parentgetCacheDir()

public function getLogDir() if (in_array($this-gtenvironment array(dev lsquotest))) return devshmappnamelogs

return parentgetLogDir()

class AppKernel extends Kernel public function getCacheDir() if (in_array($this-gtenvironment array(dev test))) return devshmappnamecache $this-gtenvironment

return parentgetCacheDir()

public function getLogDir() if (in_array($this-gtenvironment array(dev lsquotest))) return devshmappnamelogs

return parentgetLogDir()

+13-16

IO move DB on RAMif you use sqlite move it on devshm

vagrant plugin install vagrantcachier

if Vagranthas_plugin(vagrant-cachier) configcachescope = box

configcachesynced_folder_opts = type nfs mount_options [rwvers=3tcpnolock] end

Vagrantfile

if Vagranthas_plugin(vagrant-cachier) configcachescope = box

configcachesynced_folder_opts = type nfs mount_options [rwvers=3tcpnolock] end

Vagrantfile

+30for reprovisioning a box with git php apache mysql

use cachefilesd for nfs

- name Install cachefilesd apt pkg=cachefilesd state=present

- name Enable cachefilesd lineinfile dest=etcdefaultcachefilesd line=ldquoRUN=yesrdquo

- name Start cachefilesd service service name=cachefilesd state=restarted

configvmsynced_folder varwww id ldquovagrant-rootrdquo type ldquonfsrdquo mount_options [rwvers=3tcpfsc]

Vagrantfile

configvmsynced_folder varwww id ldquovagrant-rootrdquo type ldquonfsrdquo mount_options [rwvers=3tcpfsc]

Vagrantfile

-15+10

should you trust these numbers

Application Management

How to access mysql

- name add mysql user mysql_user name=ideato host= password=ideato priv=ALLGRANT login_user=root login_password=

- name config bind address to allow remote remote connections lineinfile dest=etcmysqlmycnf state=present regexp=bind-address = 127001 line=bind-address = 0000 backup=yes

- name restart mysql service name=mysql state=restarted

Permissions management in shared folders

configvmsynced_folder varwww id vagrant-root owner vagrant group vagrant mount_options [dmode=777fmode=777]

Use host ssh keys

configsshforward_agent = true

ForwardAgent yes

check ssh config file in your host machine

gruntgulp watch

httpwwwsebastien-hanfrblog20121218noac-performance-impact-on-web-applications

configvmsynced_folder varwww id ldquovagrant-rootrdquo type ldquonfsrdquo mount_options [lsquorwrsquovers=3tcpfsc actimeo=1]

Provisioning

to phansible or not to phansible

quick and easy way to start

theyrsquore general

old platforms are not supported

a lot of a good ideas you can steal from

if which(ansible-playbook) configvmprovision ansible do |ansible| ansibleplaybook = ansibleplaybookyml ansibleinventory_path = ansibleinventoriesdev ansiblelimit = all ansibleextra_vars = private_interface 1921683399 hostname default end else configvmprovision shell path ansiblewindowssh args [default] end

can you assume everyone in your team have the same version

if which(ansible-playbook) configvmprovision ansible do |ansible| ansibleplaybook = ansibleplaybookyml ansibleinventory_path = ansibleinventoriesdev ansiblelimit = all ansibleextra_vars = private_interface 1921683399 hostname default end else configvmprovision shell path ansiblewindowssh args [default] end

the provisioning tool is a moving part wanna update be careful

create Vagrant indipendent provision

scripts

configvmprovision shell path =gt scriptsbootstrapsh args =gt varwww

configvmprovision shell path =gt ldquoscriptsprovisionsh args =gt varwww

create your own template

httpsgithubcomideatosrlvagrant-php-template

yoursquore in control of provisioning command

you can perform additional checks on host machine

Distributing VMs

provisioning does not create immutable vm by default

eg package update on LTS

live on the edge and fix provision script

use stable package repositories

httpsspeakerdeckcommitchellhvagrant-usage-patterns

Create and distribute your own VM

Golden image

vagrant package - -name myboxbox

publish it somewhere (http atlas)

cvmbox_url = ldquohttpmyboxboxrdquo

- Donrsquot make assumptions about the host

- Provision first then bake your own image

- The more moving part the harder will get

Keep it simple

Thank you

_orso_

micheleorselli ideatosrl

moideatoit

ram 2048 cpus 2 ipaddress 10101010

vagrantfile-local-configyml

require lsquoyaml

_config = YAMLload(Fileopen(Filejoin(Filedirname(__FILE__) ldquovagrantfile-local-configymlrdquo) FileRDONLY)read) CONF = _config

configvmprovider virtualbox do |vb| vbcustomize[modifyvmidldquo--memory CONF[ram]] vbcustomize [modifyvmid--cpus CONF[ldquocpus]] hellip end

As rule of thumb you could assign the half cpus and a quarter of the memory based on your host machine

httpsstefanwrobelcomhow-to-make-vagrant-performance-not-suck

Force a specific provider

ENV[VAGRANT_DEFAULT_PROVIDER] = virtualbox

Support multiple providers

configvmprovider virtualbox do |vb| vbcustomize [modifyvmid --memory CONF[ram]] vbcustomize [modifyvmid --cpus CONF[cpus]] end configvmprovider vmware_fusion do |v| vvmx[memsize] = CONF[ram] vvmx[numvcpus] = CONF[cpus] end

Projectrsquos directories organization

myproject -- hellip -- vagrant -- Vagrantfile

single git repository

cvmsynced_folder ldquordquordquovarwwwmyproject

myproject -- project --hellip -- vagrant -- Vagrantfile

single git repository

cvmsynced_folder ldquoprojectrdquordquovarwwwprojectrdquo

myproject -- vagrant -- www -- project1 -- project2 -- Vagrantfile

singlemultiple git repositories

cvmsynced_folder ldquowwwrdquordquovarwwwrdquo

vagrant plugin install HostsUpdater

(or HostManager)

etchosts

10101040 host1lo VAGRANT e2bca7c8bf6d76cbcf6ee48998c16f

if Vagranthas_plugin(HostsUpdater) confighostsupdateraliases = [host1lo] else puts --- WARNING --- puts ldquoYou should install HostsUpdaterrdquo end

Multi-VM Configuration

configvmdefine web do |web| webvmnetwork private_network ip 10002 webvmprovider virtualbox do |v| vcustomize [modifyvm id --memory 2048] end webvmsynced_folder ldquovarwww end configvmdefine db do |db| dbvmnetwork private_network ip 10003 dbvmprovision shell path =gt vagrantdbsh end

Dealing with shared folders

no share

native share- slow - os indipendent-ish

nfs- fast - win support -(

rsync- no real share - update

VM Performance

run testshellip

still runninghellip

mitchellhcomcomparing-filesystem-performance-in-virtual-machines

Virtualbox vs VmWare

Virtualbox 22 min

VmWare 15 min

Virtualbox 22 min

VmWare 15 min+30

use VmWare if you can(it will cost you a few $)

use nfs if you can

vagrant plugin install vbguest

keeps guest addition updated

unless Vagranthas_plugin(ldquovagrant-vbguest) raise rdquoplease install vagrant-vbguestrdquo end

On VM IO is the bottleneck

loading webpages running testsuites are READ heavy

move IO outside shared folders

Default provider virtualbox

3 PHP test suites with unit functional integration mix

small (sf1) build runs in ~25 sec

medium (zf2) build runs in ~2 mins

large (sf2) build runs ~ 20 mins

IO logs cache

class AppKernel extends Kernel public function getCacheDir() if (in_array($this-gtenvironment array(dev test))) return devshmappnamecache $this-gtenvironment

return parentgetCacheDir()

public function getLogDir() if (in_array($this-gtenvironment array(dev lsquotest))) return devshmappnamelogs

return parentgetLogDir()

class AppKernel extends Kernel public function getCacheDir() if (in_array($this-gtenvironment array(dev test))) return devshmappnamecache $this-gtenvironment

return parentgetCacheDir()

public function getLogDir() if (in_array($this-gtenvironment array(dev lsquotest))) return devshmappnamelogs

return parentgetLogDir()

+13-16

IO move DB on RAMif you use sqlite move it on devshm

vagrant plugin install vagrantcachier

if Vagranthas_plugin(vagrant-cachier) configcachescope = box

configcachesynced_folder_opts = type nfs mount_options [rwvers=3tcpnolock] end

Vagrantfile

if Vagranthas_plugin(vagrant-cachier) configcachescope = box

configcachesynced_folder_opts = type nfs mount_options [rwvers=3tcpnolock] end

Vagrantfile

+30for reprovisioning a box with git php apache mysql

use cachefilesd for nfs

- name Install cachefilesd apt pkg=cachefilesd state=present

- name Enable cachefilesd lineinfile dest=etcdefaultcachefilesd line=ldquoRUN=yesrdquo

- name Start cachefilesd service service name=cachefilesd state=restarted

configvmsynced_folder varwww id ldquovagrant-rootrdquo type ldquonfsrdquo mount_options [rwvers=3tcpfsc]

Vagrantfile

configvmsynced_folder varwww id ldquovagrant-rootrdquo type ldquonfsrdquo mount_options [rwvers=3tcpfsc]

Vagrantfile

-15+10

should you trust these numbers

Application Management

How to access mysql

- name add mysql user mysql_user name=ideato host= password=ideato priv=ALLGRANT login_user=root login_password=

- name config bind address to allow remote remote connections lineinfile dest=etcmysqlmycnf state=present regexp=bind-address = 127001 line=bind-address = 0000 backup=yes

- name restart mysql service name=mysql state=restarted

Permissions management in shared folders

configvmsynced_folder varwww id vagrant-root owner vagrant group vagrant mount_options [dmode=777fmode=777]

Use host ssh keys

configsshforward_agent = true

ForwardAgent yes

check ssh config file in your host machine

gruntgulp watch

httpwwwsebastien-hanfrblog20121218noac-performance-impact-on-web-applications

configvmsynced_folder varwww id ldquovagrant-rootrdquo type ldquonfsrdquo mount_options [lsquorwrsquovers=3tcpfsc actimeo=1]

Provisioning

to phansible or not to phansible

quick and easy way to start

theyrsquore general

old platforms are not supported

a lot of a good ideas you can steal from

if which(ansible-playbook) configvmprovision ansible do |ansible| ansibleplaybook = ansibleplaybookyml ansibleinventory_path = ansibleinventoriesdev ansiblelimit = all ansibleextra_vars = private_interface 1921683399 hostname default end else configvmprovision shell path ansiblewindowssh args [default] end

can you assume everyone in your team have the same version

if which(ansible-playbook) configvmprovision ansible do |ansible| ansibleplaybook = ansibleplaybookyml ansibleinventory_path = ansibleinventoriesdev ansiblelimit = all ansibleextra_vars = private_interface 1921683399 hostname default end else configvmprovision shell path ansiblewindowssh args [default] end

the provisioning tool is a moving part wanna update be careful

create Vagrant indipendent provision

scripts

configvmprovision shell path =gt scriptsbootstrapsh args =gt varwww

configvmprovision shell path =gt ldquoscriptsprovisionsh args =gt varwww

create your own template

httpsgithubcomideatosrlvagrant-php-template

yoursquore in control of provisioning command

you can perform additional checks on host machine

Distributing VMs

provisioning does not create immutable vm by default

eg package update on LTS

live on the edge and fix provision script

use stable package repositories

httpsspeakerdeckcommitchellhvagrant-usage-patterns

Create and distribute your own VM

Golden image

vagrant package - -name myboxbox

publish it somewhere (http atlas)

cvmbox_url = ldquohttpmyboxboxrdquo

- Donrsquot make assumptions about the host

- Provision first then bake your own image

- The more moving part the harder will get

Keep it simple

Thank you

_orso_

micheleorselli ideatosrl

moideatoit

require lsquoyaml

_config = YAMLload(Fileopen(Filejoin(Filedirname(__FILE__) ldquovagrantfile-local-configymlrdquo) FileRDONLY)read) CONF = _config

configvmprovider virtualbox do |vb| vbcustomize[modifyvmidldquo--memory CONF[ram]] vbcustomize [modifyvmid--cpus CONF[ldquocpus]] hellip end

As rule of thumb you could assign the half cpus and a quarter of the memory based on your host machine

httpsstefanwrobelcomhow-to-make-vagrant-performance-not-suck

Force a specific provider

ENV[VAGRANT_DEFAULT_PROVIDER] = virtualbox

Support multiple providers

configvmprovider virtualbox do |vb| vbcustomize [modifyvmid --memory CONF[ram]] vbcustomize [modifyvmid --cpus CONF[cpus]] end configvmprovider vmware_fusion do |v| vvmx[memsize] = CONF[ram] vvmx[numvcpus] = CONF[cpus] end

Projectrsquos directories organization

myproject -- hellip -- vagrant -- Vagrantfile

single git repository

cvmsynced_folder ldquordquordquovarwwwmyproject

myproject -- project --hellip -- vagrant -- Vagrantfile

single git repository

cvmsynced_folder ldquoprojectrdquordquovarwwwprojectrdquo

myproject -- vagrant -- www -- project1 -- project2 -- Vagrantfile

singlemultiple git repositories

cvmsynced_folder ldquowwwrdquordquovarwwwrdquo

vagrant plugin install HostsUpdater

(or HostManager)

etchosts

10101040 host1lo VAGRANT e2bca7c8bf6d76cbcf6ee48998c16f

if Vagranthas_plugin(HostsUpdater) confighostsupdateraliases = [host1lo] else puts --- WARNING --- puts ldquoYou should install HostsUpdaterrdquo end

Multi-VM Configuration

configvmdefine web do |web| webvmnetwork private_network ip 10002 webvmprovider virtualbox do |v| vcustomize [modifyvm id --memory 2048] end webvmsynced_folder ldquovarwww end configvmdefine db do |db| dbvmnetwork private_network ip 10003 dbvmprovision shell path =gt vagrantdbsh end

Dealing with shared folders

no share

native share- slow - os indipendent-ish

nfs- fast - win support -(

rsync- no real share - update

VM Performance

run testshellip

still runninghellip

mitchellhcomcomparing-filesystem-performance-in-virtual-machines

Virtualbox vs VmWare

Virtualbox 22 min

VmWare 15 min

Virtualbox 22 min

VmWare 15 min+30

use VmWare if you can(it will cost you a few $)

use nfs if you can

vagrant plugin install vbguest

keeps guest addition updated

unless Vagranthas_plugin(ldquovagrant-vbguest) raise rdquoplease install vagrant-vbguestrdquo end

On VM IO is the bottleneck

loading webpages running testsuites are READ heavy

move IO outside shared folders

Default provider virtualbox

3 PHP test suites with unit functional integration mix

small (sf1) build runs in ~25 sec

medium (zf2) build runs in ~2 mins

large (sf2) build runs ~ 20 mins

IO logs cache

class AppKernel extends Kernel public function getCacheDir() if (in_array($this-gtenvironment array(dev test))) return devshmappnamecache $this-gtenvironment

return parentgetCacheDir()

public function getLogDir() if (in_array($this-gtenvironment array(dev lsquotest))) return devshmappnamelogs

return parentgetLogDir()

class AppKernel extends Kernel public function getCacheDir() if (in_array($this-gtenvironment array(dev test))) return devshmappnamecache $this-gtenvironment

return parentgetCacheDir()

public function getLogDir() if (in_array($this-gtenvironment array(dev lsquotest))) return devshmappnamelogs

return parentgetLogDir()

+13-16

IO move DB on RAMif you use sqlite move it on devshm

vagrant plugin install vagrantcachier

if Vagranthas_plugin(vagrant-cachier) configcachescope = box

configcachesynced_folder_opts = type nfs mount_options [rwvers=3tcpnolock] end

Vagrantfile

if Vagranthas_plugin(vagrant-cachier) configcachescope = box

configcachesynced_folder_opts = type nfs mount_options [rwvers=3tcpnolock] end

Vagrantfile

+30for reprovisioning a box with git php apache mysql

use cachefilesd for nfs

- name Install cachefilesd apt pkg=cachefilesd state=present

- name Enable cachefilesd lineinfile dest=etcdefaultcachefilesd line=ldquoRUN=yesrdquo

- name Start cachefilesd service service name=cachefilesd state=restarted

configvmsynced_folder varwww id ldquovagrant-rootrdquo type ldquonfsrdquo mount_options [rwvers=3tcpfsc]

Vagrantfile

configvmsynced_folder varwww id ldquovagrant-rootrdquo type ldquonfsrdquo mount_options [rwvers=3tcpfsc]

Vagrantfile

-15+10

should you trust these numbers

Application Management

How to access mysql

- name add mysql user mysql_user name=ideato host= password=ideato priv=ALLGRANT login_user=root login_password=

- name config bind address to allow remote remote connections lineinfile dest=etcmysqlmycnf state=present regexp=bind-address = 127001 line=bind-address = 0000 backup=yes

- name restart mysql service name=mysql state=restarted

Permissions management in shared folders

configvmsynced_folder varwww id vagrant-root owner vagrant group vagrant mount_options [dmode=777fmode=777]

Use host ssh keys

configsshforward_agent = true

ForwardAgent yes

check ssh config file in your host machine

gruntgulp watch

httpwwwsebastien-hanfrblog20121218noac-performance-impact-on-web-applications

configvmsynced_folder varwww id ldquovagrant-rootrdquo type ldquonfsrdquo mount_options [lsquorwrsquovers=3tcpfsc actimeo=1]

Provisioning

to phansible or not to phansible

quick and easy way to start

theyrsquore general

old platforms are not supported

a lot of a good ideas you can steal from

if which(ansible-playbook) configvmprovision ansible do |ansible| ansibleplaybook = ansibleplaybookyml ansibleinventory_path = ansibleinventoriesdev ansiblelimit = all ansibleextra_vars = private_interface 1921683399 hostname default end else configvmprovision shell path ansiblewindowssh args [default] end

can you assume everyone in your team have the same version

if which(ansible-playbook) configvmprovision ansible do |ansible| ansibleplaybook = ansibleplaybookyml ansibleinventory_path = ansibleinventoriesdev ansiblelimit = all ansibleextra_vars = private_interface 1921683399 hostname default end else configvmprovision shell path ansiblewindowssh args [default] end

the provisioning tool is a moving part wanna update be careful

create Vagrant indipendent provision

scripts

configvmprovision shell path =gt scriptsbootstrapsh args =gt varwww

configvmprovision shell path =gt ldquoscriptsprovisionsh args =gt varwww

create your own template

httpsgithubcomideatosrlvagrant-php-template

yoursquore in control of provisioning command

you can perform additional checks on host machine

Distributing VMs

provisioning does not create immutable vm by default

eg package update on LTS

live on the edge and fix provision script

use stable package repositories

httpsspeakerdeckcommitchellhvagrant-usage-patterns

Create and distribute your own VM

Golden image

vagrant package - -name myboxbox

publish it somewhere (http atlas)

cvmbox_url = ldquohttpmyboxboxrdquo

- Donrsquot make assumptions about the host

- Provision first then bake your own image

- The more moving part the harder will get

Keep it simple

Thank you

_orso_

micheleorselli ideatosrl

moideatoit

As rule of thumb you could assign the half cpus and a quarter of the memory based on your host machine

httpsstefanwrobelcomhow-to-make-vagrant-performance-not-suck

Force a specific provider

ENV[VAGRANT_DEFAULT_PROVIDER] = virtualbox

Support multiple providers

configvmprovider virtualbox do |vb| vbcustomize [modifyvmid --memory CONF[ram]] vbcustomize [modifyvmid --cpus CONF[cpus]] end configvmprovider vmware_fusion do |v| vvmx[memsize] = CONF[ram] vvmx[numvcpus] = CONF[cpus] end

Projectrsquos directories organization

myproject -- hellip -- vagrant -- Vagrantfile

single git repository

cvmsynced_folder ldquordquordquovarwwwmyproject

myproject -- project --hellip -- vagrant -- Vagrantfile

single git repository

cvmsynced_folder ldquoprojectrdquordquovarwwwprojectrdquo

myproject -- vagrant -- www -- project1 -- project2 -- Vagrantfile

singlemultiple git repositories

cvmsynced_folder ldquowwwrdquordquovarwwwrdquo

vagrant plugin install HostsUpdater

(or HostManager)

etchosts

10101040 host1lo VAGRANT e2bca7c8bf6d76cbcf6ee48998c16f

if Vagranthas_plugin(HostsUpdater) confighostsupdateraliases = [host1lo] else puts --- WARNING --- puts ldquoYou should install HostsUpdaterrdquo end

Multi-VM Configuration

configvmdefine web do |web| webvmnetwork private_network ip 10002 webvmprovider virtualbox do |v| vcustomize [modifyvm id --memory 2048] end webvmsynced_folder ldquovarwww end configvmdefine db do |db| dbvmnetwork private_network ip 10003 dbvmprovision shell path =gt vagrantdbsh end

Dealing with shared folders

no share

native share- slow - os indipendent-ish

nfs- fast - win support -(

rsync- no real share - update

VM Performance

run testshellip

still runninghellip

mitchellhcomcomparing-filesystem-performance-in-virtual-machines

Virtualbox vs VmWare

Virtualbox 22 min

VmWare 15 min

Virtualbox 22 min

VmWare 15 min+30

use VmWare if you can(it will cost you a few $)

use nfs if you can

vagrant plugin install vbguest

keeps guest addition updated

unless Vagranthas_plugin(ldquovagrant-vbguest) raise rdquoplease install vagrant-vbguestrdquo end

On VM IO is the bottleneck

loading webpages running testsuites are READ heavy

move IO outside shared folders

Default provider virtualbox

3 PHP test suites with unit functional integration mix

small (sf1) build runs in ~25 sec

medium (zf2) build runs in ~2 mins

large (sf2) build runs ~ 20 mins

IO logs cache

class AppKernel extends Kernel public function getCacheDir() if (in_array($this-gtenvironment array(dev test))) return devshmappnamecache $this-gtenvironment

return parentgetCacheDir()

public function getLogDir() if (in_array($this-gtenvironment array(dev lsquotest))) return devshmappnamelogs

return parentgetLogDir()

class AppKernel extends Kernel public function getCacheDir() if (in_array($this-gtenvironment array(dev test))) return devshmappnamecache $this-gtenvironment

return parentgetCacheDir()

public function getLogDir() if (in_array($this-gtenvironment array(dev lsquotest))) return devshmappnamelogs

return parentgetLogDir()

+13-16

IO move DB on RAMif you use sqlite move it on devshm

vagrant plugin install vagrantcachier

if Vagranthas_plugin(vagrant-cachier) configcachescope = box

configcachesynced_folder_opts = type nfs mount_options [rwvers=3tcpnolock] end

Vagrantfile

if Vagranthas_plugin(vagrant-cachier) configcachescope = box

configcachesynced_folder_opts = type nfs mount_options [rwvers=3tcpnolock] end

Vagrantfile

+30for reprovisioning a box with git php apache mysql

use cachefilesd for nfs

- name Install cachefilesd apt pkg=cachefilesd state=present

- name Enable cachefilesd lineinfile dest=etcdefaultcachefilesd line=ldquoRUN=yesrdquo

- name Start cachefilesd service service name=cachefilesd state=restarted

configvmsynced_folder varwww id ldquovagrant-rootrdquo type ldquonfsrdquo mount_options [rwvers=3tcpfsc]

Vagrantfile

configvmsynced_folder varwww id ldquovagrant-rootrdquo type ldquonfsrdquo mount_options [rwvers=3tcpfsc]

Vagrantfile

-15+10

should you trust these numbers

Application Management

How to access mysql

- name add mysql user mysql_user name=ideato host= password=ideato priv=ALLGRANT login_user=root login_password=

- name config bind address to allow remote remote connections lineinfile dest=etcmysqlmycnf state=present regexp=bind-address = 127001 line=bind-address = 0000 backup=yes

- name restart mysql service name=mysql state=restarted

Permissions management in shared folders

configvmsynced_folder varwww id vagrant-root owner vagrant group vagrant mount_options [dmode=777fmode=777]

Use host ssh keys

configsshforward_agent = true

ForwardAgent yes

check ssh config file in your host machine

gruntgulp watch

httpwwwsebastien-hanfrblog20121218noac-performance-impact-on-web-applications

configvmsynced_folder varwww id ldquovagrant-rootrdquo type ldquonfsrdquo mount_options [lsquorwrsquovers=3tcpfsc actimeo=1]

Provisioning

to phansible or not to phansible

quick and easy way to start

theyrsquore general

old platforms are not supported

a lot of a good ideas you can steal from

if which(ansible-playbook) configvmprovision ansible do |ansible| ansibleplaybook = ansibleplaybookyml ansibleinventory_path = ansibleinventoriesdev ansiblelimit = all ansibleextra_vars = private_interface 1921683399 hostname default end else configvmprovision shell path ansiblewindowssh args [default] end

can you assume everyone in your team have the same version

if which(ansible-playbook) configvmprovision ansible do |ansible| ansibleplaybook = ansibleplaybookyml ansibleinventory_path = ansibleinventoriesdev ansiblelimit = all ansibleextra_vars = private_interface 1921683399 hostname default end else configvmprovision shell path ansiblewindowssh args [default] end

the provisioning tool is a moving part wanna update be careful

create Vagrant indipendent provision

scripts

configvmprovision shell path =gt scriptsbootstrapsh args =gt varwww

configvmprovision shell path =gt ldquoscriptsprovisionsh args =gt varwww

create your own template

httpsgithubcomideatosrlvagrant-php-template

yoursquore in control of provisioning command

you can perform additional checks on host machine

Distributing VMs

provisioning does not create immutable vm by default

eg package update on LTS

live on the edge and fix provision script

use stable package repositories

httpsspeakerdeckcommitchellhvagrant-usage-patterns

Create and distribute your own VM

Golden image

vagrant package - -name myboxbox

publish it somewhere (http atlas)

cvmbox_url = ldquohttpmyboxboxrdquo

- Donrsquot make assumptions about the host

- Provision first then bake your own image

- The more moving part the harder will get

Keep it simple

Thank you

_orso_

micheleorselli ideatosrl

moideatoit

Force a specific provider

ENV[VAGRANT_DEFAULT_PROVIDER] = virtualbox

Support multiple providers

configvmprovider virtualbox do |vb| vbcustomize [modifyvmid --memory CONF[ram]] vbcustomize [modifyvmid --cpus CONF[cpus]] end configvmprovider vmware_fusion do |v| vvmx[memsize] = CONF[ram] vvmx[numvcpus] = CONF[cpus] end

Projectrsquos directories organization

myproject -- hellip -- vagrant -- Vagrantfile

single git repository

cvmsynced_folder ldquordquordquovarwwwmyproject

myproject -- project --hellip -- vagrant -- Vagrantfile

single git repository

cvmsynced_folder ldquoprojectrdquordquovarwwwprojectrdquo

myproject -- vagrant -- www -- project1 -- project2 -- Vagrantfile

singlemultiple git repositories

cvmsynced_folder ldquowwwrdquordquovarwwwrdquo

vagrant plugin install HostsUpdater

(or HostManager)

etchosts

10101040 host1lo VAGRANT e2bca7c8bf6d76cbcf6ee48998c16f

if Vagranthas_plugin(HostsUpdater) confighostsupdateraliases = [host1lo] else puts --- WARNING --- puts ldquoYou should install HostsUpdaterrdquo end

Multi-VM Configuration

configvmdefine web do |web| webvmnetwork private_network ip 10002 webvmprovider virtualbox do |v| vcustomize [modifyvm id --memory 2048] end webvmsynced_folder ldquovarwww end configvmdefine db do |db| dbvmnetwork private_network ip 10003 dbvmprovision shell path =gt vagrantdbsh end

Dealing with shared folders

no share

native share- slow - os indipendent-ish

nfs- fast - win support -(

rsync- no real share - update

VM Performance

run testshellip

still runninghellip

mitchellhcomcomparing-filesystem-performance-in-virtual-machines

Virtualbox vs VmWare

Virtualbox 22 min

VmWare 15 min

Virtualbox 22 min

VmWare 15 min+30

use VmWare if you can(it will cost you a few $)

use nfs if you can

vagrant plugin install vbguest

keeps guest addition updated

unless Vagranthas_plugin(ldquovagrant-vbguest) raise rdquoplease install vagrant-vbguestrdquo end

On VM IO is the bottleneck

loading webpages running testsuites are READ heavy

move IO outside shared folders

Default provider virtualbox

3 PHP test suites with unit functional integration mix

small (sf1) build runs in ~25 sec

medium (zf2) build runs in ~2 mins

large (sf2) build runs ~ 20 mins

IO logs cache

class AppKernel extends Kernel public function getCacheDir() if (in_array($this-gtenvironment array(dev test))) return devshmappnamecache $this-gtenvironment

return parentgetCacheDir()

public function getLogDir() if (in_array($this-gtenvironment array(dev lsquotest))) return devshmappnamelogs

return parentgetLogDir()

class AppKernel extends Kernel public function getCacheDir() if (in_array($this-gtenvironment array(dev test))) return devshmappnamecache $this-gtenvironment

return parentgetCacheDir()

public function getLogDir() if (in_array($this-gtenvironment array(dev lsquotest))) return devshmappnamelogs

return parentgetLogDir()

+13-16

IO move DB on RAMif you use sqlite move it on devshm

vagrant plugin install vagrantcachier

if Vagranthas_plugin(vagrant-cachier) configcachescope = box

configcachesynced_folder_opts = type nfs mount_options [rwvers=3tcpnolock] end

Vagrantfile

if Vagranthas_plugin(vagrant-cachier) configcachescope = box

configcachesynced_folder_opts = type nfs mount_options [rwvers=3tcpnolock] end

Vagrantfile

+30for reprovisioning a box with git php apache mysql

use cachefilesd for nfs

- name Install cachefilesd apt pkg=cachefilesd state=present

- name Enable cachefilesd lineinfile dest=etcdefaultcachefilesd line=ldquoRUN=yesrdquo

- name Start cachefilesd service service name=cachefilesd state=restarted

configvmsynced_folder varwww id ldquovagrant-rootrdquo type ldquonfsrdquo mount_options [rwvers=3tcpfsc]

Vagrantfile

configvmsynced_folder varwww id ldquovagrant-rootrdquo type ldquonfsrdquo mount_options [rwvers=3tcpfsc]

Vagrantfile

-15+10

should you trust these numbers

Application Management

How to access mysql

- name add mysql user mysql_user name=ideato host= password=ideato priv=ALLGRANT login_user=root login_password=

- name config bind address to allow remote remote connections lineinfile dest=etcmysqlmycnf state=present regexp=bind-address = 127001 line=bind-address = 0000 backup=yes

- name restart mysql service name=mysql state=restarted

Permissions management in shared folders

configvmsynced_folder varwww id vagrant-root owner vagrant group vagrant mount_options [dmode=777fmode=777]

Use host ssh keys

configsshforward_agent = true

ForwardAgent yes

check ssh config file in your host machine

gruntgulp watch

httpwwwsebastien-hanfrblog20121218noac-performance-impact-on-web-applications

configvmsynced_folder varwww id ldquovagrant-rootrdquo type ldquonfsrdquo mount_options [lsquorwrsquovers=3tcpfsc actimeo=1]

Provisioning

to phansible or not to phansible

quick and easy way to start

theyrsquore general

old platforms are not supported

a lot of a good ideas you can steal from

if which(ansible-playbook) configvmprovision ansible do |ansible| ansibleplaybook = ansibleplaybookyml ansibleinventory_path = ansibleinventoriesdev ansiblelimit = all ansibleextra_vars = private_interface 1921683399 hostname default end else configvmprovision shell path ansiblewindowssh args [default] end

can you assume everyone in your team have the same version

if which(ansible-playbook) configvmprovision ansible do |ansible| ansibleplaybook = ansibleplaybookyml ansibleinventory_path = ansibleinventoriesdev ansiblelimit = all ansibleextra_vars = private_interface 1921683399 hostname default end else configvmprovision shell path ansiblewindowssh args [default] end

the provisioning tool is a moving part wanna update be careful

create Vagrant indipendent provision

scripts

configvmprovision shell path =gt scriptsbootstrapsh args =gt varwww

configvmprovision shell path =gt ldquoscriptsprovisionsh args =gt varwww

create your own template

httpsgithubcomideatosrlvagrant-php-template

yoursquore in control of provisioning command

you can perform additional checks on host machine

Distributing VMs

provisioning does not create immutable vm by default

eg package update on LTS

live on the edge and fix provision script

use stable package repositories

httpsspeakerdeckcommitchellhvagrant-usage-patterns

Create and distribute your own VM

Golden image

vagrant package - -name myboxbox

publish it somewhere (http atlas)

cvmbox_url = ldquohttpmyboxboxrdquo

- Donrsquot make assumptions about the host

- Provision first then bake your own image

- The more moving part the harder will get

Keep it simple

Thank you

_orso_

micheleorselli ideatosrl

moideatoit

ENV[VAGRANT_DEFAULT_PROVIDER] = virtualbox

Support multiple providers

configvmprovider virtualbox do |vb| vbcustomize [modifyvmid --memory CONF[ram]] vbcustomize [modifyvmid --cpus CONF[cpus]] end configvmprovider vmware_fusion do |v| vvmx[memsize] = CONF[ram] vvmx[numvcpus] = CONF[cpus] end

Projectrsquos directories organization

myproject -- hellip -- vagrant -- Vagrantfile

single git repository

cvmsynced_folder ldquordquordquovarwwwmyproject

myproject -- project --hellip -- vagrant -- Vagrantfile

single git repository

cvmsynced_folder ldquoprojectrdquordquovarwwwprojectrdquo

myproject -- vagrant -- www -- project1 -- project2 -- Vagrantfile

singlemultiple git repositories

cvmsynced_folder ldquowwwrdquordquovarwwwrdquo

vagrant plugin install HostsUpdater

(or HostManager)

etchosts

10101040 host1lo VAGRANT e2bca7c8bf6d76cbcf6ee48998c16f

if Vagranthas_plugin(HostsUpdater) confighostsupdateraliases = [host1lo] else puts --- WARNING --- puts ldquoYou should install HostsUpdaterrdquo end

Multi-VM Configuration

configvmdefine web do |web| webvmnetwork private_network ip 10002 webvmprovider virtualbox do |v| vcustomize [modifyvm id --memory 2048] end webvmsynced_folder ldquovarwww end configvmdefine db do |db| dbvmnetwork private_network ip 10003 dbvmprovision shell path =gt vagrantdbsh end

Dealing with shared folders

no share

native share- slow - os indipendent-ish

nfs- fast - win support -(

rsync- no real share - update

VM Performance

run testshellip

still runninghellip

mitchellhcomcomparing-filesystem-performance-in-virtual-machines

Virtualbox vs VmWare

Virtualbox 22 min

VmWare 15 min

Virtualbox 22 min

VmWare 15 min+30

use VmWare if you can(it will cost you a few $)

use nfs if you can

vagrant plugin install vbguest

keeps guest addition updated

unless Vagranthas_plugin(ldquovagrant-vbguest) raise rdquoplease install vagrant-vbguestrdquo end

On VM IO is the bottleneck

loading webpages running testsuites are READ heavy

move IO outside shared folders

Default provider virtualbox

3 PHP test suites with unit functional integration mix

small (sf1) build runs in ~25 sec

medium (zf2) build runs in ~2 mins

large (sf2) build runs ~ 20 mins

IO logs cache

class AppKernel extends Kernel public function getCacheDir() if (in_array($this-gtenvironment array(dev test))) return devshmappnamecache $this-gtenvironment

return parentgetCacheDir()

public function getLogDir() if (in_array($this-gtenvironment array(dev lsquotest))) return devshmappnamelogs

return parentgetLogDir()

class AppKernel extends Kernel public function getCacheDir() if (in_array($this-gtenvironment array(dev test))) return devshmappnamecache $this-gtenvironment

return parentgetCacheDir()

public function getLogDir() if (in_array($this-gtenvironment array(dev lsquotest))) return devshmappnamelogs

return parentgetLogDir()

+13-16

IO move DB on RAMif you use sqlite move it on devshm

vagrant plugin install vagrantcachier

if Vagranthas_plugin(vagrant-cachier) configcachescope = box

configcachesynced_folder_opts = type nfs mount_options [rwvers=3tcpnolock] end

Vagrantfile

if Vagranthas_plugin(vagrant-cachier) configcachescope = box

configcachesynced_folder_opts = type nfs mount_options [rwvers=3tcpnolock] end

Vagrantfile

+30for reprovisioning a box with git php apache mysql

use cachefilesd for nfs

- name Install cachefilesd apt pkg=cachefilesd state=present

- name Enable cachefilesd lineinfile dest=etcdefaultcachefilesd line=ldquoRUN=yesrdquo

- name Start cachefilesd service service name=cachefilesd state=restarted

configvmsynced_folder varwww id ldquovagrant-rootrdquo type ldquonfsrdquo mount_options [rwvers=3tcpfsc]

Vagrantfile

configvmsynced_folder varwww id ldquovagrant-rootrdquo type ldquonfsrdquo mount_options [rwvers=3tcpfsc]

Vagrantfile

-15+10

should you trust these numbers

Application Management

How to access mysql

- name add mysql user mysql_user name=ideato host= password=ideato priv=ALLGRANT login_user=root login_password=

- name config bind address to allow remote remote connections lineinfile dest=etcmysqlmycnf state=present regexp=bind-address = 127001 line=bind-address = 0000 backup=yes

- name restart mysql service name=mysql state=restarted

Permissions management in shared folders

configvmsynced_folder varwww id vagrant-root owner vagrant group vagrant mount_options [dmode=777fmode=777]

Use host ssh keys

configsshforward_agent = true

ForwardAgent yes

check ssh config file in your host machine

gruntgulp watch

httpwwwsebastien-hanfrblog20121218noac-performance-impact-on-web-applications

configvmsynced_folder varwww id ldquovagrant-rootrdquo type ldquonfsrdquo mount_options [lsquorwrsquovers=3tcpfsc actimeo=1]

Provisioning

to phansible or not to phansible

quick and easy way to start

theyrsquore general

old platforms are not supported

a lot of a good ideas you can steal from

if which(ansible-playbook) configvmprovision ansible do |ansible| ansibleplaybook = ansibleplaybookyml ansibleinventory_path = ansibleinventoriesdev ansiblelimit = all ansibleextra_vars = private_interface 1921683399 hostname default end else configvmprovision shell path ansiblewindowssh args [default] end

can you assume everyone in your team have the same version

if which(ansible-playbook) configvmprovision ansible do |ansible| ansibleplaybook = ansibleplaybookyml ansibleinventory_path = ansibleinventoriesdev ansiblelimit = all ansibleextra_vars = private_interface 1921683399 hostname default end else configvmprovision shell path ansiblewindowssh args [default] end

the provisioning tool is a moving part wanna update be careful

create Vagrant indipendent provision

scripts

configvmprovision shell path =gt scriptsbootstrapsh args =gt varwww

configvmprovision shell path =gt ldquoscriptsprovisionsh args =gt varwww

create your own template

httpsgithubcomideatosrlvagrant-php-template

yoursquore in control of provisioning command

you can perform additional checks on host machine

Distributing VMs

provisioning does not create immutable vm by default

eg package update on LTS

live on the edge and fix provision script

use stable package repositories

httpsspeakerdeckcommitchellhvagrant-usage-patterns

Create and distribute your own VM

Golden image

vagrant package - -name myboxbox

publish it somewhere (http atlas)

cvmbox_url = ldquohttpmyboxboxrdquo

- Donrsquot make assumptions about the host

- Provision first then bake your own image

- The more moving part the harder will get

Keep it simple

Thank you

_orso_

micheleorselli ideatosrl

moideatoit

Support multiple providers

configvmprovider virtualbox do |vb| vbcustomize [modifyvmid --memory CONF[ram]] vbcustomize [modifyvmid --cpus CONF[cpus]] end configvmprovider vmware_fusion do |v| vvmx[memsize] = CONF[ram] vvmx[numvcpus] = CONF[cpus] end

Projectrsquos directories organization

myproject -- hellip -- vagrant -- Vagrantfile

single git repository

cvmsynced_folder ldquordquordquovarwwwmyproject

myproject -- project --hellip -- vagrant -- Vagrantfile

single git repository

cvmsynced_folder ldquoprojectrdquordquovarwwwprojectrdquo

myproject -- vagrant -- www -- project1 -- project2 -- Vagrantfile

singlemultiple git repositories

cvmsynced_folder ldquowwwrdquordquovarwwwrdquo

vagrant plugin install HostsUpdater

(or HostManager)

etchosts

10101040 host1lo VAGRANT e2bca7c8bf6d76cbcf6ee48998c16f

if Vagranthas_plugin(HostsUpdater) confighostsupdateraliases = [host1lo] else puts --- WARNING --- puts ldquoYou should install HostsUpdaterrdquo end

Multi-VM Configuration

configvmdefine web do |web| webvmnetwork private_network ip 10002 webvmprovider virtualbox do |v| vcustomize [modifyvm id --memory 2048] end webvmsynced_folder ldquovarwww end configvmdefine db do |db| dbvmnetwork private_network ip 10003 dbvmprovision shell path =gt vagrantdbsh end

Dealing with shared folders

no share

native share- slow - os indipendent-ish

nfs- fast - win support -(

rsync- no real share - update

VM Performance

run testshellip

still runninghellip

mitchellhcomcomparing-filesystem-performance-in-virtual-machines

Virtualbox vs VmWare

Virtualbox 22 min

VmWare 15 min

Virtualbox 22 min

VmWare 15 min+30

use VmWare if you can(it will cost you a few $)

use nfs if you can

vagrant plugin install vbguest

keeps guest addition updated

unless Vagranthas_plugin(ldquovagrant-vbguest) raise rdquoplease install vagrant-vbguestrdquo end

On VM IO is the bottleneck

loading webpages running testsuites are READ heavy

move IO outside shared folders

Default provider virtualbox

3 PHP test suites with unit functional integration mix

small (sf1) build runs in ~25 sec

medium (zf2) build runs in ~2 mins

large (sf2) build runs ~ 20 mins

IO logs cache

class AppKernel extends Kernel public function getCacheDir() if (in_array($this-gtenvironment array(dev test))) return devshmappnamecache $this-gtenvironment

return parentgetCacheDir()

public function getLogDir() if (in_array($this-gtenvironment array(dev lsquotest))) return devshmappnamelogs

return parentgetLogDir()

class AppKernel extends Kernel public function getCacheDir() if (in_array($this-gtenvironment array(dev test))) return devshmappnamecache $this-gtenvironment

return parentgetCacheDir()

public function getLogDir() if (in_array($this-gtenvironment array(dev lsquotest))) return devshmappnamelogs

return parentgetLogDir()

+13-16

IO move DB on RAMif you use sqlite move it on devshm

vagrant plugin install vagrantcachier

if Vagranthas_plugin(vagrant-cachier) configcachescope = box

configcachesynced_folder_opts = type nfs mount_options [rwvers=3tcpnolock] end

Vagrantfile

if Vagranthas_plugin(vagrant-cachier) configcachescope = box

configcachesynced_folder_opts = type nfs mount_options [rwvers=3tcpnolock] end

Vagrantfile

+30for reprovisioning a box with git php apache mysql

use cachefilesd for nfs

- name Install cachefilesd apt pkg=cachefilesd state=present

- name Enable cachefilesd lineinfile dest=etcdefaultcachefilesd line=ldquoRUN=yesrdquo

- name Start cachefilesd service service name=cachefilesd state=restarted

configvmsynced_folder varwww id ldquovagrant-rootrdquo type ldquonfsrdquo mount_options [rwvers=3tcpfsc]

Vagrantfile

configvmsynced_folder varwww id ldquovagrant-rootrdquo type ldquonfsrdquo mount_options [rwvers=3tcpfsc]

Vagrantfile

-15+10

should you trust these numbers

Application Management

How to access mysql

- name add mysql user mysql_user name=ideato host= password=ideato priv=ALLGRANT login_user=root login_password=

- name config bind address to allow remote remote connections lineinfile dest=etcmysqlmycnf state=present regexp=bind-address = 127001 line=bind-address = 0000 backup=yes

- name restart mysql service name=mysql state=restarted

Permissions management in shared folders

configvmsynced_folder varwww id vagrant-root owner vagrant group vagrant mount_options [dmode=777fmode=777]

Use host ssh keys

configsshforward_agent = true

ForwardAgent yes

check ssh config file in your host machine

gruntgulp watch

httpwwwsebastien-hanfrblog20121218noac-performance-impact-on-web-applications

configvmsynced_folder varwww id ldquovagrant-rootrdquo type ldquonfsrdquo mount_options [lsquorwrsquovers=3tcpfsc actimeo=1]

Provisioning

to phansible or not to phansible

quick and easy way to start

theyrsquore general

old platforms are not supported

a lot of a good ideas you can steal from

if which(ansible-playbook) configvmprovision ansible do |ansible| ansibleplaybook = ansibleplaybookyml ansibleinventory_path = ansibleinventoriesdev ansiblelimit = all ansibleextra_vars = private_interface 1921683399 hostname default end else configvmprovision shell path ansiblewindowssh args [default] end

can you assume everyone in your team have the same version

if which(ansible-playbook) configvmprovision ansible do |ansible| ansibleplaybook = ansibleplaybookyml ansibleinventory_path = ansibleinventoriesdev ansiblelimit = all ansibleextra_vars = private_interface 1921683399 hostname default end else configvmprovision shell path ansiblewindowssh args [default] end

the provisioning tool is a moving part wanna update be careful

create Vagrant indipendent provision

scripts

configvmprovision shell path =gt scriptsbootstrapsh args =gt varwww

configvmprovision shell path =gt ldquoscriptsprovisionsh args =gt varwww

create your own template

httpsgithubcomideatosrlvagrant-php-template

yoursquore in control of provisioning command

you can perform additional checks on host machine

Distributing VMs

provisioning does not create immutable vm by default

eg package update on LTS

live on the edge and fix provision script

use stable package repositories

httpsspeakerdeckcommitchellhvagrant-usage-patterns

Create and distribute your own VM

Golden image

vagrant package - -name myboxbox

publish it somewhere (http atlas)

cvmbox_url = ldquohttpmyboxboxrdquo

- Donrsquot make assumptions about the host

- Provision first then bake your own image

- The more moving part the harder will get

Keep it simple

Thank you

_orso_

micheleorselli ideatosrl

moideatoit

configvmprovider virtualbox do |vb| vbcustomize [modifyvmid --memory CONF[ram]] vbcustomize [modifyvmid --cpus CONF[cpus]] end configvmprovider vmware_fusion do |v| vvmx[memsize] = CONF[ram] vvmx[numvcpus] = CONF[cpus] end

Projectrsquos directories organization

myproject -- hellip -- vagrant -- Vagrantfile

single git repository

cvmsynced_folder ldquordquordquovarwwwmyproject

myproject -- project --hellip -- vagrant -- Vagrantfile

single git repository

cvmsynced_folder ldquoprojectrdquordquovarwwwprojectrdquo

myproject -- vagrant -- www -- project1 -- project2 -- Vagrantfile

singlemultiple git repositories

cvmsynced_folder ldquowwwrdquordquovarwwwrdquo

vagrant plugin install HostsUpdater

(or HostManager)

etchosts

10101040 host1lo VAGRANT e2bca7c8bf6d76cbcf6ee48998c16f

if Vagranthas_plugin(HostsUpdater) confighostsupdateraliases = [host1lo] else puts --- WARNING --- puts ldquoYou should install HostsUpdaterrdquo end

Multi-VM Configuration

configvmdefine web do |web| webvmnetwork private_network ip 10002 webvmprovider virtualbox do |v| vcustomize [modifyvm id --memory 2048] end webvmsynced_folder ldquovarwww end configvmdefine db do |db| dbvmnetwork private_network ip 10003 dbvmprovision shell path =gt vagrantdbsh end

Dealing with shared folders

no share

native share- slow - os indipendent-ish

nfs- fast - win support -(

rsync- no real share - update

VM Performance

run testshellip

still runninghellip

mitchellhcomcomparing-filesystem-performance-in-virtual-machines

Virtualbox vs VmWare

Virtualbox 22 min

VmWare 15 min

Virtualbox 22 min

VmWare 15 min+30

use VmWare if you can(it will cost you a few $)

use nfs if you can

vagrant plugin install vbguest

keeps guest addition updated

unless Vagranthas_plugin(ldquovagrant-vbguest) raise rdquoplease install vagrant-vbguestrdquo end

On VM IO is the bottleneck

loading webpages running testsuites are READ heavy

move IO outside shared folders

Default provider virtualbox

3 PHP test suites with unit functional integration mix

small (sf1) build runs in ~25 sec

medium (zf2) build runs in ~2 mins

large (sf2) build runs ~ 20 mins

IO logs cache

class AppKernel extends Kernel public function getCacheDir() if (in_array($this-gtenvironment array(dev test))) return devshmappnamecache $this-gtenvironment

return parentgetCacheDir()

public function getLogDir() if (in_array($this-gtenvironment array(dev lsquotest))) return devshmappnamelogs

return parentgetLogDir()

class AppKernel extends Kernel public function getCacheDir() if (in_array($this-gtenvironment array(dev test))) return devshmappnamecache $this-gtenvironment

return parentgetCacheDir()

public function getLogDir() if (in_array($this-gtenvironment array(dev lsquotest))) return devshmappnamelogs

return parentgetLogDir()

+13-16

IO move DB on RAMif you use sqlite move it on devshm

vagrant plugin install vagrantcachier

if Vagranthas_plugin(vagrant-cachier) configcachescope = box

configcachesynced_folder_opts = type nfs mount_options [rwvers=3tcpnolock] end

Vagrantfile

if Vagranthas_plugin(vagrant-cachier) configcachescope = box

configcachesynced_folder_opts = type nfs mount_options [rwvers=3tcpnolock] end

Vagrantfile

+30for reprovisioning a box with git php apache mysql

use cachefilesd for nfs

- name Install cachefilesd apt pkg=cachefilesd state=present

- name Enable cachefilesd lineinfile dest=etcdefaultcachefilesd line=ldquoRUN=yesrdquo

- name Start cachefilesd service service name=cachefilesd state=restarted

configvmsynced_folder varwww id ldquovagrant-rootrdquo type ldquonfsrdquo mount_options [rwvers=3tcpfsc]

Vagrantfile

configvmsynced_folder varwww id ldquovagrant-rootrdquo type ldquonfsrdquo mount_options [rwvers=3tcpfsc]

Vagrantfile

-15+10

should you trust these numbers

Application Management

How to access mysql

- name add mysql user mysql_user name=ideato host= password=ideato priv=ALLGRANT login_user=root login_password=

- name config bind address to allow remote remote connections lineinfile dest=etcmysqlmycnf state=present regexp=bind-address = 127001 line=bind-address = 0000 backup=yes

- name restart mysql service name=mysql state=restarted

Permissions management in shared folders

configvmsynced_folder varwww id vagrant-root owner vagrant group vagrant mount_options [dmode=777fmode=777]

Use host ssh keys

configsshforward_agent = true

ForwardAgent yes

check ssh config file in your host machine

gruntgulp watch

httpwwwsebastien-hanfrblog20121218noac-performance-impact-on-web-applications

configvmsynced_folder varwww id ldquovagrant-rootrdquo type ldquonfsrdquo mount_options [lsquorwrsquovers=3tcpfsc actimeo=1]

Provisioning

to phansible or not to phansible

quick and easy way to start

theyrsquore general

old platforms are not supported

a lot of a good ideas you can steal from

if which(ansible-playbook) configvmprovision ansible do |ansible| ansibleplaybook = ansibleplaybookyml ansibleinventory_path = ansibleinventoriesdev ansiblelimit = all ansibleextra_vars = private_interface 1921683399 hostname default end else configvmprovision shell path ansiblewindowssh args [default] end

can you assume everyone in your team have the same version

if which(ansible-playbook) configvmprovision ansible do |ansible| ansibleplaybook = ansibleplaybookyml ansibleinventory_path = ansibleinventoriesdev ansiblelimit = all ansibleextra_vars = private_interface 1921683399 hostname default end else configvmprovision shell path ansiblewindowssh args [default] end

the provisioning tool is a moving part wanna update be careful

create Vagrant indipendent provision

scripts

configvmprovision shell path =gt scriptsbootstrapsh args =gt varwww

configvmprovision shell path =gt ldquoscriptsprovisionsh args =gt varwww

create your own template

httpsgithubcomideatosrlvagrant-php-template

yoursquore in control of provisioning command

you can perform additional checks on host machine

Distributing VMs

provisioning does not create immutable vm by default

eg package update on LTS

live on the edge and fix provision script

use stable package repositories

httpsspeakerdeckcommitchellhvagrant-usage-patterns

Create and distribute your own VM

Golden image

vagrant package - -name myboxbox

publish it somewhere (http atlas)

cvmbox_url = ldquohttpmyboxboxrdquo

- Donrsquot make assumptions about the host

- Provision first then bake your own image

- The more moving part the harder will get

Keep it simple

Thank you

_orso_

micheleorselli ideatosrl

moideatoit

Projectrsquos directories organization

myproject -- hellip -- vagrant -- Vagrantfile

single git repository

cvmsynced_folder ldquordquordquovarwwwmyproject

myproject -- project --hellip -- vagrant -- Vagrantfile

single git repository

cvmsynced_folder ldquoprojectrdquordquovarwwwprojectrdquo

myproject -- vagrant -- www -- project1 -- project2 -- Vagrantfile

singlemultiple git repositories

cvmsynced_folder ldquowwwrdquordquovarwwwrdquo

vagrant plugin install HostsUpdater

(or HostManager)

etchosts

10101040 host1lo VAGRANT e2bca7c8bf6d76cbcf6ee48998c16f

if Vagranthas_plugin(HostsUpdater) confighostsupdateraliases = [host1lo] else puts --- WARNING --- puts ldquoYou should install HostsUpdaterrdquo end

Multi-VM Configuration

configvmdefine web do |web| webvmnetwork private_network ip 10002 webvmprovider virtualbox do |v| vcustomize [modifyvm id --memory 2048] end webvmsynced_folder ldquovarwww end configvmdefine db do |db| dbvmnetwork private_network ip 10003 dbvmprovision shell path =gt vagrantdbsh end

Dealing with shared folders

no share

native share- slow - os indipendent-ish

nfs- fast - win support -(

rsync- no real share - update

VM Performance

run testshellip

still runninghellip

mitchellhcomcomparing-filesystem-performance-in-virtual-machines

Virtualbox vs VmWare

Virtualbox 22 min

VmWare 15 min

Virtualbox 22 min

VmWare 15 min+30

use VmWare if you can(it will cost you a few $)

use nfs if you can

vagrant plugin install vbguest

keeps guest addition updated

unless Vagranthas_plugin(ldquovagrant-vbguest) raise rdquoplease install vagrant-vbguestrdquo end

On VM IO is the bottleneck

loading webpages running testsuites are READ heavy

move IO outside shared folders

Default provider virtualbox

3 PHP test suites with unit functional integration mix

small (sf1) build runs in ~25 sec

medium (zf2) build runs in ~2 mins

large (sf2) build runs ~ 20 mins

IO logs cache

class AppKernel extends Kernel public function getCacheDir() if (in_array($this-gtenvironment array(dev test))) return devshmappnamecache $this-gtenvironment

return parentgetCacheDir()

public function getLogDir() if (in_array($this-gtenvironment array(dev lsquotest))) return devshmappnamelogs

return parentgetLogDir()

class AppKernel extends Kernel public function getCacheDir() if (in_array($this-gtenvironment array(dev test))) return devshmappnamecache $this-gtenvironment

return parentgetCacheDir()

public function getLogDir() if (in_array($this-gtenvironment array(dev lsquotest))) return devshmappnamelogs

return parentgetLogDir()

+13-16

IO move DB on RAMif you use sqlite move it on devshm

vagrant plugin install vagrantcachier

if Vagranthas_plugin(vagrant-cachier) configcachescope = box

configcachesynced_folder_opts = type nfs mount_options [rwvers=3tcpnolock] end

Vagrantfile

if Vagranthas_plugin(vagrant-cachier) configcachescope = box

configcachesynced_folder_opts = type nfs mount_options [rwvers=3tcpnolock] end

Vagrantfile

+30for reprovisioning a box with git php apache mysql

use cachefilesd for nfs

- name Install cachefilesd apt pkg=cachefilesd state=present

- name Enable cachefilesd lineinfile dest=etcdefaultcachefilesd line=ldquoRUN=yesrdquo

- name Start cachefilesd service service name=cachefilesd state=restarted

configvmsynced_folder varwww id ldquovagrant-rootrdquo type ldquonfsrdquo mount_options [rwvers=3tcpfsc]

Vagrantfile

configvmsynced_folder varwww id ldquovagrant-rootrdquo type ldquonfsrdquo mount_options [rwvers=3tcpfsc]

Vagrantfile

-15+10

should you trust these numbers

Application Management

How to access mysql

- name add mysql user mysql_user name=ideato host= password=ideato priv=ALLGRANT login_user=root login_password=

- name config bind address to allow remote remote connections lineinfile dest=etcmysqlmycnf state=present regexp=bind-address = 127001 line=bind-address = 0000 backup=yes

- name restart mysql service name=mysql state=restarted

Permissions management in shared folders

configvmsynced_folder varwww id vagrant-root owner vagrant group vagrant mount_options [dmode=777fmode=777]

Use host ssh keys

configsshforward_agent = true

ForwardAgent yes

check ssh config file in your host machine

gruntgulp watch

httpwwwsebastien-hanfrblog20121218noac-performance-impact-on-web-applications

configvmsynced_folder varwww id ldquovagrant-rootrdquo type ldquonfsrdquo mount_options [lsquorwrsquovers=3tcpfsc actimeo=1]

Provisioning

to phansible or not to phansible

quick and easy way to start

theyrsquore general

old platforms are not supported

a lot of a good ideas you can steal from

if which(ansible-playbook) configvmprovision ansible do |ansible| ansibleplaybook = ansibleplaybookyml ansibleinventory_path = ansibleinventoriesdev ansiblelimit = all ansibleextra_vars = private_interface 1921683399 hostname default end else configvmprovision shell path ansiblewindowssh args [default] end

can you assume everyone in your team have the same version

if which(ansible-playbook) configvmprovision ansible do |ansible| ansibleplaybook = ansibleplaybookyml ansibleinventory_path = ansibleinventoriesdev ansiblelimit = all ansibleextra_vars = private_interface 1921683399 hostname default end else configvmprovision shell path ansiblewindowssh args [default] end

the provisioning tool is a moving part wanna update be careful

create Vagrant indipendent provision

scripts

configvmprovision shell path =gt scriptsbootstrapsh args =gt varwww

configvmprovision shell path =gt ldquoscriptsprovisionsh args =gt varwww

create your own template

httpsgithubcomideatosrlvagrant-php-template

yoursquore in control of provisioning command

you can perform additional checks on host machine

Distributing VMs

provisioning does not create immutable vm by default

eg package update on LTS

live on the edge and fix provision script

use stable package repositories

httpsspeakerdeckcommitchellhvagrant-usage-patterns

Create and distribute your own VM

Golden image

vagrant package - -name myboxbox

publish it somewhere (http atlas)

cvmbox_url = ldquohttpmyboxboxrdquo

- Donrsquot make assumptions about the host

- Provision first then bake your own image

- The more moving part the harder will get

Keep it simple

Thank you

_orso_

micheleorselli ideatosrl

moideatoit

myproject -- hellip -- vagrant -- Vagrantfile

single git repository

cvmsynced_folder ldquordquordquovarwwwmyproject

myproject -- project --hellip -- vagrant -- Vagrantfile

single git repository

cvmsynced_folder ldquoprojectrdquordquovarwwwprojectrdquo

myproject -- vagrant -- www -- project1 -- project2 -- Vagrantfile

singlemultiple git repositories

cvmsynced_folder ldquowwwrdquordquovarwwwrdquo

vagrant plugin install HostsUpdater

(or HostManager)

etchosts

10101040 host1lo VAGRANT e2bca7c8bf6d76cbcf6ee48998c16f

if Vagranthas_plugin(HostsUpdater) confighostsupdateraliases = [host1lo] else puts --- WARNING --- puts ldquoYou should install HostsUpdaterrdquo end

Multi-VM Configuration

configvmdefine web do |web| webvmnetwork private_network ip 10002 webvmprovider virtualbox do |v| vcustomize [modifyvm id --memory 2048] end webvmsynced_folder ldquovarwww end configvmdefine db do |db| dbvmnetwork private_network ip 10003 dbvmprovision shell path =gt vagrantdbsh end

Dealing with shared folders

no share

native share- slow - os indipendent-ish

nfs- fast - win support -(

rsync- no real share - update

VM Performance

run testshellip

still runninghellip

mitchellhcomcomparing-filesystem-performance-in-virtual-machines

Virtualbox vs VmWare

Virtualbox 22 min

VmWare 15 min

Virtualbox 22 min

VmWare 15 min+30

use VmWare if you can(it will cost you a few $)

use nfs if you can

vagrant plugin install vbguest

keeps guest addition updated

unless Vagranthas_plugin(ldquovagrant-vbguest) raise rdquoplease install vagrant-vbguestrdquo end

On VM IO is the bottleneck

loading webpages running testsuites are READ heavy

move IO outside shared folders

Default provider virtualbox

3 PHP test suites with unit functional integration mix

small (sf1) build runs in ~25 sec

medium (zf2) build runs in ~2 mins

large (sf2) build runs ~ 20 mins

IO logs cache

class AppKernel extends Kernel public function getCacheDir() if (in_array($this-gtenvironment array(dev test))) return devshmappnamecache $this-gtenvironment

return parentgetCacheDir()

public function getLogDir() if (in_array($this-gtenvironment array(dev lsquotest))) return devshmappnamelogs

return parentgetLogDir()

class AppKernel extends Kernel public function getCacheDir() if (in_array($this-gtenvironment array(dev test))) return devshmappnamecache $this-gtenvironment

return parentgetCacheDir()

public function getLogDir() if (in_array($this-gtenvironment array(dev lsquotest))) return devshmappnamelogs

return parentgetLogDir()

+13-16

IO move DB on RAMif you use sqlite move it on devshm

vagrant plugin install vagrantcachier

if Vagranthas_plugin(vagrant-cachier) configcachescope = box

configcachesynced_folder_opts = type nfs mount_options [rwvers=3tcpnolock] end

Vagrantfile

if Vagranthas_plugin(vagrant-cachier) configcachescope = box

configcachesynced_folder_opts = type nfs mount_options [rwvers=3tcpnolock] end

Vagrantfile

+30for reprovisioning a box with git php apache mysql

use cachefilesd for nfs

- name Install cachefilesd apt pkg=cachefilesd state=present

- name Enable cachefilesd lineinfile dest=etcdefaultcachefilesd line=ldquoRUN=yesrdquo

- name Start cachefilesd service service name=cachefilesd state=restarted

configvmsynced_folder varwww id ldquovagrant-rootrdquo type ldquonfsrdquo mount_options [rwvers=3tcpfsc]

Vagrantfile

configvmsynced_folder varwww id ldquovagrant-rootrdquo type ldquonfsrdquo mount_options [rwvers=3tcpfsc]

Vagrantfile

-15+10

should you trust these numbers

Application Management

How to access mysql

- name add mysql user mysql_user name=ideato host= password=ideato priv=ALLGRANT login_user=root login_password=

- name config bind address to allow remote remote connections lineinfile dest=etcmysqlmycnf state=present regexp=bind-address = 127001 line=bind-address = 0000 backup=yes

- name restart mysql service name=mysql state=restarted

Permissions management in shared folders

configvmsynced_folder varwww id vagrant-root owner vagrant group vagrant mount_options [dmode=777fmode=777]

Use host ssh keys

configsshforward_agent = true

ForwardAgent yes

check ssh config file in your host machine

gruntgulp watch

httpwwwsebastien-hanfrblog20121218noac-performance-impact-on-web-applications

configvmsynced_folder varwww id ldquovagrant-rootrdquo type ldquonfsrdquo mount_options [lsquorwrsquovers=3tcpfsc actimeo=1]

Provisioning

to phansible or not to phansible

quick and easy way to start

theyrsquore general

old platforms are not supported

a lot of a good ideas you can steal from

if which(ansible-playbook) configvmprovision ansible do |ansible| ansibleplaybook = ansibleplaybookyml ansibleinventory_path = ansibleinventoriesdev ansiblelimit = all ansibleextra_vars = private_interface 1921683399 hostname default end else configvmprovision shell path ansiblewindowssh args [default] end

can you assume everyone in your team have the same version

if which(ansible-playbook) configvmprovision ansible do |ansible| ansibleplaybook = ansibleplaybookyml ansibleinventory_path = ansibleinventoriesdev ansiblelimit = all ansibleextra_vars = private_interface 1921683399 hostname default end else configvmprovision shell path ansiblewindowssh args [default] end

the provisioning tool is a moving part wanna update be careful

create Vagrant indipendent provision

scripts

configvmprovision shell path =gt scriptsbootstrapsh args =gt varwww

configvmprovision shell path =gt ldquoscriptsprovisionsh args =gt varwww

create your own template

httpsgithubcomideatosrlvagrant-php-template

yoursquore in control of provisioning command

you can perform additional checks on host machine

Distributing VMs

provisioning does not create immutable vm by default

eg package update on LTS

live on the edge and fix provision script

use stable package repositories

httpsspeakerdeckcommitchellhvagrant-usage-patterns

Create and distribute your own VM

Golden image

vagrant package - -name myboxbox

publish it somewhere (http atlas)

cvmbox_url = ldquohttpmyboxboxrdquo

- Donrsquot make assumptions about the host

- Provision first then bake your own image

- The more moving part the harder will get

Keep it simple

Thank you

_orso_

micheleorselli ideatosrl

moideatoit

myproject -- project --hellip -- vagrant -- Vagrantfile

single git repository

cvmsynced_folder ldquoprojectrdquordquovarwwwprojectrdquo

myproject -- vagrant -- www -- project1 -- project2 -- Vagrantfile

singlemultiple git repositories

cvmsynced_folder ldquowwwrdquordquovarwwwrdquo

vagrant plugin install HostsUpdater

(or HostManager)

etchosts

10101040 host1lo VAGRANT e2bca7c8bf6d76cbcf6ee48998c16f

if Vagranthas_plugin(HostsUpdater) confighostsupdateraliases = [host1lo] else puts --- WARNING --- puts ldquoYou should install HostsUpdaterrdquo end

Multi-VM Configuration

configvmdefine web do |web| webvmnetwork private_network ip 10002 webvmprovider virtualbox do |v| vcustomize [modifyvm id --memory 2048] end webvmsynced_folder ldquovarwww end configvmdefine db do |db| dbvmnetwork private_network ip 10003 dbvmprovision shell path =gt vagrantdbsh end

Dealing with shared folders

no share

native share- slow - os indipendent-ish

nfs- fast - win support -(

rsync- no real share - update

VM Performance

run testshellip

still runninghellip

mitchellhcomcomparing-filesystem-performance-in-virtual-machines

Virtualbox vs VmWare

Virtualbox 22 min

VmWare 15 min

Virtualbox 22 min

VmWare 15 min+30

use VmWare if you can(it will cost you a few $)

use nfs if you can

vagrant plugin install vbguest

keeps guest addition updated

unless Vagranthas_plugin(ldquovagrant-vbguest) raise rdquoplease install vagrant-vbguestrdquo end

On VM IO is the bottleneck

loading webpages running testsuites are READ heavy

move IO outside shared folders

Default provider virtualbox

3 PHP test suites with unit functional integration mix

small (sf1) build runs in ~25 sec

medium (zf2) build runs in ~2 mins

large (sf2) build runs ~ 20 mins

IO logs cache

class AppKernel extends Kernel public function getCacheDir() if (in_array($this-gtenvironment array(dev test))) return devshmappnamecache $this-gtenvironment

return parentgetCacheDir()

public function getLogDir() if (in_array($this-gtenvironment array(dev lsquotest))) return devshmappnamelogs

return parentgetLogDir()

class AppKernel extends Kernel public function getCacheDir() if (in_array($this-gtenvironment array(dev test))) return devshmappnamecache $this-gtenvironment

return parentgetCacheDir()

public function getLogDir() if (in_array($this-gtenvironment array(dev lsquotest))) return devshmappnamelogs

return parentgetLogDir()

+13-16

IO move DB on RAMif you use sqlite move it on devshm

vagrant plugin install vagrantcachier

if Vagranthas_plugin(vagrant-cachier) configcachescope = box

configcachesynced_folder_opts = type nfs mount_options [rwvers=3tcpnolock] end

Vagrantfile

if Vagranthas_plugin(vagrant-cachier) configcachescope = box

configcachesynced_folder_opts = type nfs mount_options [rwvers=3tcpnolock] end

Vagrantfile

+30for reprovisioning a box with git php apache mysql

use cachefilesd for nfs

- name Install cachefilesd apt pkg=cachefilesd state=present

- name Enable cachefilesd lineinfile dest=etcdefaultcachefilesd line=ldquoRUN=yesrdquo

- name Start cachefilesd service service name=cachefilesd state=restarted

configvmsynced_folder varwww id ldquovagrant-rootrdquo type ldquonfsrdquo mount_options [rwvers=3tcpfsc]

Vagrantfile

configvmsynced_folder varwww id ldquovagrant-rootrdquo type ldquonfsrdquo mount_options [rwvers=3tcpfsc]

Vagrantfile

-15+10

should you trust these numbers

Application Management

How to access mysql

- name add mysql user mysql_user name=ideato host= password=ideato priv=ALLGRANT login_user=root login_password=

- name config bind address to allow remote remote connections lineinfile dest=etcmysqlmycnf state=present regexp=bind-address = 127001 line=bind-address = 0000 backup=yes

- name restart mysql service name=mysql state=restarted

Permissions management in shared folders

configvmsynced_folder varwww id vagrant-root owner vagrant group vagrant mount_options [dmode=777fmode=777]

Use host ssh keys

configsshforward_agent = true

ForwardAgent yes

check ssh config file in your host machine

gruntgulp watch

httpwwwsebastien-hanfrblog20121218noac-performance-impact-on-web-applications

configvmsynced_folder varwww id ldquovagrant-rootrdquo type ldquonfsrdquo mount_options [lsquorwrsquovers=3tcpfsc actimeo=1]

Provisioning

to phansible or not to phansible

quick and easy way to start

theyrsquore general

old platforms are not supported

a lot of a good ideas you can steal from

if which(ansible-playbook) configvmprovision ansible do |ansible| ansibleplaybook = ansibleplaybookyml ansibleinventory_path = ansibleinventoriesdev ansiblelimit = all ansibleextra_vars = private_interface 1921683399 hostname default end else configvmprovision shell path ansiblewindowssh args [default] end

can you assume everyone in your team have the same version

if which(ansible-playbook) configvmprovision ansible do |ansible| ansibleplaybook = ansibleplaybookyml ansibleinventory_path = ansibleinventoriesdev ansiblelimit = all ansibleextra_vars = private_interface 1921683399 hostname default end else configvmprovision shell path ansiblewindowssh args [default] end

the provisioning tool is a moving part wanna update be careful

create Vagrant indipendent provision

scripts

configvmprovision shell path =gt scriptsbootstrapsh args =gt varwww

configvmprovision shell path =gt ldquoscriptsprovisionsh args =gt varwww

create your own template

httpsgithubcomideatosrlvagrant-php-template

yoursquore in control of provisioning command

you can perform additional checks on host machine

Distributing VMs

provisioning does not create immutable vm by default

eg package update on LTS

live on the edge and fix provision script

use stable package repositories

httpsspeakerdeckcommitchellhvagrant-usage-patterns

Create and distribute your own VM

Golden image

vagrant package - -name myboxbox

publish it somewhere (http atlas)

cvmbox_url = ldquohttpmyboxboxrdquo

- Donrsquot make assumptions about the host

- Provision first then bake your own image

- The more moving part the harder will get

Keep it simple

Thank you

_orso_

micheleorselli ideatosrl

moideatoit

myproject -- vagrant -- www -- project1 -- project2 -- Vagrantfile

singlemultiple git repositories

cvmsynced_folder ldquowwwrdquordquovarwwwrdquo

vagrant plugin install HostsUpdater

(or HostManager)

etchosts

10101040 host1lo VAGRANT e2bca7c8bf6d76cbcf6ee48998c16f

if Vagranthas_plugin(HostsUpdater) confighostsupdateraliases = [host1lo] else puts --- WARNING --- puts ldquoYou should install HostsUpdaterrdquo end

Multi-VM Configuration

configvmdefine web do |web| webvmnetwork private_network ip 10002 webvmprovider virtualbox do |v| vcustomize [modifyvm id --memory 2048] end webvmsynced_folder ldquovarwww end configvmdefine db do |db| dbvmnetwork private_network ip 10003 dbvmprovision shell path =gt vagrantdbsh end

Dealing with shared folders

no share

native share- slow - os indipendent-ish

nfs- fast - win support -(

rsync- no real share - update

VM Performance

run testshellip

still runninghellip

mitchellhcomcomparing-filesystem-performance-in-virtual-machines

Virtualbox vs VmWare

Virtualbox 22 min

VmWare 15 min

Virtualbox 22 min

VmWare 15 min+30

use VmWare if you can(it will cost you a few $)

use nfs if you can

vagrant plugin install vbguest

keeps guest addition updated

unless Vagranthas_plugin(ldquovagrant-vbguest) raise rdquoplease install vagrant-vbguestrdquo end

On VM IO is the bottleneck

loading webpages running testsuites are READ heavy

move IO outside shared folders

Default provider virtualbox

3 PHP test suites with unit functional integration mix

small (sf1) build runs in ~25 sec

medium (zf2) build runs in ~2 mins

large (sf2) build runs ~ 20 mins

IO logs cache

class AppKernel extends Kernel public function getCacheDir() if (in_array($this-gtenvironment array(dev test))) return devshmappnamecache $this-gtenvironment

return parentgetCacheDir()

public function getLogDir() if (in_array($this-gtenvironment array(dev lsquotest))) return devshmappnamelogs

return parentgetLogDir()

class AppKernel extends Kernel public function getCacheDir() if (in_array($this-gtenvironment array(dev test))) return devshmappnamecache $this-gtenvironment

return parentgetCacheDir()

public function getLogDir() if (in_array($this-gtenvironment array(dev lsquotest))) return devshmappnamelogs

return parentgetLogDir()

+13-16

IO move DB on RAMif you use sqlite move it on devshm

vagrant plugin install vagrantcachier

if Vagranthas_plugin(vagrant-cachier) configcachescope = box

configcachesynced_folder_opts = type nfs mount_options [rwvers=3tcpnolock] end

Vagrantfile

if Vagranthas_plugin(vagrant-cachier) configcachescope = box

configcachesynced_folder_opts = type nfs mount_options [rwvers=3tcpnolock] end

Vagrantfile

+30for reprovisioning a box with git php apache mysql

use cachefilesd for nfs

- name Install cachefilesd apt pkg=cachefilesd state=present

- name Enable cachefilesd lineinfile dest=etcdefaultcachefilesd line=ldquoRUN=yesrdquo

- name Start cachefilesd service service name=cachefilesd state=restarted

configvmsynced_folder varwww id ldquovagrant-rootrdquo type ldquonfsrdquo mount_options [rwvers=3tcpfsc]

Vagrantfile

configvmsynced_folder varwww id ldquovagrant-rootrdquo type ldquonfsrdquo mount_options [rwvers=3tcpfsc]

Vagrantfile

-15+10

should you trust these numbers

Application Management

How to access mysql

- name add mysql user mysql_user name=ideato host= password=ideato priv=ALLGRANT login_user=root login_password=

- name config bind address to allow remote remote connections lineinfile dest=etcmysqlmycnf state=present regexp=bind-address = 127001 line=bind-address = 0000 backup=yes

- name restart mysql service name=mysql state=restarted

Permissions management in shared folders

configvmsynced_folder varwww id vagrant-root owner vagrant group vagrant mount_options [dmode=777fmode=777]

Use host ssh keys

configsshforward_agent = true

ForwardAgent yes

check ssh config file in your host machine

gruntgulp watch

httpwwwsebastien-hanfrblog20121218noac-performance-impact-on-web-applications

configvmsynced_folder varwww id ldquovagrant-rootrdquo type ldquonfsrdquo mount_options [lsquorwrsquovers=3tcpfsc actimeo=1]

Provisioning

to phansible or not to phansible

quick and easy way to start

theyrsquore general

old platforms are not supported

a lot of a good ideas you can steal from

if which(ansible-playbook) configvmprovision ansible do |ansible| ansibleplaybook = ansibleplaybookyml ansibleinventory_path = ansibleinventoriesdev ansiblelimit = all ansibleextra_vars = private_interface 1921683399 hostname default end else configvmprovision shell path ansiblewindowssh args [default] end

can you assume everyone in your team have the same version

if which(ansible-playbook) configvmprovision ansible do |ansible| ansibleplaybook = ansibleplaybookyml ansibleinventory_path = ansibleinventoriesdev ansiblelimit = all ansibleextra_vars = private_interface 1921683399 hostname default end else configvmprovision shell path ansiblewindowssh args [default] end

the provisioning tool is a moving part wanna update be careful

create Vagrant indipendent provision

scripts

configvmprovision shell path =gt scriptsbootstrapsh args =gt varwww

configvmprovision shell path =gt ldquoscriptsprovisionsh args =gt varwww

create your own template

httpsgithubcomideatosrlvagrant-php-template

yoursquore in control of provisioning command

you can perform additional checks on host machine

Distributing VMs

provisioning does not create immutable vm by default

eg package update on LTS

live on the edge and fix provision script

use stable package repositories

httpsspeakerdeckcommitchellhvagrant-usage-patterns

Create and distribute your own VM

Golden image

vagrant package - -name myboxbox

publish it somewhere (http atlas)

cvmbox_url = ldquohttpmyboxboxrdquo

- Donrsquot make assumptions about the host

- Provision first then bake your own image

- The more moving part the harder will get

Keep it simple

Thank you

_orso_

micheleorselli ideatosrl

moideatoit

vagrant plugin install HostsUpdater

(or HostManager)

etchosts

10101040 host1lo VAGRANT e2bca7c8bf6d76cbcf6ee48998c16f

if Vagranthas_plugin(HostsUpdater) confighostsupdateraliases = [host1lo] else puts --- WARNING --- puts ldquoYou should install HostsUpdaterrdquo end

Multi-VM Configuration

configvmdefine web do |web| webvmnetwork private_network ip 10002 webvmprovider virtualbox do |v| vcustomize [modifyvm id --memory 2048] end webvmsynced_folder ldquovarwww end configvmdefine db do |db| dbvmnetwork private_network ip 10003 dbvmprovision shell path =gt vagrantdbsh end

Dealing with shared folders

no share

native share- slow - os indipendent-ish

nfs- fast - win support -(

rsync- no real share - update

VM Performance

run testshellip

still runninghellip

mitchellhcomcomparing-filesystem-performance-in-virtual-machines

Virtualbox vs VmWare

Virtualbox 22 min

VmWare 15 min

Virtualbox 22 min

VmWare 15 min+30

use VmWare if you can(it will cost you a few $)

use nfs if you can

vagrant plugin install vbguest

keeps guest addition updated

unless Vagranthas_plugin(ldquovagrant-vbguest) raise rdquoplease install vagrant-vbguestrdquo end

On VM IO is the bottleneck

loading webpages running testsuites are READ heavy

move IO outside shared folders

Default provider virtualbox

3 PHP test suites with unit functional integration mix

small (sf1) build runs in ~25 sec

medium (zf2) build runs in ~2 mins

large (sf2) build runs ~ 20 mins

IO logs cache

class AppKernel extends Kernel public function getCacheDir() if (in_array($this-gtenvironment array(dev test))) return devshmappnamecache $this-gtenvironment

return parentgetCacheDir()

public function getLogDir() if (in_array($this-gtenvironment array(dev lsquotest))) return devshmappnamelogs

return parentgetLogDir()

class AppKernel extends Kernel public function getCacheDir() if (in_array($this-gtenvironment array(dev test))) return devshmappnamecache $this-gtenvironment

return parentgetCacheDir()

public function getLogDir() if (in_array($this-gtenvironment array(dev lsquotest))) return devshmappnamelogs

return parentgetLogDir()

+13-16

IO move DB on RAMif you use sqlite move it on devshm

vagrant plugin install vagrantcachier

if Vagranthas_plugin(vagrant-cachier) configcachescope = box

configcachesynced_folder_opts = type nfs mount_options [rwvers=3tcpnolock] end

Vagrantfile

if Vagranthas_plugin(vagrant-cachier) configcachescope = box

configcachesynced_folder_opts = type nfs mount_options [rwvers=3tcpnolock] end

Vagrantfile

+30for reprovisioning a box with git php apache mysql

use cachefilesd for nfs

- name Install cachefilesd apt pkg=cachefilesd state=present

- name Enable cachefilesd lineinfile dest=etcdefaultcachefilesd line=ldquoRUN=yesrdquo

- name Start cachefilesd service service name=cachefilesd state=restarted

configvmsynced_folder varwww id ldquovagrant-rootrdquo type ldquonfsrdquo mount_options [rwvers=3tcpfsc]

Vagrantfile

configvmsynced_folder varwww id ldquovagrant-rootrdquo type ldquonfsrdquo mount_options [rwvers=3tcpfsc]

Vagrantfile

-15+10

should you trust these numbers

Application Management

How to access mysql

- name add mysql user mysql_user name=ideato host= password=ideato priv=ALLGRANT login_user=root login_password=

- name config bind address to allow remote remote connections lineinfile dest=etcmysqlmycnf state=present regexp=bind-address = 127001 line=bind-address = 0000 backup=yes

- name restart mysql service name=mysql state=restarted

Permissions management in shared folders

configvmsynced_folder varwww id vagrant-root owner vagrant group vagrant mount_options [dmode=777fmode=777]

Use host ssh keys

configsshforward_agent = true

ForwardAgent yes

check ssh config file in your host machine

gruntgulp watch

httpwwwsebastien-hanfrblog20121218noac-performance-impact-on-web-applications

configvmsynced_folder varwww id ldquovagrant-rootrdquo type ldquonfsrdquo mount_options [lsquorwrsquovers=3tcpfsc actimeo=1]

Provisioning

to phansible or not to phansible

quick and easy way to start

theyrsquore general

old platforms are not supported

a lot of a good ideas you can steal from

if which(ansible-playbook) configvmprovision ansible do |ansible| ansibleplaybook = ansibleplaybookyml ansibleinventory_path = ansibleinventoriesdev ansiblelimit = all ansibleextra_vars = private_interface 1921683399 hostname default end else configvmprovision shell path ansiblewindowssh args [default] end

can you assume everyone in your team have the same version

if which(ansible-playbook) configvmprovision ansible do |ansible| ansibleplaybook = ansibleplaybookyml ansibleinventory_path = ansibleinventoriesdev ansiblelimit = all ansibleextra_vars = private_interface 1921683399 hostname default end else configvmprovision shell path ansiblewindowssh args [default] end

the provisioning tool is a moving part wanna update be careful

create Vagrant indipendent provision

scripts

configvmprovision shell path =gt scriptsbootstrapsh args =gt varwww

configvmprovision shell path =gt ldquoscriptsprovisionsh args =gt varwww

create your own template

httpsgithubcomideatosrlvagrant-php-template

yoursquore in control of provisioning command

you can perform additional checks on host machine

Distributing VMs

provisioning does not create immutable vm by default

eg package update on LTS

live on the edge and fix provision script

use stable package repositories

httpsspeakerdeckcommitchellhvagrant-usage-patterns

Create and distribute your own VM

Golden image

vagrant package - -name myboxbox

publish it somewhere (http atlas)

cvmbox_url = ldquohttpmyboxboxrdquo

- Donrsquot make assumptions about the host

- Provision first then bake your own image

- The more moving part the harder will get

Keep it simple

Thank you

_orso_

micheleorselli ideatosrl

moideatoit

etchosts

10101040 host1lo VAGRANT e2bca7c8bf6d76cbcf6ee48998c16f

if Vagranthas_plugin(HostsUpdater) confighostsupdateraliases = [host1lo] else puts --- WARNING --- puts ldquoYou should install HostsUpdaterrdquo end

Multi-VM Configuration

configvmdefine web do |web| webvmnetwork private_network ip 10002 webvmprovider virtualbox do |v| vcustomize [modifyvm id --memory 2048] end webvmsynced_folder ldquovarwww end configvmdefine db do |db| dbvmnetwork private_network ip 10003 dbvmprovision shell path =gt vagrantdbsh end

Dealing with shared folders

no share

native share- slow - os indipendent-ish

nfs- fast - win support -(

rsync- no real share - update

VM Performance

run testshellip

still runninghellip

mitchellhcomcomparing-filesystem-performance-in-virtual-machines

Virtualbox vs VmWare

Virtualbox 22 min

VmWare 15 min

Virtualbox 22 min

VmWare 15 min+30

use VmWare if you can(it will cost you a few $)

use nfs if you can

vagrant plugin install vbguest

keeps guest addition updated

unless Vagranthas_plugin(ldquovagrant-vbguest) raise rdquoplease install vagrant-vbguestrdquo end

On VM IO is the bottleneck

loading webpages running testsuites are READ heavy

move IO outside shared folders

Default provider virtualbox

3 PHP test suites with unit functional integration mix

small (sf1) build runs in ~25 sec

medium (zf2) build runs in ~2 mins

large (sf2) build runs ~ 20 mins

IO logs cache

class AppKernel extends Kernel public function getCacheDir() if (in_array($this-gtenvironment array(dev test))) return devshmappnamecache $this-gtenvironment

return parentgetCacheDir()

public function getLogDir() if (in_array($this-gtenvironment array(dev lsquotest))) return devshmappnamelogs

return parentgetLogDir()

class AppKernel extends Kernel public function getCacheDir() if (in_array($this-gtenvironment array(dev test))) return devshmappnamecache $this-gtenvironment

return parentgetCacheDir()

public function getLogDir() if (in_array($this-gtenvironment array(dev lsquotest))) return devshmappnamelogs

return parentgetLogDir()

+13-16

IO move DB on RAMif you use sqlite move it on devshm

vagrant plugin install vagrantcachier

if Vagranthas_plugin(vagrant-cachier) configcachescope = box

configcachesynced_folder_opts = type nfs mount_options [rwvers=3tcpnolock] end

Vagrantfile

if Vagranthas_plugin(vagrant-cachier) configcachescope = box

configcachesynced_folder_opts = type nfs mount_options [rwvers=3tcpnolock] end

Vagrantfile

+30for reprovisioning a box with git php apache mysql

use cachefilesd for nfs

- name Install cachefilesd apt pkg=cachefilesd state=present

- name Enable cachefilesd lineinfile dest=etcdefaultcachefilesd line=ldquoRUN=yesrdquo

- name Start cachefilesd service service name=cachefilesd state=restarted

configvmsynced_folder varwww id ldquovagrant-rootrdquo type ldquonfsrdquo mount_options [rwvers=3tcpfsc]

Vagrantfile

configvmsynced_folder varwww id ldquovagrant-rootrdquo type ldquonfsrdquo mount_options [rwvers=3tcpfsc]

Vagrantfile

-15+10

should you trust these numbers

Application Management

How to access mysql

- name add mysql user mysql_user name=ideato host= password=ideato priv=ALLGRANT login_user=root login_password=

- name config bind address to allow remote remote connections lineinfile dest=etcmysqlmycnf state=present regexp=bind-address = 127001 line=bind-address = 0000 backup=yes

- name restart mysql service name=mysql state=restarted

Permissions management in shared folders

configvmsynced_folder varwww id vagrant-root owner vagrant group vagrant mount_options [dmode=777fmode=777]

Use host ssh keys

configsshforward_agent = true

ForwardAgent yes

check ssh config file in your host machine

gruntgulp watch

httpwwwsebastien-hanfrblog20121218noac-performance-impact-on-web-applications

configvmsynced_folder varwww id ldquovagrant-rootrdquo type ldquonfsrdquo mount_options [lsquorwrsquovers=3tcpfsc actimeo=1]

Provisioning

to phansible or not to phansible

quick and easy way to start

theyrsquore general

old platforms are not supported

a lot of a good ideas you can steal from

if which(ansible-playbook) configvmprovision ansible do |ansible| ansibleplaybook = ansibleplaybookyml ansibleinventory_path = ansibleinventoriesdev ansiblelimit = all ansibleextra_vars = private_interface 1921683399 hostname default end else configvmprovision shell path ansiblewindowssh args [default] end

can you assume everyone in your team have the same version

if which(ansible-playbook) configvmprovision ansible do |ansible| ansibleplaybook = ansibleplaybookyml ansibleinventory_path = ansibleinventoriesdev ansiblelimit = all ansibleextra_vars = private_interface 1921683399 hostname default end else configvmprovision shell path ansiblewindowssh args [default] end

the provisioning tool is a moving part wanna update be careful

create Vagrant indipendent provision

scripts

configvmprovision shell path =gt scriptsbootstrapsh args =gt varwww

configvmprovision shell path =gt ldquoscriptsprovisionsh args =gt varwww

create your own template

httpsgithubcomideatosrlvagrant-php-template

yoursquore in control of provisioning command

you can perform additional checks on host machine

Distributing VMs

provisioning does not create immutable vm by default

eg package update on LTS

live on the edge and fix provision script

use stable package repositories

httpsspeakerdeckcommitchellhvagrant-usage-patterns

Create and distribute your own VM

Golden image

vagrant package - -name myboxbox

publish it somewhere (http atlas)

cvmbox_url = ldquohttpmyboxboxrdquo

- Donrsquot make assumptions about the host

- Provision first then bake your own image

- The more moving part the harder will get

Keep it simple

Thank you

_orso_

micheleorselli ideatosrl

moideatoit

if Vagranthas_plugin(HostsUpdater) confighostsupdateraliases = [host1lo] else puts --- WARNING --- puts ldquoYou should install HostsUpdaterrdquo end

Multi-VM Configuration

configvmdefine web do |web| webvmnetwork private_network ip 10002 webvmprovider virtualbox do |v| vcustomize [modifyvm id --memory 2048] end webvmsynced_folder ldquovarwww end configvmdefine db do |db| dbvmnetwork private_network ip 10003 dbvmprovision shell path =gt vagrantdbsh end

Dealing with shared folders

no share

native share- slow - os indipendent-ish

nfs- fast - win support -(

rsync- no real share - update

VM Performance

run testshellip

still runninghellip

mitchellhcomcomparing-filesystem-performance-in-virtual-machines

Virtualbox vs VmWare

Virtualbox 22 min

VmWare 15 min

Virtualbox 22 min

VmWare 15 min+30

use VmWare if you can(it will cost you a few $)

use nfs if you can

vagrant plugin install vbguest

keeps guest addition updated

unless Vagranthas_plugin(ldquovagrant-vbguest) raise rdquoplease install vagrant-vbguestrdquo end

On VM IO is the bottleneck

loading webpages running testsuites are READ heavy

move IO outside shared folders

Default provider virtualbox

3 PHP test suites with unit functional integration mix

small (sf1) build runs in ~25 sec

medium (zf2) build runs in ~2 mins

large (sf2) build runs ~ 20 mins

IO logs cache

class AppKernel extends Kernel public function getCacheDir() if (in_array($this-gtenvironment array(dev test))) return devshmappnamecache $this-gtenvironment

return parentgetCacheDir()

public function getLogDir() if (in_array($this-gtenvironment array(dev lsquotest))) return devshmappnamelogs

return parentgetLogDir()

class AppKernel extends Kernel public function getCacheDir() if (in_array($this-gtenvironment array(dev test))) return devshmappnamecache $this-gtenvironment

return parentgetCacheDir()

public function getLogDir() if (in_array($this-gtenvironment array(dev lsquotest))) return devshmappnamelogs

return parentgetLogDir()

+13-16

IO move DB on RAMif you use sqlite move it on devshm

vagrant plugin install vagrantcachier

if Vagranthas_plugin(vagrant-cachier) configcachescope = box

configcachesynced_folder_opts = type nfs mount_options [rwvers=3tcpnolock] end

Vagrantfile

if Vagranthas_plugin(vagrant-cachier) configcachescope = box

configcachesynced_folder_opts = type nfs mount_options [rwvers=3tcpnolock] end

Vagrantfile

+30for reprovisioning a box with git php apache mysql

use cachefilesd for nfs

- name Install cachefilesd apt pkg=cachefilesd state=present

- name Enable cachefilesd lineinfile dest=etcdefaultcachefilesd line=ldquoRUN=yesrdquo

- name Start cachefilesd service service name=cachefilesd state=restarted

configvmsynced_folder varwww id ldquovagrant-rootrdquo type ldquonfsrdquo mount_options [rwvers=3tcpfsc]

Vagrantfile

configvmsynced_folder varwww id ldquovagrant-rootrdquo type ldquonfsrdquo mount_options [rwvers=3tcpfsc]

Vagrantfile

-15+10

should you trust these numbers

Application Management

How to access mysql

- name add mysql user mysql_user name=ideato host= password=ideato priv=ALLGRANT login_user=root login_password=

- name config bind address to allow remote remote connections lineinfile dest=etcmysqlmycnf state=present regexp=bind-address = 127001 line=bind-address = 0000 backup=yes

- name restart mysql service name=mysql state=restarted

Permissions management in shared folders

configvmsynced_folder varwww id vagrant-root owner vagrant group vagrant mount_options [dmode=777fmode=777]

Use host ssh keys

configsshforward_agent = true

ForwardAgent yes

check ssh config file in your host machine

gruntgulp watch

httpwwwsebastien-hanfrblog20121218noac-performance-impact-on-web-applications

configvmsynced_folder varwww id ldquovagrant-rootrdquo type ldquonfsrdquo mount_options [lsquorwrsquovers=3tcpfsc actimeo=1]

Provisioning

to phansible or not to phansible

quick and easy way to start

theyrsquore general

old platforms are not supported

a lot of a good ideas you can steal from

if which(ansible-playbook) configvmprovision ansible do |ansible| ansibleplaybook = ansibleplaybookyml ansibleinventory_path = ansibleinventoriesdev ansiblelimit = all ansibleextra_vars = private_interface 1921683399 hostname default end else configvmprovision shell path ansiblewindowssh args [default] end

can you assume everyone in your team have the same version

if which(ansible-playbook) configvmprovision ansible do |ansible| ansibleplaybook = ansibleplaybookyml ansibleinventory_path = ansibleinventoriesdev ansiblelimit = all ansibleextra_vars = private_interface 1921683399 hostname default end else configvmprovision shell path ansiblewindowssh args [default] end

the provisioning tool is a moving part wanna update be careful

create Vagrant indipendent provision

scripts

configvmprovision shell path =gt scriptsbootstrapsh args =gt varwww

configvmprovision shell path =gt ldquoscriptsprovisionsh args =gt varwww

create your own template

httpsgithubcomideatosrlvagrant-php-template

yoursquore in control of provisioning command

you can perform additional checks on host machine

Distributing VMs

provisioning does not create immutable vm by default

eg package update on LTS

live on the edge and fix provision script

use stable package repositories

httpsspeakerdeckcommitchellhvagrant-usage-patterns

Create and distribute your own VM

Golden image

vagrant package - -name myboxbox

publish it somewhere (http atlas)

cvmbox_url = ldquohttpmyboxboxrdquo

- Donrsquot make assumptions about the host

- Provision first then bake your own image

- The more moving part the harder will get

Keep it simple

Thank you

_orso_

micheleorselli ideatosrl

moideatoit

Multi-VM Configuration

configvmdefine web do |web| webvmnetwork private_network ip 10002 webvmprovider virtualbox do |v| vcustomize [modifyvm id --memory 2048] end webvmsynced_folder ldquovarwww end configvmdefine db do |db| dbvmnetwork private_network ip 10003 dbvmprovision shell path =gt vagrantdbsh end

Dealing with shared folders

no share

native share- slow - os indipendent-ish

nfs- fast - win support -(

rsync- no real share - update

VM Performance

run testshellip

still runninghellip

mitchellhcomcomparing-filesystem-performance-in-virtual-machines

Virtualbox vs VmWare

Virtualbox 22 min

VmWare 15 min

Virtualbox 22 min

VmWare 15 min+30

use VmWare if you can(it will cost you a few $)

use nfs if you can

vagrant plugin install vbguest

keeps guest addition updated

unless Vagranthas_plugin(ldquovagrant-vbguest) raise rdquoplease install vagrant-vbguestrdquo end

On VM IO is the bottleneck

loading webpages running testsuites are READ heavy

move IO outside shared folders

Default provider virtualbox

3 PHP test suites with unit functional integration mix

small (sf1) build runs in ~25 sec

medium (zf2) build runs in ~2 mins

large (sf2) build runs ~ 20 mins

IO logs cache

class AppKernel extends Kernel public function getCacheDir() if (in_array($this-gtenvironment array(dev test))) return devshmappnamecache $this-gtenvironment

return parentgetCacheDir()

public function getLogDir() if (in_array($this-gtenvironment array(dev lsquotest))) return devshmappnamelogs

return parentgetLogDir()

class AppKernel extends Kernel public function getCacheDir() if (in_array($this-gtenvironment array(dev test))) return devshmappnamecache $this-gtenvironment

return parentgetCacheDir()

public function getLogDir() if (in_array($this-gtenvironment array(dev lsquotest))) return devshmappnamelogs

return parentgetLogDir()

+13-16

IO move DB on RAMif you use sqlite move it on devshm

vagrant plugin install vagrantcachier

if Vagranthas_plugin(vagrant-cachier) configcachescope = box

configcachesynced_folder_opts = type nfs mount_options [rwvers=3tcpnolock] end

Vagrantfile

if Vagranthas_plugin(vagrant-cachier) configcachescope = box

configcachesynced_folder_opts = type nfs mount_options [rwvers=3tcpnolock] end

Vagrantfile

+30for reprovisioning a box with git php apache mysql

use cachefilesd for nfs

- name Install cachefilesd apt pkg=cachefilesd state=present

- name Enable cachefilesd lineinfile dest=etcdefaultcachefilesd line=ldquoRUN=yesrdquo

- name Start cachefilesd service service name=cachefilesd state=restarted

configvmsynced_folder varwww id ldquovagrant-rootrdquo type ldquonfsrdquo mount_options [rwvers=3tcpfsc]

Vagrantfile

configvmsynced_folder varwww id ldquovagrant-rootrdquo type ldquonfsrdquo mount_options [rwvers=3tcpfsc]

Vagrantfile

-15+10

should you trust these numbers

Application Management

How to access mysql

- name add mysql user mysql_user name=ideato host= password=ideato priv=ALLGRANT login_user=root login_password=

- name config bind address to allow remote remote connections lineinfile dest=etcmysqlmycnf state=present regexp=bind-address = 127001 line=bind-address = 0000 backup=yes

- name restart mysql service name=mysql state=restarted

Permissions management in shared folders

configvmsynced_folder varwww id vagrant-root owner vagrant group vagrant mount_options [dmode=777fmode=777]

Use host ssh keys

configsshforward_agent = true

ForwardAgent yes

check ssh config file in your host machine

gruntgulp watch

httpwwwsebastien-hanfrblog20121218noac-performance-impact-on-web-applications

configvmsynced_folder varwww id ldquovagrant-rootrdquo type ldquonfsrdquo mount_options [lsquorwrsquovers=3tcpfsc actimeo=1]

Provisioning

to phansible or not to phansible

quick and easy way to start

theyrsquore general

old platforms are not supported

a lot of a good ideas you can steal from

if which(ansible-playbook) configvmprovision ansible do |ansible| ansibleplaybook = ansibleplaybookyml ansibleinventory_path = ansibleinventoriesdev ansiblelimit = all ansibleextra_vars = private_interface 1921683399 hostname default end else configvmprovision shell path ansiblewindowssh args [default] end

can you assume everyone in your team have the same version

if which(ansible-playbook) configvmprovision ansible do |ansible| ansibleplaybook = ansibleplaybookyml ansibleinventory_path = ansibleinventoriesdev ansiblelimit = all ansibleextra_vars = private_interface 1921683399 hostname default end else configvmprovision shell path ansiblewindowssh args [default] end

the provisioning tool is a moving part wanna update be careful

create Vagrant indipendent provision

scripts

configvmprovision shell path =gt scriptsbootstrapsh args =gt varwww

configvmprovision shell path =gt ldquoscriptsprovisionsh args =gt varwww

create your own template

httpsgithubcomideatosrlvagrant-php-template

yoursquore in control of provisioning command

you can perform additional checks on host machine

Distributing VMs

provisioning does not create immutable vm by default

eg package update on LTS

live on the edge and fix provision script

use stable package repositories

httpsspeakerdeckcommitchellhvagrant-usage-patterns

Create and distribute your own VM

Golden image

vagrant package - -name myboxbox

publish it somewhere (http atlas)

cvmbox_url = ldquohttpmyboxboxrdquo

- Donrsquot make assumptions about the host

- Provision first then bake your own image

- The more moving part the harder will get

Keep it simple

Thank you

_orso_

micheleorselli ideatosrl

moideatoit

configvmdefine web do |web| webvmnetwork private_network ip 10002 webvmprovider virtualbox do |v| vcustomize [modifyvm id --memory 2048] end webvmsynced_folder ldquovarwww end configvmdefine db do |db| dbvmnetwork private_network ip 10003 dbvmprovision shell path =gt vagrantdbsh end

Dealing with shared folders

no share

native share- slow - os indipendent-ish

nfs- fast - win support -(

rsync- no real share - update

VM Performance

run testshellip

still runninghellip

mitchellhcomcomparing-filesystem-performance-in-virtual-machines

Virtualbox vs VmWare

Virtualbox 22 min

VmWare 15 min

Virtualbox 22 min

VmWare 15 min+30

use VmWare if you can(it will cost you a few $)

use nfs if you can

vagrant plugin install vbguest

keeps guest addition updated

unless Vagranthas_plugin(ldquovagrant-vbguest) raise rdquoplease install vagrant-vbguestrdquo end

On VM IO is the bottleneck

loading webpages running testsuites are READ heavy

move IO outside shared folders

Default provider virtualbox

3 PHP test suites with unit functional integration mix

small (sf1) build runs in ~25 sec

medium (zf2) build runs in ~2 mins

large (sf2) build runs ~ 20 mins

IO logs cache

class AppKernel extends Kernel public function getCacheDir() if (in_array($this-gtenvironment array(dev test))) return devshmappnamecache $this-gtenvironment

return parentgetCacheDir()

public function getLogDir() if (in_array($this-gtenvironment array(dev lsquotest))) return devshmappnamelogs

return parentgetLogDir()

class AppKernel extends Kernel public function getCacheDir() if (in_array($this-gtenvironment array(dev test))) return devshmappnamecache $this-gtenvironment

return parentgetCacheDir()

public function getLogDir() if (in_array($this-gtenvironment array(dev lsquotest))) return devshmappnamelogs

return parentgetLogDir()

+13-16

IO move DB on RAMif you use sqlite move it on devshm

vagrant plugin install vagrantcachier

if Vagranthas_plugin(vagrant-cachier) configcachescope = box

configcachesynced_folder_opts = type nfs mount_options [rwvers=3tcpnolock] end

Vagrantfile

if Vagranthas_plugin(vagrant-cachier) configcachescope = box

configcachesynced_folder_opts = type nfs mount_options [rwvers=3tcpnolock] end

Vagrantfile

+30for reprovisioning a box with git php apache mysql

use cachefilesd for nfs

- name Install cachefilesd apt pkg=cachefilesd state=present

- name Enable cachefilesd lineinfile dest=etcdefaultcachefilesd line=ldquoRUN=yesrdquo

- name Start cachefilesd service service name=cachefilesd state=restarted

configvmsynced_folder varwww id ldquovagrant-rootrdquo type ldquonfsrdquo mount_options [rwvers=3tcpfsc]

Vagrantfile

configvmsynced_folder varwww id ldquovagrant-rootrdquo type ldquonfsrdquo mount_options [rwvers=3tcpfsc]

Vagrantfile

-15+10

should you trust these numbers

Application Management

How to access mysql

- name add mysql user mysql_user name=ideato host= password=ideato priv=ALLGRANT login_user=root login_password=

- name config bind address to allow remote remote connections lineinfile dest=etcmysqlmycnf state=present regexp=bind-address = 127001 line=bind-address = 0000 backup=yes

- name restart mysql service name=mysql state=restarted

Permissions management in shared folders

configvmsynced_folder varwww id vagrant-root owner vagrant group vagrant mount_options [dmode=777fmode=777]

Use host ssh keys

configsshforward_agent = true

ForwardAgent yes

check ssh config file in your host machine

gruntgulp watch

httpwwwsebastien-hanfrblog20121218noac-performance-impact-on-web-applications

configvmsynced_folder varwww id ldquovagrant-rootrdquo type ldquonfsrdquo mount_options [lsquorwrsquovers=3tcpfsc actimeo=1]

Provisioning

to phansible or not to phansible

quick and easy way to start

theyrsquore general

old platforms are not supported

a lot of a good ideas you can steal from

if which(ansible-playbook) configvmprovision ansible do |ansible| ansibleplaybook = ansibleplaybookyml ansibleinventory_path = ansibleinventoriesdev ansiblelimit = all ansibleextra_vars = private_interface 1921683399 hostname default end else configvmprovision shell path ansiblewindowssh args [default] end

can you assume everyone in your team have the same version

if which(ansible-playbook) configvmprovision ansible do |ansible| ansibleplaybook = ansibleplaybookyml ansibleinventory_path = ansibleinventoriesdev ansiblelimit = all ansibleextra_vars = private_interface 1921683399 hostname default end else configvmprovision shell path ansiblewindowssh args [default] end

the provisioning tool is a moving part wanna update be careful

create Vagrant indipendent provision

scripts

configvmprovision shell path =gt scriptsbootstrapsh args =gt varwww

configvmprovision shell path =gt ldquoscriptsprovisionsh args =gt varwww

create your own template

httpsgithubcomideatosrlvagrant-php-template

yoursquore in control of provisioning command

you can perform additional checks on host machine

Distributing VMs

provisioning does not create immutable vm by default

eg package update on LTS

live on the edge and fix provision script

use stable package repositories

httpsspeakerdeckcommitchellhvagrant-usage-patterns

Create and distribute your own VM

Golden image

vagrant package - -name myboxbox

publish it somewhere (http atlas)

cvmbox_url = ldquohttpmyboxboxrdquo

- Donrsquot make assumptions about the host

- Provision first then bake your own image

- The more moving part the harder will get

Keep it simple

Thank you

_orso_

micheleorselli ideatosrl

moideatoit

Dealing with shared folders

no share

native share- slow - os indipendent-ish

nfs- fast - win support -(

rsync- no real share - update

VM Performance

run testshellip

still runninghellip

mitchellhcomcomparing-filesystem-performance-in-virtual-machines

Virtualbox vs VmWare

Virtualbox 22 min

VmWare 15 min

Virtualbox 22 min

VmWare 15 min+30

use VmWare if you can(it will cost you a few $)

use nfs if you can

vagrant plugin install vbguest

keeps guest addition updated

unless Vagranthas_plugin(ldquovagrant-vbguest) raise rdquoplease install vagrant-vbguestrdquo end

On VM IO is the bottleneck

loading webpages running testsuites are READ heavy

move IO outside shared folders

Default provider virtualbox

3 PHP test suites with unit functional integration mix

small (sf1) build runs in ~25 sec

medium (zf2) build runs in ~2 mins

large (sf2) build runs ~ 20 mins

IO logs cache

class AppKernel extends Kernel public function getCacheDir() if (in_array($this-gtenvironment array(dev test))) return devshmappnamecache $this-gtenvironment

return parentgetCacheDir()

public function getLogDir() if (in_array($this-gtenvironment array(dev lsquotest))) return devshmappnamelogs

return parentgetLogDir()

class AppKernel extends Kernel public function getCacheDir() if (in_array($this-gtenvironment array(dev test))) return devshmappnamecache $this-gtenvironment

return parentgetCacheDir()

public function getLogDir() if (in_array($this-gtenvironment array(dev lsquotest))) return devshmappnamelogs

return parentgetLogDir()

+13-16

IO move DB on RAMif you use sqlite move it on devshm

vagrant plugin install vagrantcachier

if Vagranthas_plugin(vagrant-cachier) configcachescope = box

configcachesynced_folder_opts = type nfs mount_options [rwvers=3tcpnolock] end

Vagrantfile

if Vagranthas_plugin(vagrant-cachier) configcachescope = box

configcachesynced_folder_opts = type nfs mount_options [rwvers=3tcpnolock] end

Vagrantfile

+30for reprovisioning a box with git php apache mysql

use cachefilesd for nfs

- name Install cachefilesd apt pkg=cachefilesd state=present

- name Enable cachefilesd lineinfile dest=etcdefaultcachefilesd line=ldquoRUN=yesrdquo

- name Start cachefilesd service service name=cachefilesd state=restarted

configvmsynced_folder varwww id ldquovagrant-rootrdquo type ldquonfsrdquo mount_options [rwvers=3tcpfsc]

Vagrantfile

configvmsynced_folder varwww id ldquovagrant-rootrdquo type ldquonfsrdquo mount_options [rwvers=3tcpfsc]

Vagrantfile

-15+10

should you trust these numbers

Application Management

How to access mysql

- name add mysql user mysql_user name=ideato host= password=ideato priv=ALLGRANT login_user=root login_password=

- name config bind address to allow remote remote connections lineinfile dest=etcmysqlmycnf state=present regexp=bind-address = 127001 line=bind-address = 0000 backup=yes

- name restart mysql service name=mysql state=restarted

Permissions management in shared folders

configvmsynced_folder varwww id vagrant-root owner vagrant group vagrant mount_options [dmode=777fmode=777]

Use host ssh keys

configsshforward_agent = true

ForwardAgent yes

check ssh config file in your host machine

gruntgulp watch

httpwwwsebastien-hanfrblog20121218noac-performance-impact-on-web-applications

configvmsynced_folder varwww id ldquovagrant-rootrdquo type ldquonfsrdquo mount_options [lsquorwrsquovers=3tcpfsc actimeo=1]

Provisioning

to phansible or not to phansible

quick and easy way to start

theyrsquore general

old platforms are not supported

a lot of a good ideas you can steal from

if which(ansible-playbook) configvmprovision ansible do |ansible| ansibleplaybook = ansibleplaybookyml ansibleinventory_path = ansibleinventoriesdev ansiblelimit = all ansibleextra_vars = private_interface 1921683399 hostname default end else configvmprovision shell path ansiblewindowssh args [default] end

can you assume everyone in your team have the same version

if which(ansible-playbook) configvmprovision ansible do |ansible| ansibleplaybook = ansibleplaybookyml ansibleinventory_path = ansibleinventoriesdev ansiblelimit = all ansibleextra_vars = private_interface 1921683399 hostname default end else configvmprovision shell path ansiblewindowssh args [default] end

the provisioning tool is a moving part wanna update be careful

create Vagrant indipendent provision

scripts

configvmprovision shell path =gt scriptsbootstrapsh args =gt varwww

configvmprovision shell path =gt ldquoscriptsprovisionsh args =gt varwww

create your own template

httpsgithubcomideatosrlvagrant-php-template

yoursquore in control of provisioning command

you can perform additional checks on host machine

Distributing VMs

provisioning does not create immutable vm by default

eg package update on LTS

live on the edge and fix provision script

use stable package repositories

httpsspeakerdeckcommitchellhvagrant-usage-patterns

Create and distribute your own VM

Golden image

vagrant package - -name myboxbox

publish it somewhere (http atlas)

cvmbox_url = ldquohttpmyboxboxrdquo

- Donrsquot make assumptions about the host

- Provision first then bake your own image

- The more moving part the harder will get

Keep it simple

Thank you

_orso_

micheleorselli ideatosrl

moideatoit

no share

native share- slow - os indipendent-ish

nfs- fast - win support -(

rsync- no real share - update

VM Performance

run testshellip

still runninghellip

mitchellhcomcomparing-filesystem-performance-in-virtual-machines

Virtualbox vs VmWare

Virtualbox 22 min

VmWare 15 min

Virtualbox 22 min

VmWare 15 min+30

use VmWare if you can(it will cost you a few $)

use nfs if you can

vagrant plugin install vbguest

keeps guest addition updated

unless Vagranthas_plugin(ldquovagrant-vbguest) raise rdquoplease install vagrant-vbguestrdquo end

On VM IO is the bottleneck

loading webpages running testsuites are READ heavy

move IO outside shared folders

Default provider virtualbox

3 PHP test suites with unit functional integration mix

small (sf1) build runs in ~25 sec

medium (zf2) build runs in ~2 mins

large (sf2) build runs ~ 20 mins

IO logs cache

class AppKernel extends Kernel public function getCacheDir() if (in_array($this-gtenvironment array(dev test))) return devshmappnamecache $this-gtenvironment

return parentgetCacheDir()

public function getLogDir() if (in_array($this-gtenvironment array(dev lsquotest))) return devshmappnamelogs

return parentgetLogDir()

class AppKernel extends Kernel public function getCacheDir() if (in_array($this-gtenvironment array(dev test))) return devshmappnamecache $this-gtenvironment

return parentgetCacheDir()

public function getLogDir() if (in_array($this-gtenvironment array(dev lsquotest))) return devshmappnamelogs

return parentgetLogDir()

+13-16

IO move DB on RAMif you use sqlite move it on devshm

vagrant plugin install vagrantcachier

if Vagranthas_plugin(vagrant-cachier) configcachescope = box

configcachesynced_folder_opts = type nfs mount_options [rwvers=3tcpnolock] end

Vagrantfile

if Vagranthas_plugin(vagrant-cachier) configcachescope = box

configcachesynced_folder_opts = type nfs mount_options [rwvers=3tcpnolock] end

Vagrantfile

+30for reprovisioning a box with git php apache mysql

use cachefilesd for nfs

- name Install cachefilesd apt pkg=cachefilesd state=present

- name Enable cachefilesd lineinfile dest=etcdefaultcachefilesd line=ldquoRUN=yesrdquo

- name Start cachefilesd service service name=cachefilesd state=restarted

configvmsynced_folder varwww id ldquovagrant-rootrdquo type ldquonfsrdquo mount_options [rwvers=3tcpfsc]

Vagrantfile

configvmsynced_folder varwww id ldquovagrant-rootrdquo type ldquonfsrdquo mount_options [rwvers=3tcpfsc]

Vagrantfile

-15+10

should you trust these numbers

Application Management

How to access mysql

- name add mysql user mysql_user name=ideato host= password=ideato priv=ALLGRANT login_user=root login_password=

- name config bind address to allow remote remote connections lineinfile dest=etcmysqlmycnf state=present regexp=bind-address = 127001 line=bind-address = 0000 backup=yes

- name restart mysql service name=mysql state=restarted

Permissions management in shared folders

configvmsynced_folder varwww id vagrant-root owner vagrant group vagrant mount_options [dmode=777fmode=777]

Use host ssh keys

configsshforward_agent = true

ForwardAgent yes

check ssh config file in your host machine

gruntgulp watch

httpwwwsebastien-hanfrblog20121218noac-performance-impact-on-web-applications

configvmsynced_folder varwww id ldquovagrant-rootrdquo type ldquonfsrdquo mount_options [lsquorwrsquovers=3tcpfsc actimeo=1]

Provisioning

to phansible or not to phansible

quick and easy way to start

theyrsquore general

old platforms are not supported

a lot of a good ideas you can steal from

if which(ansible-playbook) configvmprovision ansible do |ansible| ansibleplaybook = ansibleplaybookyml ansibleinventory_path = ansibleinventoriesdev ansiblelimit = all ansibleextra_vars = private_interface 1921683399 hostname default end else configvmprovision shell path ansiblewindowssh args [default] end

can you assume everyone in your team have the same version

if which(ansible-playbook) configvmprovision ansible do |ansible| ansibleplaybook = ansibleplaybookyml ansibleinventory_path = ansibleinventoriesdev ansiblelimit = all ansibleextra_vars = private_interface 1921683399 hostname default end else configvmprovision shell path ansiblewindowssh args [default] end

the provisioning tool is a moving part wanna update be careful

create Vagrant indipendent provision

scripts

configvmprovision shell path =gt scriptsbootstrapsh args =gt varwww

configvmprovision shell path =gt ldquoscriptsprovisionsh args =gt varwww

create your own template

httpsgithubcomideatosrlvagrant-php-template

yoursquore in control of provisioning command

you can perform additional checks on host machine

Distributing VMs

provisioning does not create immutable vm by default

eg package update on LTS

live on the edge and fix provision script

use stable package repositories

httpsspeakerdeckcommitchellhvagrant-usage-patterns

Create and distribute your own VM

Golden image

vagrant package - -name myboxbox

publish it somewhere (http atlas)

cvmbox_url = ldquohttpmyboxboxrdquo

- Donrsquot make assumptions about the host

- Provision first then bake your own image

- The more moving part the harder will get

Keep it simple

Thank you

_orso_

micheleorselli ideatosrl

moideatoit

native share- slow - os indipendent-ish

nfs- fast - win support -(

rsync- no real share - update

VM Performance

run testshellip

still runninghellip

mitchellhcomcomparing-filesystem-performance-in-virtual-machines

Virtualbox vs VmWare

Virtualbox 22 min

VmWare 15 min

Virtualbox 22 min

VmWare 15 min+30

use VmWare if you can(it will cost you a few $)

use nfs if you can

vagrant plugin install vbguest

keeps guest addition updated

unless Vagranthas_plugin(ldquovagrant-vbguest) raise rdquoplease install vagrant-vbguestrdquo end

On VM IO is the bottleneck

loading webpages running testsuites are READ heavy

move IO outside shared folders

Default provider virtualbox

3 PHP test suites with unit functional integration mix

small (sf1) build runs in ~25 sec

medium (zf2) build runs in ~2 mins

large (sf2) build runs ~ 20 mins

IO logs cache

class AppKernel extends Kernel public function getCacheDir() if (in_array($this-gtenvironment array(dev test))) return devshmappnamecache $this-gtenvironment

return parentgetCacheDir()

public function getLogDir() if (in_array($this-gtenvironment array(dev lsquotest))) return devshmappnamelogs

return parentgetLogDir()

class AppKernel extends Kernel public function getCacheDir() if (in_array($this-gtenvironment array(dev test))) return devshmappnamecache $this-gtenvironment

return parentgetCacheDir()

public function getLogDir() if (in_array($this-gtenvironment array(dev lsquotest))) return devshmappnamelogs

return parentgetLogDir()

+13-16

IO move DB on RAMif you use sqlite move it on devshm

vagrant plugin install vagrantcachier

if Vagranthas_plugin(vagrant-cachier) configcachescope = box

configcachesynced_folder_opts = type nfs mount_options [rwvers=3tcpnolock] end

Vagrantfile

if Vagranthas_plugin(vagrant-cachier) configcachescope = box

configcachesynced_folder_opts = type nfs mount_options [rwvers=3tcpnolock] end

Vagrantfile

+30for reprovisioning a box with git php apache mysql

use cachefilesd for nfs

- name Install cachefilesd apt pkg=cachefilesd state=present

- name Enable cachefilesd lineinfile dest=etcdefaultcachefilesd line=ldquoRUN=yesrdquo

- name Start cachefilesd service service name=cachefilesd state=restarted

configvmsynced_folder varwww id ldquovagrant-rootrdquo type ldquonfsrdquo mount_options [rwvers=3tcpfsc]

Vagrantfile

configvmsynced_folder varwww id ldquovagrant-rootrdquo type ldquonfsrdquo mount_options [rwvers=3tcpfsc]

Vagrantfile

-15+10

should you trust these numbers

Application Management

How to access mysql

- name add mysql user mysql_user name=ideato host= password=ideato priv=ALLGRANT login_user=root login_password=

- name config bind address to allow remote remote connections lineinfile dest=etcmysqlmycnf state=present regexp=bind-address = 127001 line=bind-address = 0000 backup=yes

- name restart mysql service name=mysql state=restarted

Permissions management in shared folders

configvmsynced_folder varwww id vagrant-root owner vagrant group vagrant mount_options [dmode=777fmode=777]

Use host ssh keys

configsshforward_agent = true

ForwardAgent yes

check ssh config file in your host machine

gruntgulp watch

httpwwwsebastien-hanfrblog20121218noac-performance-impact-on-web-applications

configvmsynced_folder varwww id ldquovagrant-rootrdquo type ldquonfsrdquo mount_options [lsquorwrsquovers=3tcpfsc actimeo=1]

Provisioning

to phansible or not to phansible

quick and easy way to start

theyrsquore general

old platforms are not supported

a lot of a good ideas you can steal from

if which(ansible-playbook) configvmprovision ansible do |ansible| ansibleplaybook = ansibleplaybookyml ansibleinventory_path = ansibleinventoriesdev ansiblelimit = all ansibleextra_vars = private_interface 1921683399 hostname default end else configvmprovision shell path ansiblewindowssh args [default] end

can you assume everyone in your team have the same version

if which(ansible-playbook) configvmprovision ansible do |ansible| ansibleplaybook = ansibleplaybookyml ansibleinventory_path = ansibleinventoriesdev ansiblelimit = all ansibleextra_vars = private_interface 1921683399 hostname default end else configvmprovision shell path ansiblewindowssh args [default] end

the provisioning tool is a moving part wanna update be careful

create Vagrant indipendent provision

scripts

configvmprovision shell path =gt scriptsbootstrapsh args =gt varwww

configvmprovision shell path =gt ldquoscriptsprovisionsh args =gt varwww

create your own template

httpsgithubcomideatosrlvagrant-php-template

yoursquore in control of provisioning command

you can perform additional checks on host machine

Distributing VMs

provisioning does not create immutable vm by default

eg package update on LTS

live on the edge and fix provision script

use stable package repositories

httpsspeakerdeckcommitchellhvagrant-usage-patterns

Create and distribute your own VM

Golden image

vagrant package - -name myboxbox

publish it somewhere (http atlas)

cvmbox_url = ldquohttpmyboxboxrdquo

- Donrsquot make assumptions about the host

- Provision first then bake your own image

- The more moving part the harder will get

Keep it simple

Thank you

_orso_

micheleorselli ideatosrl

moideatoit

nfs- fast - win support -(

rsync- no real share - update

VM Performance

run testshellip

still runninghellip

mitchellhcomcomparing-filesystem-performance-in-virtual-machines

Virtualbox vs VmWare

Virtualbox 22 min

VmWare 15 min

Virtualbox 22 min

VmWare 15 min+30

use VmWare if you can(it will cost you a few $)

use nfs if you can

vagrant plugin install vbguest

keeps guest addition updated

unless Vagranthas_plugin(ldquovagrant-vbguest) raise rdquoplease install vagrant-vbguestrdquo end

On VM IO is the bottleneck

loading webpages running testsuites are READ heavy

move IO outside shared folders

Default provider virtualbox

3 PHP test suites with unit functional integration mix

small (sf1) build runs in ~25 sec

medium (zf2) build runs in ~2 mins

large (sf2) build runs ~ 20 mins

IO logs cache

class AppKernel extends Kernel public function getCacheDir() if (in_array($this-gtenvironment array(dev test))) return devshmappnamecache $this-gtenvironment

return parentgetCacheDir()

public function getLogDir() if (in_array($this-gtenvironment array(dev lsquotest))) return devshmappnamelogs

return parentgetLogDir()

class AppKernel extends Kernel public function getCacheDir() if (in_array($this-gtenvironment array(dev test))) return devshmappnamecache $this-gtenvironment

return parentgetCacheDir()

public function getLogDir() if (in_array($this-gtenvironment array(dev lsquotest))) return devshmappnamelogs

return parentgetLogDir()

+13-16

IO move DB on RAMif you use sqlite move it on devshm

vagrant plugin install vagrantcachier

if Vagranthas_plugin(vagrant-cachier) configcachescope = box

configcachesynced_folder_opts = type nfs mount_options [rwvers=3tcpnolock] end

Vagrantfile

if Vagranthas_plugin(vagrant-cachier) configcachescope = box

configcachesynced_folder_opts = type nfs mount_options [rwvers=3tcpnolock] end

Vagrantfile

+30for reprovisioning a box with git php apache mysql

use cachefilesd for nfs

- name Install cachefilesd apt pkg=cachefilesd state=present

- name Enable cachefilesd lineinfile dest=etcdefaultcachefilesd line=ldquoRUN=yesrdquo

- name Start cachefilesd service service name=cachefilesd state=restarted

configvmsynced_folder varwww id ldquovagrant-rootrdquo type ldquonfsrdquo mount_options [rwvers=3tcpfsc]

Vagrantfile

configvmsynced_folder varwww id ldquovagrant-rootrdquo type ldquonfsrdquo mount_options [rwvers=3tcpfsc]

Vagrantfile

-15+10

should you trust these numbers

Application Management

How to access mysql

- name add mysql user mysql_user name=ideato host= password=ideato priv=ALLGRANT login_user=root login_password=

- name config bind address to allow remote remote connections lineinfile dest=etcmysqlmycnf state=present regexp=bind-address = 127001 line=bind-address = 0000 backup=yes

- name restart mysql service name=mysql state=restarted

Permissions management in shared folders

configvmsynced_folder varwww id vagrant-root owner vagrant group vagrant mount_options [dmode=777fmode=777]

Use host ssh keys

configsshforward_agent = true

ForwardAgent yes

check ssh config file in your host machine

gruntgulp watch

httpwwwsebastien-hanfrblog20121218noac-performance-impact-on-web-applications

configvmsynced_folder varwww id ldquovagrant-rootrdquo type ldquonfsrdquo mount_options [lsquorwrsquovers=3tcpfsc actimeo=1]

Provisioning

to phansible or not to phansible

quick and easy way to start

theyrsquore general

old platforms are not supported

a lot of a good ideas you can steal from

if which(ansible-playbook) configvmprovision ansible do |ansible| ansibleplaybook = ansibleplaybookyml ansibleinventory_path = ansibleinventoriesdev ansiblelimit = all ansibleextra_vars = private_interface 1921683399 hostname default end else configvmprovision shell path ansiblewindowssh args [default] end

can you assume everyone in your team have the same version

if which(ansible-playbook) configvmprovision ansible do |ansible| ansibleplaybook = ansibleplaybookyml ansibleinventory_path = ansibleinventoriesdev ansiblelimit = all ansibleextra_vars = private_interface 1921683399 hostname default end else configvmprovision shell path ansiblewindowssh args [default] end

the provisioning tool is a moving part wanna update be careful

create Vagrant indipendent provision

scripts

configvmprovision shell path =gt scriptsbootstrapsh args =gt varwww

configvmprovision shell path =gt ldquoscriptsprovisionsh args =gt varwww

create your own template

httpsgithubcomideatosrlvagrant-php-template

yoursquore in control of provisioning command

you can perform additional checks on host machine

Distributing VMs

provisioning does not create immutable vm by default

eg package update on LTS

live on the edge and fix provision script

use stable package repositories

httpsspeakerdeckcommitchellhvagrant-usage-patterns

Create and distribute your own VM

Golden image

vagrant package - -name myboxbox

publish it somewhere (http atlas)

cvmbox_url = ldquohttpmyboxboxrdquo

- Donrsquot make assumptions about the host

- Provision first then bake your own image

- The more moving part the harder will get

Keep it simple

Thank you

_orso_

micheleorselli ideatosrl

moideatoit

rsync- no real share - update

VM Performance

run testshellip

still runninghellip

mitchellhcomcomparing-filesystem-performance-in-virtual-machines

Virtualbox vs VmWare

Virtualbox 22 min

VmWare 15 min

Virtualbox 22 min

VmWare 15 min+30

use VmWare if you can(it will cost you a few $)

use nfs if you can

vagrant plugin install vbguest

keeps guest addition updated

unless Vagranthas_plugin(ldquovagrant-vbguest) raise rdquoplease install vagrant-vbguestrdquo end

On VM IO is the bottleneck

loading webpages running testsuites are READ heavy

move IO outside shared folders

Default provider virtualbox

3 PHP test suites with unit functional integration mix

small (sf1) build runs in ~25 sec

medium (zf2) build runs in ~2 mins

large (sf2) build runs ~ 20 mins

IO logs cache

class AppKernel extends Kernel public function getCacheDir() if (in_array($this-gtenvironment array(dev test))) return devshmappnamecache $this-gtenvironment

return parentgetCacheDir()

public function getLogDir() if (in_array($this-gtenvironment array(dev lsquotest))) return devshmappnamelogs

return parentgetLogDir()

class AppKernel extends Kernel public function getCacheDir() if (in_array($this-gtenvironment array(dev test))) return devshmappnamecache $this-gtenvironment

return parentgetCacheDir()

public function getLogDir() if (in_array($this-gtenvironment array(dev lsquotest))) return devshmappnamelogs

return parentgetLogDir()

+13-16

IO move DB on RAMif you use sqlite move it on devshm

vagrant plugin install vagrantcachier

if Vagranthas_plugin(vagrant-cachier) configcachescope = box

configcachesynced_folder_opts = type nfs mount_options [rwvers=3tcpnolock] end

Vagrantfile

if Vagranthas_plugin(vagrant-cachier) configcachescope = box

configcachesynced_folder_opts = type nfs mount_options [rwvers=3tcpnolock] end

Vagrantfile

+30for reprovisioning a box with git php apache mysql

use cachefilesd for nfs

- name Install cachefilesd apt pkg=cachefilesd state=present

- name Enable cachefilesd lineinfile dest=etcdefaultcachefilesd line=ldquoRUN=yesrdquo

- name Start cachefilesd service service name=cachefilesd state=restarted

configvmsynced_folder varwww id ldquovagrant-rootrdquo type ldquonfsrdquo mount_options [rwvers=3tcpfsc]

Vagrantfile

configvmsynced_folder varwww id ldquovagrant-rootrdquo type ldquonfsrdquo mount_options [rwvers=3tcpfsc]

Vagrantfile

-15+10

should you trust these numbers

Application Management

How to access mysql

- name add mysql user mysql_user name=ideato host= password=ideato priv=ALLGRANT login_user=root login_password=

- name config bind address to allow remote remote connections lineinfile dest=etcmysqlmycnf state=present regexp=bind-address = 127001 line=bind-address = 0000 backup=yes

- name restart mysql service name=mysql state=restarted

Permissions management in shared folders

configvmsynced_folder varwww id vagrant-root owner vagrant group vagrant mount_options [dmode=777fmode=777]

Use host ssh keys

configsshforward_agent = true

ForwardAgent yes

check ssh config file in your host machine

gruntgulp watch

httpwwwsebastien-hanfrblog20121218noac-performance-impact-on-web-applications

configvmsynced_folder varwww id ldquovagrant-rootrdquo type ldquonfsrdquo mount_options [lsquorwrsquovers=3tcpfsc actimeo=1]

Provisioning

to phansible or not to phansible

quick and easy way to start

theyrsquore general

old platforms are not supported

a lot of a good ideas you can steal from

if which(ansible-playbook) configvmprovision ansible do |ansible| ansibleplaybook = ansibleplaybookyml ansibleinventory_path = ansibleinventoriesdev ansiblelimit = all ansibleextra_vars = private_interface 1921683399 hostname default end else configvmprovision shell path ansiblewindowssh args [default] end

can you assume everyone in your team have the same version

if which(ansible-playbook) configvmprovision ansible do |ansible| ansibleplaybook = ansibleplaybookyml ansibleinventory_path = ansibleinventoriesdev ansiblelimit = all ansibleextra_vars = private_interface 1921683399 hostname default end else configvmprovision shell path ansiblewindowssh args [default] end

the provisioning tool is a moving part wanna update be careful

create Vagrant indipendent provision

scripts

configvmprovision shell path =gt scriptsbootstrapsh args =gt varwww

configvmprovision shell path =gt ldquoscriptsprovisionsh args =gt varwww

create your own template

httpsgithubcomideatosrlvagrant-php-template

yoursquore in control of provisioning command

you can perform additional checks on host machine

Distributing VMs

provisioning does not create immutable vm by default

eg package update on LTS

live on the edge and fix provision script

use stable package repositories

httpsspeakerdeckcommitchellhvagrant-usage-patterns

Create and distribute your own VM

Golden image

vagrant package - -name myboxbox

publish it somewhere (http atlas)

cvmbox_url = ldquohttpmyboxboxrdquo

- Donrsquot make assumptions about the host

- Provision first then bake your own image

- The more moving part the harder will get

Keep it simple

Thank you

_orso_

micheleorselli ideatosrl

moideatoit

VM Performance

run testshellip

still runninghellip

mitchellhcomcomparing-filesystem-performance-in-virtual-machines

Virtualbox vs VmWare

Virtualbox 22 min

VmWare 15 min

Virtualbox 22 min

VmWare 15 min+30

use VmWare if you can(it will cost you a few $)

use nfs if you can

vagrant plugin install vbguest

keeps guest addition updated

unless Vagranthas_plugin(ldquovagrant-vbguest) raise rdquoplease install vagrant-vbguestrdquo end

On VM IO is the bottleneck

loading webpages running testsuites are READ heavy

move IO outside shared folders

Default provider virtualbox

3 PHP test suites with unit functional integration mix

small (sf1) build runs in ~25 sec

medium (zf2) build runs in ~2 mins

large (sf2) build runs ~ 20 mins

IO logs cache

class AppKernel extends Kernel public function getCacheDir() if (in_array($this-gtenvironment array(dev test))) return devshmappnamecache $this-gtenvironment

return parentgetCacheDir()

public function getLogDir() if (in_array($this-gtenvironment array(dev lsquotest))) return devshmappnamelogs

return parentgetLogDir()

class AppKernel extends Kernel public function getCacheDir() if (in_array($this-gtenvironment array(dev test))) return devshmappnamecache $this-gtenvironment

return parentgetCacheDir()

public function getLogDir() if (in_array($this-gtenvironment array(dev lsquotest))) return devshmappnamelogs

return parentgetLogDir()

+13-16

IO move DB on RAMif you use sqlite move it on devshm

vagrant plugin install vagrantcachier

if Vagranthas_plugin(vagrant-cachier) configcachescope = box

configcachesynced_folder_opts = type nfs mount_options [rwvers=3tcpnolock] end

Vagrantfile

if Vagranthas_plugin(vagrant-cachier) configcachescope = box

configcachesynced_folder_opts = type nfs mount_options [rwvers=3tcpnolock] end

Vagrantfile

+30for reprovisioning a box with git php apache mysql

use cachefilesd for nfs

- name Install cachefilesd apt pkg=cachefilesd state=present

- name Enable cachefilesd lineinfile dest=etcdefaultcachefilesd line=ldquoRUN=yesrdquo

- name Start cachefilesd service service name=cachefilesd state=restarted

configvmsynced_folder varwww id ldquovagrant-rootrdquo type ldquonfsrdquo mount_options [rwvers=3tcpfsc]

Vagrantfile

configvmsynced_folder varwww id ldquovagrant-rootrdquo type ldquonfsrdquo mount_options [rwvers=3tcpfsc]

Vagrantfile

-15+10

should you trust these numbers

Application Management

How to access mysql

- name add mysql user mysql_user name=ideato host= password=ideato priv=ALLGRANT login_user=root login_password=

- name config bind address to allow remote remote connections lineinfile dest=etcmysqlmycnf state=present regexp=bind-address = 127001 line=bind-address = 0000 backup=yes

- name restart mysql service name=mysql state=restarted

Permissions management in shared folders

configvmsynced_folder varwww id vagrant-root owner vagrant group vagrant mount_options [dmode=777fmode=777]

Use host ssh keys

configsshforward_agent = true

ForwardAgent yes

check ssh config file in your host machine

gruntgulp watch

httpwwwsebastien-hanfrblog20121218noac-performance-impact-on-web-applications

configvmsynced_folder varwww id ldquovagrant-rootrdquo type ldquonfsrdquo mount_options [lsquorwrsquovers=3tcpfsc actimeo=1]

Provisioning

to phansible or not to phansible

quick and easy way to start

theyrsquore general

old platforms are not supported

a lot of a good ideas you can steal from

if which(ansible-playbook) configvmprovision ansible do |ansible| ansibleplaybook = ansibleplaybookyml ansibleinventory_path = ansibleinventoriesdev ansiblelimit = all ansibleextra_vars = private_interface 1921683399 hostname default end else configvmprovision shell path ansiblewindowssh args [default] end

can you assume everyone in your team have the same version

if which(ansible-playbook) configvmprovision ansible do |ansible| ansibleplaybook = ansibleplaybookyml ansibleinventory_path = ansibleinventoriesdev ansiblelimit = all ansibleextra_vars = private_interface 1921683399 hostname default end else configvmprovision shell path ansiblewindowssh args [default] end

the provisioning tool is a moving part wanna update be careful

create Vagrant indipendent provision

scripts

configvmprovision shell path =gt scriptsbootstrapsh args =gt varwww

configvmprovision shell path =gt ldquoscriptsprovisionsh args =gt varwww

create your own template

httpsgithubcomideatosrlvagrant-php-template

yoursquore in control of provisioning command

you can perform additional checks on host machine

Distributing VMs

provisioning does not create immutable vm by default

eg package update on LTS

live on the edge and fix provision script

use stable package repositories

httpsspeakerdeckcommitchellhvagrant-usage-patterns

Create and distribute your own VM

Golden image

vagrant package - -name myboxbox

publish it somewhere (http atlas)

cvmbox_url = ldquohttpmyboxboxrdquo

- Donrsquot make assumptions about the host

- Provision first then bake your own image

- The more moving part the harder will get

Keep it simple

Thank you

_orso_

micheleorselli ideatosrl

moideatoit

run testshellip

still runninghellip

mitchellhcomcomparing-filesystem-performance-in-virtual-machines

Virtualbox vs VmWare

Virtualbox 22 min

VmWare 15 min

Virtualbox 22 min

VmWare 15 min+30

use VmWare if you can(it will cost you a few $)

use nfs if you can

vagrant plugin install vbguest

keeps guest addition updated

unless Vagranthas_plugin(ldquovagrant-vbguest) raise rdquoplease install vagrant-vbguestrdquo end

On VM IO is the bottleneck

loading webpages running testsuites are READ heavy

move IO outside shared folders

Default provider virtualbox

3 PHP test suites with unit functional integration mix

small (sf1) build runs in ~25 sec

medium (zf2) build runs in ~2 mins

large (sf2) build runs ~ 20 mins

IO logs cache

class AppKernel extends Kernel public function getCacheDir() if (in_array($this-gtenvironment array(dev test))) return devshmappnamecache $this-gtenvironment

return parentgetCacheDir()

public function getLogDir() if (in_array($this-gtenvironment array(dev lsquotest))) return devshmappnamelogs

return parentgetLogDir()

class AppKernel extends Kernel public function getCacheDir() if (in_array($this-gtenvironment array(dev test))) return devshmappnamecache $this-gtenvironment

return parentgetCacheDir()

public function getLogDir() if (in_array($this-gtenvironment array(dev lsquotest))) return devshmappnamelogs

return parentgetLogDir()

+13-16

IO move DB on RAMif you use sqlite move it on devshm

vagrant plugin install vagrantcachier

if Vagranthas_plugin(vagrant-cachier) configcachescope = box

configcachesynced_folder_opts = type nfs mount_options [rwvers=3tcpnolock] end

Vagrantfile

if Vagranthas_plugin(vagrant-cachier) configcachescope = box

configcachesynced_folder_opts = type nfs mount_options [rwvers=3tcpnolock] end

Vagrantfile

+30for reprovisioning a box with git php apache mysql

use cachefilesd for nfs

- name Install cachefilesd apt pkg=cachefilesd state=present

- name Enable cachefilesd lineinfile dest=etcdefaultcachefilesd line=ldquoRUN=yesrdquo

- name Start cachefilesd service service name=cachefilesd state=restarted

configvmsynced_folder varwww id ldquovagrant-rootrdquo type ldquonfsrdquo mount_options [rwvers=3tcpfsc]

Vagrantfile

configvmsynced_folder varwww id ldquovagrant-rootrdquo type ldquonfsrdquo mount_options [rwvers=3tcpfsc]

Vagrantfile

-15+10

should you trust these numbers

Application Management

How to access mysql

- name add mysql user mysql_user name=ideato host= password=ideato priv=ALLGRANT login_user=root login_password=

- name config bind address to allow remote remote connections lineinfile dest=etcmysqlmycnf state=present regexp=bind-address = 127001 line=bind-address = 0000 backup=yes

- name restart mysql service name=mysql state=restarted

Permissions management in shared folders

configvmsynced_folder varwww id vagrant-root owner vagrant group vagrant mount_options [dmode=777fmode=777]

Use host ssh keys

configsshforward_agent = true

ForwardAgent yes

check ssh config file in your host machine

gruntgulp watch

httpwwwsebastien-hanfrblog20121218noac-performance-impact-on-web-applications

configvmsynced_folder varwww id ldquovagrant-rootrdquo type ldquonfsrdquo mount_options [lsquorwrsquovers=3tcpfsc actimeo=1]

Provisioning

to phansible or not to phansible

quick and easy way to start

theyrsquore general

old platforms are not supported

a lot of a good ideas you can steal from

if which(ansible-playbook) configvmprovision ansible do |ansible| ansibleplaybook = ansibleplaybookyml ansibleinventory_path = ansibleinventoriesdev ansiblelimit = all ansibleextra_vars = private_interface 1921683399 hostname default end else configvmprovision shell path ansiblewindowssh args [default] end

can you assume everyone in your team have the same version

if which(ansible-playbook) configvmprovision ansible do |ansible| ansibleplaybook = ansibleplaybookyml ansibleinventory_path = ansibleinventoriesdev ansiblelimit = all ansibleextra_vars = private_interface 1921683399 hostname default end else configvmprovision shell path ansiblewindowssh args [default] end

the provisioning tool is a moving part wanna update be careful

create Vagrant indipendent provision

scripts

configvmprovision shell path =gt scriptsbootstrapsh args =gt varwww

configvmprovision shell path =gt ldquoscriptsprovisionsh args =gt varwww

create your own template

httpsgithubcomideatosrlvagrant-php-template

yoursquore in control of provisioning command

you can perform additional checks on host machine

Distributing VMs

provisioning does not create immutable vm by default

eg package update on LTS

live on the edge and fix provision script

use stable package repositories

httpsspeakerdeckcommitchellhvagrant-usage-patterns

Create and distribute your own VM

Golden image

vagrant package - -name myboxbox

publish it somewhere (http atlas)

cvmbox_url = ldquohttpmyboxboxrdquo

- Donrsquot make assumptions about the host

- Provision first then bake your own image

- The more moving part the harder will get

Keep it simple

Thank you

_orso_

micheleorselli ideatosrl

moideatoit

mitchellhcomcomparing-filesystem-performance-in-virtual-machines

Virtualbox vs VmWare

Virtualbox 22 min

VmWare 15 min

Virtualbox 22 min

VmWare 15 min+30

use VmWare if you can(it will cost you a few $)

use nfs if you can

vagrant plugin install vbguest

keeps guest addition updated

unless Vagranthas_plugin(ldquovagrant-vbguest) raise rdquoplease install vagrant-vbguestrdquo end

On VM IO is the bottleneck

loading webpages running testsuites are READ heavy

move IO outside shared folders

Default provider virtualbox

3 PHP test suites with unit functional integration mix

small (sf1) build runs in ~25 sec

medium (zf2) build runs in ~2 mins

large (sf2) build runs ~ 20 mins

IO logs cache

class AppKernel extends Kernel public function getCacheDir() if (in_array($this-gtenvironment array(dev test))) return devshmappnamecache $this-gtenvironment

return parentgetCacheDir()

public function getLogDir() if (in_array($this-gtenvironment array(dev lsquotest))) return devshmappnamelogs

return parentgetLogDir()

class AppKernel extends Kernel public function getCacheDir() if (in_array($this-gtenvironment array(dev test))) return devshmappnamecache $this-gtenvironment

return parentgetCacheDir()

public function getLogDir() if (in_array($this-gtenvironment array(dev lsquotest))) return devshmappnamelogs

return parentgetLogDir()

+13-16

IO move DB on RAMif you use sqlite move it on devshm

vagrant plugin install vagrantcachier

if Vagranthas_plugin(vagrant-cachier) configcachescope = box

configcachesynced_folder_opts = type nfs mount_options [rwvers=3tcpnolock] end

Vagrantfile

if Vagranthas_plugin(vagrant-cachier) configcachescope = box

configcachesynced_folder_opts = type nfs mount_options [rwvers=3tcpnolock] end

Vagrantfile

+30for reprovisioning a box with git php apache mysql

use cachefilesd for nfs

- name Install cachefilesd apt pkg=cachefilesd state=present

- name Enable cachefilesd lineinfile dest=etcdefaultcachefilesd line=ldquoRUN=yesrdquo

- name Start cachefilesd service service name=cachefilesd state=restarted

configvmsynced_folder varwww id ldquovagrant-rootrdquo type ldquonfsrdquo mount_options [rwvers=3tcpfsc]

Vagrantfile

configvmsynced_folder varwww id ldquovagrant-rootrdquo type ldquonfsrdquo mount_options [rwvers=3tcpfsc]

Vagrantfile

-15+10

should you trust these numbers

Application Management

How to access mysql

- name add mysql user mysql_user name=ideato host= password=ideato priv=ALLGRANT login_user=root login_password=

- name config bind address to allow remote remote connections lineinfile dest=etcmysqlmycnf state=present regexp=bind-address = 127001 line=bind-address = 0000 backup=yes

- name restart mysql service name=mysql state=restarted

Permissions management in shared folders

configvmsynced_folder varwww id vagrant-root owner vagrant group vagrant mount_options [dmode=777fmode=777]

Use host ssh keys

configsshforward_agent = true

ForwardAgent yes

check ssh config file in your host machine

gruntgulp watch

httpwwwsebastien-hanfrblog20121218noac-performance-impact-on-web-applications

configvmsynced_folder varwww id ldquovagrant-rootrdquo type ldquonfsrdquo mount_options [lsquorwrsquovers=3tcpfsc actimeo=1]

Provisioning

to phansible or not to phansible

quick and easy way to start

theyrsquore general

old platforms are not supported

a lot of a good ideas you can steal from

if which(ansible-playbook) configvmprovision ansible do |ansible| ansibleplaybook = ansibleplaybookyml ansibleinventory_path = ansibleinventoriesdev ansiblelimit = all ansibleextra_vars = private_interface 1921683399 hostname default end else configvmprovision shell path ansiblewindowssh args [default] end

can you assume everyone in your team have the same version

if which(ansible-playbook) configvmprovision ansible do |ansible| ansibleplaybook = ansibleplaybookyml ansibleinventory_path = ansibleinventoriesdev ansiblelimit = all ansibleextra_vars = private_interface 1921683399 hostname default end else configvmprovision shell path ansiblewindowssh args [default] end

the provisioning tool is a moving part wanna update be careful

create Vagrant indipendent provision

scripts

configvmprovision shell path =gt scriptsbootstrapsh args =gt varwww

configvmprovision shell path =gt ldquoscriptsprovisionsh args =gt varwww

create your own template

httpsgithubcomideatosrlvagrant-php-template

yoursquore in control of provisioning command

you can perform additional checks on host machine

Distributing VMs

provisioning does not create immutable vm by default

eg package update on LTS

live on the edge and fix provision script

use stable package repositories

httpsspeakerdeckcommitchellhvagrant-usage-patterns

Create and distribute your own VM

Golden image

vagrant package - -name myboxbox

publish it somewhere (http atlas)

cvmbox_url = ldquohttpmyboxboxrdquo

- Donrsquot make assumptions about the host

- Provision first then bake your own image

- The more moving part the harder will get

Keep it simple

Thank you

_orso_

micheleorselli ideatosrl

moideatoit

Virtualbox 22 min

VmWare 15 min

Virtualbox 22 min

VmWare 15 min+30

use VmWare if you can(it will cost you a few $)

use nfs if you can

vagrant plugin install vbguest

keeps guest addition updated

unless Vagranthas_plugin(ldquovagrant-vbguest) raise rdquoplease install vagrant-vbguestrdquo end

On VM IO is the bottleneck

loading webpages running testsuites are READ heavy

move IO outside shared folders

Default provider virtualbox

3 PHP test suites with unit functional integration mix

small (sf1) build runs in ~25 sec

medium (zf2) build runs in ~2 mins

large (sf2) build runs ~ 20 mins

IO logs cache

class AppKernel extends Kernel public function getCacheDir() if (in_array($this-gtenvironment array(dev test))) return devshmappnamecache $this-gtenvironment

return parentgetCacheDir()

public function getLogDir() if (in_array($this-gtenvironment array(dev lsquotest))) return devshmappnamelogs

return parentgetLogDir()

class AppKernel extends Kernel public function getCacheDir() if (in_array($this-gtenvironment array(dev test))) return devshmappnamecache $this-gtenvironment

return parentgetCacheDir()

public function getLogDir() if (in_array($this-gtenvironment array(dev lsquotest))) return devshmappnamelogs

return parentgetLogDir()

+13-16

IO move DB on RAMif you use sqlite move it on devshm

vagrant plugin install vagrantcachier

if Vagranthas_plugin(vagrant-cachier) configcachescope = box

configcachesynced_folder_opts = type nfs mount_options [rwvers=3tcpnolock] end

Vagrantfile

if Vagranthas_plugin(vagrant-cachier) configcachescope = box

configcachesynced_folder_opts = type nfs mount_options [rwvers=3tcpnolock] end

Vagrantfile

+30for reprovisioning a box with git php apache mysql

use cachefilesd for nfs

- name Install cachefilesd apt pkg=cachefilesd state=present

- name Enable cachefilesd lineinfile dest=etcdefaultcachefilesd line=ldquoRUN=yesrdquo

- name Start cachefilesd service service name=cachefilesd state=restarted

configvmsynced_folder varwww id ldquovagrant-rootrdquo type ldquonfsrdquo mount_options [rwvers=3tcpfsc]

Vagrantfile

configvmsynced_folder varwww id ldquovagrant-rootrdquo type ldquonfsrdquo mount_options [rwvers=3tcpfsc]

Vagrantfile

-15+10

should you trust these numbers

Application Management

How to access mysql

- name add mysql user mysql_user name=ideato host= password=ideato priv=ALLGRANT login_user=root login_password=

- name config bind address to allow remote remote connections lineinfile dest=etcmysqlmycnf state=present regexp=bind-address = 127001 line=bind-address = 0000 backup=yes

- name restart mysql service name=mysql state=restarted

Permissions management in shared folders

configvmsynced_folder varwww id vagrant-root owner vagrant group vagrant mount_options [dmode=777fmode=777]

Use host ssh keys

configsshforward_agent = true

ForwardAgent yes

check ssh config file in your host machine

gruntgulp watch

httpwwwsebastien-hanfrblog20121218noac-performance-impact-on-web-applications

configvmsynced_folder varwww id ldquovagrant-rootrdquo type ldquonfsrdquo mount_options [lsquorwrsquovers=3tcpfsc actimeo=1]

Provisioning

to phansible or not to phansible

quick and easy way to start

theyrsquore general

old platforms are not supported

a lot of a good ideas you can steal from

if which(ansible-playbook) configvmprovision ansible do |ansible| ansibleplaybook = ansibleplaybookyml ansibleinventory_path = ansibleinventoriesdev ansiblelimit = all ansibleextra_vars = private_interface 1921683399 hostname default end else configvmprovision shell path ansiblewindowssh args [default] end

can you assume everyone in your team have the same version

if which(ansible-playbook) configvmprovision ansible do |ansible| ansibleplaybook = ansibleplaybookyml ansibleinventory_path = ansibleinventoriesdev ansiblelimit = all ansibleextra_vars = private_interface 1921683399 hostname default end else configvmprovision shell path ansiblewindowssh args [default] end

the provisioning tool is a moving part wanna update be careful

create Vagrant indipendent provision

scripts

configvmprovision shell path =gt scriptsbootstrapsh args =gt varwww

configvmprovision shell path =gt ldquoscriptsprovisionsh args =gt varwww

create your own template

httpsgithubcomideatosrlvagrant-php-template

yoursquore in control of provisioning command

you can perform additional checks on host machine

Distributing VMs

provisioning does not create immutable vm by default

eg package update on LTS

live on the edge and fix provision script

use stable package repositories

httpsspeakerdeckcommitchellhvagrant-usage-patterns

Create and distribute your own VM

Golden image

vagrant package - -name myboxbox

publish it somewhere (http atlas)

cvmbox_url = ldquohttpmyboxboxrdquo

- Donrsquot make assumptions about the host

- Provision first then bake your own image

- The more moving part the harder will get

Keep it simple

Thank you

_orso_

micheleorselli ideatosrl

moideatoit

Virtualbox 22 min

VmWare 15 min+30

use VmWare if you can(it will cost you a few $)

use nfs if you can

vagrant plugin install vbguest

keeps guest addition updated

unless Vagranthas_plugin(ldquovagrant-vbguest) raise rdquoplease install vagrant-vbguestrdquo end

On VM IO is the bottleneck

loading webpages running testsuites are READ heavy

move IO outside shared folders

Default provider virtualbox

3 PHP test suites with unit functional integration mix

small (sf1) build runs in ~25 sec

medium (zf2) build runs in ~2 mins

large (sf2) build runs ~ 20 mins

IO logs cache

class AppKernel extends Kernel public function getCacheDir() if (in_array($this-gtenvironment array(dev test))) return devshmappnamecache $this-gtenvironment

return parentgetCacheDir()

public function getLogDir() if (in_array($this-gtenvironment array(dev lsquotest))) return devshmappnamelogs

return parentgetLogDir()

class AppKernel extends Kernel public function getCacheDir() if (in_array($this-gtenvironment array(dev test))) return devshmappnamecache $this-gtenvironment

return parentgetCacheDir()

public function getLogDir() if (in_array($this-gtenvironment array(dev lsquotest))) return devshmappnamelogs

return parentgetLogDir()

+13-16

IO move DB on RAMif you use sqlite move it on devshm

vagrant plugin install vagrantcachier

if Vagranthas_plugin(vagrant-cachier) configcachescope = box

configcachesynced_folder_opts = type nfs mount_options [rwvers=3tcpnolock] end

Vagrantfile

if Vagranthas_plugin(vagrant-cachier) configcachescope = box

configcachesynced_folder_opts = type nfs mount_options [rwvers=3tcpnolock] end

Vagrantfile

+30for reprovisioning a box with git php apache mysql

use cachefilesd for nfs

- name Install cachefilesd apt pkg=cachefilesd state=present

- name Enable cachefilesd lineinfile dest=etcdefaultcachefilesd line=ldquoRUN=yesrdquo

- name Start cachefilesd service service name=cachefilesd state=restarted

configvmsynced_folder varwww id ldquovagrant-rootrdquo type ldquonfsrdquo mount_options [rwvers=3tcpfsc]

Vagrantfile

configvmsynced_folder varwww id ldquovagrant-rootrdquo type ldquonfsrdquo mount_options [rwvers=3tcpfsc]

Vagrantfile

-15+10

should you trust these numbers

Application Management

How to access mysql

- name add mysql user mysql_user name=ideato host= password=ideato priv=ALLGRANT login_user=root login_password=

- name config bind address to allow remote remote connections lineinfile dest=etcmysqlmycnf state=present regexp=bind-address = 127001 line=bind-address = 0000 backup=yes

- name restart mysql service name=mysql state=restarted

Permissions management in shared folders

configvmsynced_folder varwww id vagrant-root owner vagrant group vagrant mount_options [dmode=777fmode=777]

Use host ssh keys

configsshforward_agent = true

ForwardAgent yes

check ssh config file in your host machine

gruntgulp watch

httpwwwsebastien-hanfrblog20121218noac-performance-impact-on-web-applications

configvmsynced_folder varwww id ldquovagrant-rootrdquo type ldquonfsrdquo mount_options [lsquorwrsquovers=3tcpfsc actimeo=1]

Provisioning

to phansible or not to phansible

quick and easy way to start

theyrsquore general

old platforms are not supported

a lot of a good ideas you can steal from

if which(ansible-playbook) configvmprovision ansible do |ansible| ansibleplaybook = ansibleplaybookyml ansibleinventory_path = ansibleinventoriesdev ansiblelimit = all ansibleextra_vars = private_interface 1921683399 hostname default end else configvmprovision shell path ansiblewindowssh args [default] end

can you assume everyone in your team have the same version

if which(ansible-playbook) configvmprovision ansible do |ansible| ansibleplaybook = ansibleplaybookyml ansibleinventory_path = ansibleinventoriesdev ansiblelimit = all ansibleextra_vars = private_interface 1921683399 hostname default end else configvmprovision shell path ansiblewindowssh args [default] end

the provisioning tool is a moving part wanna update be careful

create Vagrant indipendent provision

scripts

configvmprovision shell path =gt scriptsbootstrapsh args =gt varwww

configvmprovision shell path =gt ldquoscriptsprovisionsh args =gt varwww

create your own template

httpsgithubcomideatosrlvagrant-php-template

yoursquore in control of provisioning command

you can perform additional checks on host machine

Distributing VMs

provisioning does not create immutable vm by default

eg package update on LTS

live on the edge and fix provision script

use stable package repositories

httpsspeakerdeckcommitchellhvagrant-usage-patterns

Create and distribute your own VM

Golden image

vagrant package - -name myboxbox

publish it somewhere (http atlas)

cvmbox_url = ldquohttpmyboxboxrdquo

- Donrsquot make assumptions about the host

- Provision first then bake your own image

- The more moving part the harder will get

Keep it simple

Thank you

_orso_

micheleorselli ideatosrl

moideatoit

use VmWare if you can(it will cost you a few $)

use nfs if you can

vagrant plugin install vbguest

keeps guest addition updated

unless Vagranthas_plugin(ldquovagrant-vbguest) raise rdquoplease install vagrant-vbguestrdquo end

On VM IO is the bottleneck

loading webpages running testsuites are READ heavy

move IO outside shared folders

Default provider virtualbox

3 PHP test suites with unit functional integration mix

small (sf1) build runs in ~25 sec

medium (zf2) build runs in ~2 mins

large (sf2) build runs ~ 20 mins

IO logs cache

class AppKernel extends Kernel public function getCacheDir() if (in_array($this-gtenvironment array(dev test))) return devshmappnamecache $this-gtenvironment

return parentgetCacheDir()

public function getLogDir() if (in_array($this-gtenvironment array(dev lsquotest))) return devshmappnamelogs

return parentgetLogDir()

class AppKernel extends Kernel public function getCacheDir() if (in_array($this-gtenvironment array(dev test))) return devshmappnamecache $this-gtenvironment

return parentgetCacheDir()

public function getLogDir() if (in_array($this-gtenvironment array(dev lsquotest))) return devshmappnamelogs

return parentgetLogDir()

+13-16

IO move DB on RAMif you use sqlite move it on devshm

vagrant plugin install vagrantcachier

if Vagranthas_plugin(vagrant-cachier) configcachescope = box

configcachesynced_folder_opts = type nfs mount_options [rwvers=3tcpnolock] end

Vagrantfile

if Vagranthas_plugin(vagrant-cachier) configcachescope = box

configcachesynced_folder_opts = type nfs mount_options [rwvers=3tcpnolock] end

Vagrantfile

+30for reprovisioning a box with git php apache mysql

use cachefilesd for nfs

- name Install cachefilesd apt pkg=cachefilesd state=present

- name Enable cachefilesd lineinfile dest=etcdefaultcachefilesd line=ldquoRUN=yesrdquo

- name Start cachefilesd service service name=cachefilesd state=restarted

configvmsynced_folder varwww id ldquovagrant-rootrdquo type ldquonfsrdquo mount_options [rwvers=3tcpfsc]

Vagrantfile

configvmsynced_folder varwww id ldquovagrant-rootrdquo type ldquonfsrdquo mount_options [rwvers=3tcpfsc]

Vagrantfile

-15+10

should you trust these numbers

Application Management

How to access mysql

- name add mysql user mysql_user name=ideato host= password=ideato priv=ALLGRANT login_user=root login_password=

- name config bind address to allow remote remote connections lineinfile dest=etcmysqlmycnf state=present regexp=bind-address = 127001 line=bind-address = 0000 backup=yes

- name restart mysql service name=mysql state=restarted

Permissions management in shared folders

configvmsynced_folder varwww id vagrant-root owner vagrant group vagrant mount_options [dmode=777fmode=777]

Use host ssh keys

configsshforward_agent = true

ForwardAgent yes

check ssh config file in your host machine

gruntgulp watch

httpwwwsebastien-hanfrblog20121218noac-performance-impact-on-web-applications

configvmsynced_folder varwww id ldquovagrant-rootrdquo type ldquonfsrdquo mount_options [lsquorwrsquovers=3tcpfsc actimeo=1]

Provisioning

to phansible or not to phansible

quick and easy way to start

theyrsquore general

old platforms are not supported

a lot of a good ideas you can steal from

if which(ansible-playbook) configvmprovision ansible do |ansible| ansibleplaybook = ansibleplaybookyml ansibleinventory_path = ansibleinventoriesdev ansiblelimit = all ansibleextra_vars = private_interface 1921683399 hostname default end else configvmprovision shell path ansiblewindowssh args [default] end

can you assume everyone in your team have the same version

if which(ansible-playbook) configvmprovision ansible do |ansible| ansibleplaybook = ansibleplaybookyml ansibleinventory_path = ansibleinventoriesdev ansiblelimit = all ansibleextra_vars = private_interface 1921683399 hostname default end else configvmprovision shell path ansiblewindowssh args [default] end

the provisioning tool is a moving part wanna update be careful

create Vagrant indipendent provision

scripts

configvmprovision shell path =gt scriptsbootstrapsh args =gt varwww

configvmprovision shell path =gt ldquoscriptsprovisionsh args =gt varwww

create your own template

httpsgithubcomideatosrlvagrant-php-template

yoursquore in control of provisioning command

you can perform additional checks on host machine

Distributing VMs

provisioning does not create immutable vm by default

eg package update on LTS

live on the edge and fix provision script

use stable package repositories

httpsspeakerdeckcommitchellhvagrant-usage-patterns

Create and distribute your own VM

Golden image

vagrant package - -name myboxbox

publish it somewhere (http atlas)

cvmbox_url = ldquohttpmyboxboxrdquo

- Donrsquot make assumptions about the host

- Provision first then bake your own image

- The more moving part the harder will get

Keep it simple

Thank you

_orso_

micheleorselli ideatosrl

moideatoit

use nfs if you can

vagrant plugin install vbguest

keeps guest addition updated

unless Vagranthas_plugin(ldquovagrant-vbguest) raise rdquoplease install vagrant-vbguestrdquo end

On VM IO is the bottleneck

loading webpages running testsuites are READ heavy

move IO outside shared folders

Default provider virtualbox

3 PHP test suites with unit functional integration mix

small (sf1) build runs in ~25 sec

medium (zf2) build runs in ~2 mins

large (sf2) build runs ~ 20 mins

IO logs cache

class AppKernel extends Kernel public function getCacheDir() if (in_array($this-gtenvironment array(dev test))) return devshmappnamecache $this-gtenvironment

return parentgetCacheDir()

public function getLogDir() if (in_array($this-gtenvironment array(dev lsquotest))) return devshmappnamelogs

return parentgetLogDir()

class AppKernel extends Kernel public function getCacheDir() if (in_array($this-gtenvironment array(dev test))) return devshmappnamecache $this-gtenvironment

return parentgetCacheDir()

public function getLogDir() if (in_array($this-gtenvironment array(dev lsquotest))) return devshmappnamelogs

return parentgetLogDir()

+13-16

IO move DB on RAMif you use sqlite move it on devshm

vagrant plugin install vagrantcachier

if Vagranthas_plugin(vagrant-cachier) configcachescope = box

configcachesynced_folder_opts = type nfs mount_options [rwvers=3tcpnolock] end

Vagrantfile

if Vagranthas_plugin(vagrant-cachier) configcachescope = box

configcachesynced_folder_opts = type nfs mount_options [rwvers=3tcpnolock] end

Vagrantfile

+30for reprovisioning a box with git php apache mysql

use cachefilesd for nfs

- name Install cachefilesd apt pkg=cachefilesd state=present

- name Enable cachefilesd lineinfile dest=etcdefaultcachefilesd line=ldquoRUN=yesrdquo

- name Start cachefilesd service service name=cachefilesd state=restarted

configvmsynced_folder varwww id ldquovagrant-rootrdquo type ldquonfsrdquo mount_options [rwvers=3tcpfsc]

Vagrantfile

configvmsynced_folder varwww id ldquovagrant-rootrdquo type ldquonfsrdquo mount_options [rwvers=3tcpfsc]

Vagrantfile

-15+10

should you trust these numbers

Application Management

How to access mysql

- name add mysql user mysql_user name=ideato host= password=ideato priv=ALLGRANT login_user=root login_password=

- name config bind address to allow remote remote connections lineinfile dest=etcmysqlmycnf state=present regexp=bind-address = 127001 line=bind-address = 0000 backup=yes

- name restart mysql service name=mysql state=restarted

Permissions management in shared folders

configvmsynced_folder varwww id vagrant-root owner vagrant group vagrant mount_options [dmode=777fmode=777]

Use host ssh keys

configsshforward_agent = true

ForwardAgent yes

check ssh config file in your host machine

gruntgulp watch

httpwwwsebastien-hanfrblog20121218noac-performance-impact-on-web-applications

configvmsynced_folder varwww id ldquovagrant-rootrdquo type ldquonfsrdquo mount_options [lsquorwrsquovers=3tcpfsc actimeo=1]

Provisioning

to phansible or not to phansible

quick and easy way to start

theyrsquore general

old platforms are not supported

a lot of a good ideas you can steal from

if which(ansible-playbook) configvmprovision ansible do |ansible| ansibleplaybook = ansibleplaybookyml ansibleinventory_path = ansibleinventoriesdev ansiblelimit = all ansibleextra_vars = private_interface 1921683399 hostname default end else configvmprovision shell path ansiblewindowssh args [default] end

can you assume everyone in your team have the same version

if which(ansible-playbook) configvmprovision ansible do |ansible| ansibleplaybook = ansibleplaybookyml ansibleinventory_path = ansibleinventoriesdev ansiblelimit = all ansibleextra_vars = private_interface 1921683399 hostname default end else configvmprovision shell path ansiblewindowssh args [default] end

the provisioning tool is a moving part wanna update be careful

create Vagrant indipendent provision

scripts

configvmprovision shell path =gt scriptsbootstrapsh args =gt varwww

configvmprovision shell path =gt ldquoscriptsprovisionsh args =gt varwww

create your own template

httpsgithubcomideatosrlvagrant-php-template

yoursquore in control of provisioning command

you can perform additional checks on host machine

Distributing VMs

provisioning does not create immutable vm by default

eg package update on LTS

live on the edge and fix provision script

use stable package repositories

httpsspeakerdeckcommitchellhvagrant-usage-patterns

Create and distribute your own VM

Golden image

vagrant package - -name myboxbox

publish it somewhere (http atlas)

cvmbox_url = ldquohttpmyboxboxrdquo

- Donrsquot make assumptions about the host

- Provision first then bake your own image

- The more moving part the harder will get

Keep it simple

Thank you

_orso_

micheleorselli ideatosrl

moideatoit

vagrant plugin install vbguest

keeps guest addition updated

unless Vagranthas_plugin(ldquovagrant-vbguest) raise rdquoplease install vagrant-vbguestrdquo end

On VM IO is the bottleneck

loading webpages running testsuites are READ heavy

move IO outside shared folders

Default provider virtualbox

3 PHP test suites with unit functional integration mix

small (sf1) build runs in ~25 sec

medium (zf2) build runs in ~2 mins

large (sf2) build runs ~ 20 mins

IO logs cache

class AppKernel extends Kernel public function getCacheDir() if (in_array($this-gtenvironment array(dev test))) return devshmappnamecache $this-gtenvironment

return parentgetCacheDir()

public function getLogDir() if (in_array($this-gtenvironment array(dev lsquotest))) return devshmappnamelogs

return parentgetLogDir()

class AppKernel extends Kernel public function getCacheDir() if (in_array($this-gtenvironment array(dev test))) return devshmappnamecache $this-gtenvironment

return parentgetCacheDir()

public function getLogDir() if (in_array($this-gtenvironment array(dev lsquotest))) return devshmappnamelogs

return parentgetLogDir()

+13-16

IO move DB on RAMif you use sqlite move it on devshm

vagrant plugin install vagrantcachier

if Vagranthas_plugin(vagrant-cachier) configcachescope = box

configcachesynced_folder_opts = type nfs mount_options [rwvers=3tcpnolock] end

Vagrantfile

if Vagranthas_plugin(vagrant-cachier) configcachescope = box

configcachesynced_folder_opts = type nfs mount_options [rwvers=3tcpnolock] end

Vagrantfile

+30for reprovisioning a box with git php apache mysql

use cachefilesd for nfs

- name Install cachefilesd apt pkg=cachefilesd state=present

- name Enable cachefilesd lineinfile dest=etcdefaultcachefilesd line=ldquoRUN=yesrdquo

- name Start cachefilesd service service name=cachefilesd state=restarted

configvmsynced_folder varwww id ldquovagrant-rootrdquo type ldquonfsrdquo mount_options [rwvers=3tcpfsc]

Vagrantfile

configvmsynced_folder varwww id ldquovagrant-rootrdquo type ldquonfsrdquo mount_options [rwvers=3tcpfsc]

Vagrantfile

-15+10

should you trust these numbers

Application Management

How to access mysql

- name add mysql user mysql_user name=ideato host= password=ideato priv=ALLGRANT login_user=root login_password=

- name config bind address to allow remote remote connections lineinfile dest=etcmysqlmycnf state=present regexp=bind-address = 127001 line=bind-address = 0000 backup=yes

- name restart mysql service name=mysql state=restarted

Permissions management in shared folders

configvmsynced_folder varwww id vagrant-root owner vagrant group vagrant mount_options [dmode=777fmode=777]

Use host ssh keys

configsshforward_agent = true

ForwardAgent yes

check ssh config file in your host machine

gruntgulp watch

httpwwwsebastien-hanfrblog20121218noac-performance-impact-on-web-applications

configvmsynced_folder varwww id ldquovagrant-rootrdquo type ldquonfsrdquo mount_options [lsquorwrsquovers=3tcpfsc actimeo=1]

Provisioning

to phansible or not to phansible

quick and easy way to start

theyrsquore general

old platforms are not supported

a lot of a good ideas you can steal from

if which(ansible-playbook) configvmprovision ansible do |ansible| ansibleplaybook = ansibleplaybookyml ansibleinventory_path = ansibleinventoriesdev ansiblelimit = all ansibleextra_vars = private_interface 1921683399 hostname default end else configvmprovision shell path ansiblewindowssh args [default] end

can you assume everyone in your team have the same version

if which(ansible-playbook) configvmprovision ansible do |ansible| ansibleplaybook = ansibleplaybookyml ansibleinventory_path = ansibleinventoriesdev ansiblelimit = all ansibleextra_vars = private_interface 1921683399 hostname default end else configvmprovision shell path ansiblewindowssh args [default] end

the provisioning tool is a moving part wanna update be careful

create Vagrant indipendent provision

scripts

configvmprovision shell path =gt scriptsbootstrapsh args =gt varwww

configvmprovision shell path =gt ldquoscriptsprovisionsh args =gt varwww

create your own template

httpsgithubcomideatosrlvagrant-php-template

yoursquore in control of provisioning command

you can perform additional checks on host machine

Distributing VMs

provisioning does not create immutable vm by default

eg package update on LTS

live on the edge and fix provision script

use stable package repositories

httpsspeakerdeckcommitchellhvagrant-usage-patterns

Create and distribute your own VM

Golden image

vagrant package - -name myboxbox

publish it somewhere (http atlas)

cvmbox_url = ldquohttpmyboxboxrdquo

- Donrsquot make assumptions about the host

- Provision first then bake your own image

- The more moving part the harder will get

Keep it simple

Thank you

_orso_

micheleorselli ideatosrl

moideatoit

unless Vagranthas_plugin(ldquovagrant-vbguest) raise rdquoplease install vagrant-vbguestrdquo end

On VM IO is the bottleneck

loading webpages running testsuites are READ heavy

move IO outside shared folders

Default provider virtualbox

3 PHP test suites with unit functional integration mix

small (sf1) build runs in ~25 sec

medium (zf2) build runs in ~2 mins

large (sf2) build runs ~ 20 mins

IO logs cache

class AppKernel extends Kernel public function getCacheDir() if (in_array($this-gtenvironment array(dev test))) return devshmappnamecache $this-gtenvironment

return parentgetCacheDir()

public function getLogDir() if (in_array($this-gtenvironment array(dev lsquotest))) return devshmappnamelogs

return parentgetLogDir()

class AppKernel extends Kernel public function getCacheDir() if (in_array($this-gtenvironment array(dev test))) return devshmappnamecache $this-gtenvironment

return parentgetCacheDir()

public function getLogDir() if (in_array($this-gtenvironment array(dev lsquotest))) return devshmappnamelogs

return parentgetLogDir()

+13-16

IO move DB on RAMif you use sqlite move it on devshm

vagrant plugin install vagrantcachier

if Vagranthas_plugin(vagrant-cachier) configcachescope = box

configcachesynced_folder_opts = type nfs mount_options [rwvers=3tcpnolock] end

Vagrantfile

if Vagranthas_plugin(vagrant-cachier) configcachescope = box

configcachesynced_folder_opts = type nfs mount_options [rwvers=3tcpnolock] end

Vagrantfile

+30for reprovisioning a box with git php apache mysql

use cachefilesd for nfs

- name Install cachefilesd apt pkg=cachefilesd state=present

- name Enable cachefilesd lineinfile dest=etcdefaultcachefilesd line=ldquoRUN=yesrdquo

- name Start cachefilesd service service name=cachefilesd state=restarted

configvmsynced_folder varwww id ldquovagrant-rootrdquo type ldquonfsrdquo mount_options [rwvers=3tcpfsc]

Vagrantfile

configvmsynced_folder varwww id ldquovagrant-rootrdquo type ldquonfsrdquo mount_options [rwvers=3tcpfsc]

Vagrantfile

-15+10

should you trust these numbers

Application Management

How to access mysql

- name add mysql user mysql_user name=ideato host= password=ideato priv=ALLGRANT login_user=root login_password=

- name config bind address to allow remote remote connections lineinfile dest=etcmysqlmycnf state=present regexp=bind-address = 127001 line=bind-address = 0000 backup=yes

- name restart mysql service name=mysql state=restarted

Permissions management in shared folders

configvmsynced_folder varwww id vagrant-root owner vagrant group vagrant mount_options [dmode=777fmode=777]

Use host ssh keys

configsshforward_agent = true

ForwardAgent yes

check ssh config file in your host machine

gruntgulp watch

httpwwwsebastien-hanfrblog20121218noac-performance-impact-on-web-applications

configvmsynced_folder varwww id ldquovagrant-rootrdquo type ldquonfsrdquo mount_options [lsquorwrsquovers=3tcpfsc actimeo=1]

Provisioning

to phansible or not to phansible

quick and easy way to start

theyrsquore general

old platforms are not supported

a lot of a good ideas you can steal from

if which(ansible-playbook) configvmprovision ansible do |ansible| ansibleplaybook = ansibleplaybookyml ansibleinventory_path = ansibleinventoriesdev ansiblelimit = all ansibleextra_vars = private_interface 1921683399 hostname default end else configvmprovision shell path ansiblewindowssh args [default] end

can you assume everyone in your team have the same version

if which(ansible-playbook) configvmprovision ansible do |ansible| ansibleplaybook = ansibleplaybookyml ansibleinventory_path = ansibleinventoriesdev ansiblelimit = all ansibleextra_vars = private_interface 1921683399 hostname default end else configvmprovision shell path ansiblewindowssh args [default] end

the provisioning tool is a moving part wanna update be careful

create Vagrant indipendent provision

scripts

configvmprovision shell path =gt scriptsbootstrapsh args =gt varwww

configvmprovision shell path =gt ldquoscriptsprovisionsh args =gt varwww

create your own template

httpsgithubcomideatosrlvagrant-php-template

yoursquore in control of provisioning command

you can perform additional checks on host machine

Distributing VMs

provisioning does not create immutable vm by default

eg package update on LTS

live on the edge and fix provision script

use stable package repositories

httpsspeakerdeckcommitchellhvagrant-usage-patterns

Create and distribute your own VM

Golden image

vagrant package - -name myboxbox

publish it somewhere (http atlas)

cvmbox_url = ldquohttpmyboxboxrdquo

- Donrsquot make assumptions about the host

- Provision first then bake your own image

- The more moving part the harder will get

Keep it simple

Thank you

_orso_

micheleorselli ideatosrl

moideatoit

On VM IO is the bottleneck

loading webpages running testsuites are READ heavy

move IO outside shared folders

Default provider virtualbox

3 PHP test suites with unit functional integration mix

small (sf1) build runs in ~25 sec

medium (zf2) build runs in ~2 mins

large (sf2) build runs ~ 20 mins

IO logs cache

class AppKernel extends Kernel public function getCacheDir() if (in_array($this-gtenvironment array(dev test))) return devshmappnamecache $this-gtenvironment

return parentgetCacheDir()

public function getLogDir() if (in_array($this-gtenvironment array(dev lsquotest))) return devshmappnamelogs

return parentgetLogDir()

class AppKernel extends Kernel public function getCacheDir() if (in_array($this-gtenvironment array(dev test))) return devshmappnamecache $this-gtenvironment

return parentgetCacheDir()

public function getLogDir() if (in_array($this-gtenvironment array(dev lsquotest))) return devshmappnamelogs

return parentgetLogDir()

+13-16

IO move DB on RAMif you use sqlite move it on devshm

vagrant plugin install vagrantcachier

if Vagranthas_plugin(vagrant-cachier) configcachescope = box

configcachesynced_folder_opts = type nfs mount_options [rwvers=3tcpnolock] end

Vagrantfile

if Vagranthas_plugin(vagrant-cachier) configcachescope = box

configcachesynced_folder_opts = type nfs mount_options [rwvers=3tcpnolock] end

Vagrantfile

+30for reprovisioning a box with git php apache mysql

use cachefilesd for nfs

- name Install cachefilesd apt pkg=cachefilesd state=present

- name Enable cachefilesd lineinfile dest=etcdefaultcachefilesd line=ldquoRUN=yesrdquo

- name Start cachefilesd service service name=cachefilesd state=restarted

configvmsynced_folder varwww id ldquovagrant-rootrdquo type ldquonfsrdquo mount_options [rwvers=3tcpfsc]

Vagrantfile

configvmsynced_folder varwww id ldquovagrant-rootrdquo type ldquonfsrdquo mount_options [rwvers=3tcpfsc]

Vagrantfile

-15+10

should you trust these numbers

Application Management

How to access mysql

- name add mysql user mysql_user name=ideato host= password=ideato priv=ALLGRANT login_user=root login_password=

- name config bind address to allow remote remote connections lineinfile dest=etcmysqlmycnf state=present regexp=bind-address = 127001 line=bind-address = 0000 backup=yes

- name restart mysql service name=mysql state=restarted

Permissions management in shared folders

configvmsynced_folder varwww id vagrant-root owner vagrant group vagrant mount_options [dmode=777fmode=777]

Use host ssh keys

configsshforward_agent = true

ForwardAgent yes

check ssh config file in your host machine

gruntgulp watch

httpwwwsebastien-hanfrblog20121218noac-performance-impact-on-web-applications

configvmsynced_folder varwww id ldquovagrant-rootrdquo type ldquonfsrdquo mount_options [lsquorwrsquovers=3tcpfsc actimeo=1]

Provisioning

to phansible or not to phansible

quick and easy way to start

theyrsquore general

old platforms are not supported

a lot of a good ideas you can steal from

if which(ansible-playbook) configvmprovision ansible do |ansible| ansibleplaybook = ansibleplaybookyml ansibleinventory_path = ansibleinventoriesdev ansiblelimit = all ansibleextra_vars = private_interface 1921683399 hostname default end else configvmprovision shell path ansiblewindowssh args [default] end

can you assume everyone in your team have the same version

if which(ansible-playbook) configvmprovision ansible do |ansible| ansibleplaybook = ansibleplaybookyml ansibleinventory_path = ansibleinventoriesdev ansiblelimit = all ansibleextra_vars = private_interface 1921683399 hostname default end else configvmprovision shell path ansiblewindowssh args [default] end

the provisioning tool is a moving part wanna update be careful

create Vagrant indipendent provision

scripts

configvmprovision shell path =gt scriptsbootstrapsh args =gt varwww

configvmprovision shell path =gt ldquoscriptsprovisionsh args =gt varwww

create your own template

httpsgithubcomideatosrlvagrant-php-template

yoursquore in control of provisioning command

you can perform additional checks on host machine

Distributing VMs

provisioning does not create immutable vm by default

eg package update on LTS

live on the edge and fix provision script

use stable package repositories

httpsspeakerdeckcommitchellhvagrant-usage-patterns

Create and distribute your own VM

Golden image

vagrant package - -name myboxbox

publish it somewhere (http atlas)

cvmbox_url = ldquohttpmyboxboxrdquo

- Donrsquot make assumptions about the host

- Provision first then bake your own image

- The more moving part the harder will get

Keep it simple

Thank you

_orso_

micheleorselli ideatosrl

moideatoit

loading webpages running testsuites are READ heavy

move IO outside shared folders

Default provider virtualbox

3 PHP test suites with unit functional integration mix

small (sf1) build runs in ~25 sec

medium (zf2) build runs in ~2 mins

large (sf2) build runs ~ 20 mins

IO logs cache

class AppKernel extends Kernel public function getCacheDir() if (in_array($this-gtenvironment array(dev test))) return devshmappnamecache $this-gtenvironment

return parentgetCacheDir()

public function getLogDir() if (in_array($this-gtenvironment array(dev lsquotest))) return devshmappnamelogs

return parentgetLogDir()

class AppKernel extends Kernel public function getCacheDir() if (in_array($this-gtenvironment array(dev test))) return devshmappnamecache $this-gtenvironment

return parentgetCacheDir()

public function getLogDir() if (in_array($this-gtenvironment array(dev lsquotest))) return devshmappnamelogs

return parentgetLogDir()

+13-16

IO move DB on RAMif you use sqlite move it on devshm

vagrant plugin install vagrantcachier

if Vagranthas_plugin(vagrant-cachier) configcachescope = box

configcachesynced_folder_opts = type nfs mount_options [rwvers=3tcpnolock] end

Vagrantfile

if Vagranthas_plugin(vagrant-cachier) configcachescope = box

configcachesynced_folder_opts = type nfs mount_options [rwvers=3tcpnolock] end

Vagrantfile

+30for reprovisioning a box with git php apache mysql

use cachefilesd for nfs

- name Install cachefilesd apt pkg=cachefilesd state=present

- name Enable cachefilesd lineinfile dest=etcdefaultcachefilesd line=ldquoRUN=yesrdquo

- name Start cachefilesd service service name=cachefilesd state=restarted

configvmsynced_folder varwww id ldquovagrant-rootrdquo type ldquonfsrdquo mount_options [rwvers=3tcpfsc]

Vagrantfile

configvmsynced_folder varwww id ldquovagrant-rootrdquo type ldquonfsrdquo mount_options [rwvers=3tcpfsc]

Vagrantfile

-15+10

should you trust these numbers

Application Management

How to access mysql

- name add mysql user mysql_user name=ideato host= password=ideato priv=ALLGRANT login_user=root login_password=

- name config bind address to allow remote remote connections lineinfile dest=etcmysqlmycnf state=present regexp=bind-address = 127001 line=bind-address = 0000 backup=yes

- name restart mysql service name=mysql state=restarted

Permissions management in shared folders

configvmsynced_folder varwww id vagrant-root owner vagrant group vagrant mount_options [dmode=777fmode=777]

Use host ssh keys

configsshforward_agent = true

ForwardAgent yes

check ssh config file in your host machine

gruntgulp watch

httpwwwsebastien-hanfrblog20121218noac-performance-impact-on-web-applications

configvmsynced_folder varwww id ldquovagrant-rootrdquo type ldquonfsrdquo mount_options [lsquorwrsquovers=3tcpfsc actimeo=1]

Provisioning

to phansible or not to phansible

quick and easy way to start

theyrsquore general

old platforms are not supported

a lot of a good ideas you can steal from

if which(ansible-playbook) configvmprovision ansible do |ansible| ansibleplaybook = ansibleplaybookyml ansibleinventory_path = ansibleinventoriesdev ansiblelimit = all ansibleextra_vars = private_interface 1921683399 hostname default end else configvmprovision shell path ansiblewindowssh args [default] end

can you assume everyone in your team have the same version

if which(ansible-playbook) configvmprovision ansible do |ansible| ansibleplaybook = ansibleplaybookyml ansibleinventory_path = ansibleinventoriesdev ansiblelimit = all ansibleextra_vars = private_interface 1921683399 hostname default end else configvmprovision shell path ansiblewindowssh args [default] end

the provisioning tool is a moving part wanna update be careful

create Vagrant indipendent provision

scripts

configvmprovision shell path =gt scriptsbootstrapsh args =gt varwww

configvmprovision shell path =gt ldquoscriptsprovisionsh args =gt varwww

create your own template

httpsgithubcomideatosrlvagrant-php-template

yoursquore in control of provisioning command

you can perform additional checks on host machine

Distributing VMs

provisioning does not create immutable vm by default

eg package update on LTS

live on the edge and fix provision script

use stable package repositories

httpsspeakerdeckcommitchellhvagrant-usage-patterns

Create and distribute your own VM

Golden image

vagrant package - -name myboxbox

publish it somewhere (http atlas)

cvmbox_url = ldquohttpmyboxboxrdquo

- Donrsquot make assumptions about the host

- Provision first then bake your own image

- The more moving part the harder will get

Keep it simple

Thank you

_orso_

micheleorselli ideatosrl

moideatoit

move IO outside shared folders

Default provider virtualbox

3 PHP test suites with unit functional integration mix

small (sf1) build runs in ~25 sec

medium (zf2) build runs in ~2 mins

large (sf2) build runs ~ 20 mins

IO logs cache

class AppKernel extends Kernel public function getCacheDir() if (in_array($this-gtenvironment array(dev test))) return devshmappnamecache $this-gtenvironment

return parentgetCacheDir()

public function getLogDir() if (in_array($this-gtenvironment array(dev lsquotest))) return devshmappnamelogs

return parentgetLogDir()

class AppKernel extends Kernel public function getCacheDir() if (in_array($this-gtenvironment array(dev test))) return devshmappnamecache $this-gtenvironment

return parentgetCacheDir()

public function getLogDir() if (in_array($this-gtenvironment array(dev lsquotest))) return devshmappnamelogs

return parentgetLogDir()

+13-16

IO move DB on RAMif you use sqlite move it on devshm

vagrant plugin install vagrantcachier

if Vagranthas_plugin(vagrant-cachier) configcachescope = box

configcachesynced_folder_opts = type nfs mount_options [rwvers=3tcpnolock] end

Vagrantfile

if Vagranthas_plugin(vagrant-cachier) configcachescope = box

configcachesynced_folder_opts = type nfs mount_options [rwvers=3tcpnolock] end

Vagrantfile

+30for reprovisioning a box with git php apache mysql

use cachefilesd for nfs

- name Install cachefilesd apt pkg=cachefilesd state=present

- name Enable cachefilesd lineinfile dest=etcdefaultcachefilesd line=ldquoRUN=yesrdquo

- name Start cachefilesd service service name=cachefilesd state=restarted

configvmsynced_folder varwww id ldquovagrant-rootrdquo type ldquonfsrdquo mount_options [rwvers=3tcpfsc]

Vagrantfile

configvmsynced_folder varwww id ldquovagrant-rootrdquo type ldquonfsrdquo mount_options [rwvers=3tcpfsc]

Vagrantfile

-15+10

should you trust these numbers

Application Management

How to access mysql

- name add mysql user mysql_user name=ideato host= password=ideato priv=ALLGRANT login_user=root login_password=

- name config bind address to allow remote remote connections lineinfile dest=etcmysqlmycnf state=present regexp=bind-address = 127001 line=bind-address = 0000 backup=yes

- name restart mysql service name=mysql state=restarted

Permissions management in shared folders

configvmsynced_folder varwww id vagrant-root owner vagrant group vagrant mount_options [dmode=777fmode=777]

Use host ssh keys

configsshforward_agent = true

ForwardAgent yes

check ssh config file in your host machine

gruntgulp watch

httpwwwsebastien-hanfrblog20121218noac-performance-impact-on-web-applications

configvmsynced_folder varwww id ldquovagrant-rootrdquo type ldquonfsrdquo mount_options [lsquorwrsquovers=3tcpfsc actimeo=1]

Provisioning

to phansible or not to phansible

quick and easy way to start

theyrsquore general

old platforms are not supported

a lot of a good ideas you can steal from

if which(ansible-playbook) configvmprovision ansible do |ansible| ansibleplaybook = ansibleplaybookyml ansibleinventory_path = ansibleinventoriesdev ansiblelimit = all ansibleextra_vars = private_interface 1921683399 hostname default end else configvmprovision shell path ansiblewindowssh args [default] end

can you assume everyone in your team have the same version

if which(ansible-playbook) configvmprovision ansible do |ansible| ansibleplaybook = ansibleplaybookyml ansibleinventory_path = ansibleinventoriesdev ansiblelimit = all ansibleextra_vars = private_interface 1921683399 hostname default end else configvmprovision shell path ansiblewindowssh args [default] end

the provisioning tool is a moving part wanna update be careful

create Vagrant indipendent provision

scripts

configvmprovision shell path =gt scriptsbootstrapsh args =gt varwww

configvmprovision shell path =gt ldquoscriptsprovisionsh args =gt varwww

create your own template

httpsgithubcomideatosrlvagrant-php-template

yoursquore in control of provisioning command

you can perform additional checks on host machine

Distributing VMs

provisioning does not create immutable vm by default

eg package update on LTS

live on the edge and fix provision script

use stable package repositories

httpsspeakerdeckcommitchellhvagrant-usage-patterns

Create and distribute your own VM

Golden image

vagrant package - -name myboxbox

publish it somewhere (http atlas)

cvmbox_url = ldquohttpmyboxboxrdquo

- Donrsquot make assumptions about the host

- Provision first then bake your own image

- The more moving part the harder will get

Keep it simple

Thank you

_orso_

micheleorselli ideatosrl

moideatoit

Default provider virtualbox

3 PHP test suites with unit functional integration mix

small (sf1) build runs in ~25 sec

medium (zf2) build runs in ~2 mins

large (sf2) build runs ~ 20 mins

IO logs cache

class AppKernel extends Kernel public function getCacheDir() if (in_array($this-gtenvironment array(dev test))) return devshmappnamecache $this-gtenvironment

return parentgetCacheDir()

public function getLogDir() if (in_array($this-gtenvironment array(dev lsquotest))) return devshmappnamelogs

return parentgetLogDir()

class AppKernel extends Kernel public function getCacheDir() if (in_array($this-gtenvironment array(dev test))) return devshmappnamecache $this-gtenvironment

return parentgetCacheDir()

public function getLogDir() if (in_array($this-gtenvironment array(dev lsquotest))) return devshmappnamelogs

return parentgetLogDir()

+13-16

IO move DB on RAMif you use sqlite move it on devshm

vagrant plugin install vagrantcachier

if Vagranthas_plugin(vagrant-cachier) configcachescope = box

configcachesynced_folder_opts = type nfs mount_options [rwvers=3tcpnolock] end

Vagrantfile

if Vagranthas_plugin(vagrant-cachier) configcachescope = box

configcachesynced_folder_opts = type nfs mount_options [rwvers=3tcpnolock] end

Vagrantfile

+30for reprovisioning a box with git php apache mysql

use cachefilesd for nfs

- name Install cachefilesd apt pkg=cachefilesd state=present

- name Enable cachefilesd lineinfile dest=etcdefaultcachefilesd line=ldquoRUN=yesrdquo

- name Start cachefilesd service service name=cachefilesd state=restarted

configvmsynced_folder varwww id ldquovagrant-rootrdquo type ldquonfsrdquo mount_options [rwvers=3tcpfsc]

Vagrantfile

configvmsynced_folder varwww id ldquovagrant-rootrdquo type ldquonfsrdquo mount_options [rwvers=3tcpfsc]

Vagrantfile

-15+10

should you trust these numbers

Application Management

How to access mysql

- name add mysql user mysql_user name=ideato host= password=ideato priv=ALLGRANT login_user=root login_password=

- name config bind address to allow remote remote connections lineinfile dest=etcmysqlmycnf state=present regexp=bind-address = 127001 line=bind-address = 0000 backup=yes

- name restart mysql service name=mysql state=restarted

Permissions management in shared folders

configvmsynced_folder varwww id vagrant-root owner vagrant group vagrant mount_options [dmode=777fmode=777]

Use host ssh keys

configsshforward_agent = true

ForwardAgent yes

check ssh config file in your host machine

gruntgulp watch

httpwwwsebastien-hanfrblog20121218noac-performance-impact-on-web-applications

configvmsynced_folder varwww id ldquovagrant-rootrdquo type ldquonfsrdquo mount_options [lsquorwrsquovers=3tcpfsc actimeo=1]

Provisioning

to phansible or not to phansible

quick and easy way to start

theyrsquore general

old platforms are not supported

a lot of a good ideas you can steal from

if which(ansible-playbook) configvmprovision ansible do |ansible| ansibleplaybook = ansibleplaybookyml ansibleinventory_path = ansibleinventoriesdev ansiblelimit = all ansibleextra_vars = private_interface 1921683399 hostname default end else configvmprovision shell path ansiblewindowssh args [default] end

can you assume everyone in your team have the same version

if which(ansible-playbook) configvmprovision ansible do |ansible| ansibleplaybook = ansibleplaybookyml ansibleinventory_path = ansibleinventoriesdev ansiblelimit = all ansibleextra_vars = private_interface 1921683399 hostname default end else configvmprovision shell path ansiblewindowssh args [default] end

the provisioning tool is a moving part wanna update be careful

create Vagrant indipendent provision

scripts

configvmprovision shell path =gt scriptsbootstrapsh args =gt varwww

configvmprovision shell path =gt ldquoscriptsprovisionsh args =gt varwww

create your own template

httpsgithubcomideatosrlvagrant-php-template

yoursquore in control of provisioning command

you can perform additional checks on host machine

Distributing VMs

provisioning does not create immutable vm by default

eg package update on LTS

live on the edge and fix provision script

use stable package repositories

httpsspeakerdeckcommitchellhvagrant-usage-patterns

Create and distribute your own VM

Golden image

vagrant package - -name myboxbox

publish it somewhere (http atlas)

cvmbox_url = ldquohttpmyboxboxrdquo

- Donrsquot make assumptions about the host

- Provision first then bake your own image

- The more moving part the harder will get

Keep it simple

Thank you

_orso_

micheleorselli ideatosrl

moideatoit

IO logs cache

class AppKernel extends Kernel public function getCacheDir() if (in_array($this-gtenvironment array(dev test))) return devshmappnamecache $this-gtenvironment

return parentgetCacheDir()

public function getLogDir() if (in_array($this-gtenvironment array(dev lsquotest))) return devshmappnamelogs

return parentgetLogDir()

class AppKernel extends Kernel public function getCacheDir() if (in_array($this-gtenvironment array(dev test))) return devshmappnamecache $this-gtenvironment

return parentgetCacheDir()

public function getLogDir() if (in_array($this-gtenvironment array(dev lsquotest))) return devshmappnamelogs

return parentgetLogDir()

+13-16

IO move DB on RAMif you use sqlite move it on devshm

vagrant plugin install vagrantcachier

if Vagranthas_plugin(vagrant-cachier) configcachescope = box

configcachesynced_folder_opts = type nfs mount_options [rwvers=3tcpnolock] end

Vagrantfile

if Vagranthas_plugin(vagrant-cachier) configcachescope = box

configcachesynced_folder_opts = type nfs mount_options [rwvers=3tcpnolock] end

Vagrantfile

+30for reprovisioning a box with git php apache mysql

use cachefilesd for nfs

- name Install cachefilesd apt pkg=cachefilesd state=present

- name Enable cachefilesd lineinfile dest=etcdefaultcachefilesd line=ldquoRUN=yesrdquo

- name Start cachefilesd service service name=cachefilesd state=restarted

configvmsynced_folder varwww id ldquovagrant-rootrdquo type ldquonfsrdquo mount_options [rwvers=3tcpfsc]

Vagrantfile

configvmsynced_folder varwww id ldquovagrant-rootrdquo type ldquonfsrdquo mount_options [rwvers=3tcpfsc]

Vagrantfile

-15+10

should you trust these numbers

Application Management

How to access mysql

- name add mysql user mysql_user name=ideato host= password=ideato priv=ALLGRANT login_user=root login_password=

- name config bind address to allow remote remote connections lineinfile dest=etcmysqlmycnf state=present regexp=bind-address = 127001 line=bind-address = 0000 backup=yes

- name restart mysql service name=mysql state=restarted

Permissions management in shared folders

configvmsynced_folder varwww id vagrant-root owner vagrant group vagrant mount_options [dmode=777fmode=777]

Use host ssh keys

configsshforward_agent = true

ForwardAgent yes

check ssh config file in your host machine

gruntgulp watch

httpwwwsebastien-hanfrblog20121218noac-performance-impact-on-web-applications

configvmsynced_folder varwww id ldquovagrant-rootrdquo type ldquonfsrdquo mount_options [lsquorwrsquovers=3tcpfsc actimeo=1]

Provisioning

to phansible or not to phansible

quick and easy way to start

theyrsquore general

old platforms are not supported

a lot of a good ideas you can steal from

if which(ansible-playbook) configvmprovision ansible do |ansible| ansibleplaybook = ansibleplaybookyml ansibleinventory_path = ansibleinventoriesdev ansiblelimit = all ansibleextra_vars = private_interface 1921683399 hostname default end else configvmprovision shell path ansiblewindowssh args [default] end

can you assume everyone in your team have the same version

if which(ansible-playbook) configvmprovision ansible do |ansible| ansibleplaybook = ansibleplaybookyml ansibleinventory_path = ansibleinventoriesdev ansiblelimit = all ansibleextra_vars = private_interface 1921683399 hostname default end else configvmprovision shell path ansiblewindowssh args [default] end

the provisioning tool is a moving part wanna update be careful

create Vagrant indipendent provision

scripts

configvmprovision shell path =gt scriptsbootstrapsh args =gt varwww

configvmprovision shell path =gt ldquoscriptsprovisionsh args =gt varwww

create your own template

httpsgithubcomideatosrlvagrant-php-template

yoursquore in control of provisioning command

you can perform additional checks on host machine

Distributing VMs

provisioning does not create immutable vm by default

eg package update on LTS

live on the edge and fix provision script

use stable package repositories

httpsspeakerdeckcommitchellhvagrant-usage-patterns

Create and distribute your own VM

Golden image

vagrant package - -name myboxbox

publish it somewhere (http atlas)

cvmbox_url = ldquohttpmyboxboxrdquo

- Donrsquot make assumptions about the host

- Provision first then bake your own image

- The more moving part the harder will get

Keep it simple

Thank you

_orso_

micheleorselli ideatosrl

moideatoit

class AppKernel extends Kernel public function getCacheDir() if (in_array($this-gtenvironment array(dev test))) return devshmappnamecache $this-gtenvironment

return parentgetCacheDir()

public function getLogDir() if (in_array($this-gtenvironment array(dev lsquotest))) return devshmappnamelogs

return parentgetLogDir()

class AppKernel extends Kernel public function getCacheDir() if (in_array($this-gtenvironment array(dev test))) return devshmappnamecache $this-gtenvironment

return parentgetCacheDir()

public function getLogDir() if (in_array($this-gtenvironment array(dev lsquotest))) return devshmappnamelogs

return parentgetLogDir()

+13-16

IO move DB on RAMif you use sqlite move it on devshm

vagrant plugin install vagrantcachier

if Vagranthas_plugin(vagrant-cachier) configcachescope = box

configcachesynced_folder_opts = type nfs mount_options [rwvers=3tcpnolock] end

Vagrantfile

if Vagranthas_plugin(vagrant-cachier) configcachescope = box

configcachesynced_folder_opts = type nfs mount_options [rwvers=3tcpnolock] end

Vagrantfile

+30for reprovisioning a box with git php apache mysql

use cachefilesd for nfs

- name Install cachefilesd apt pkg=cachefilesd state=present

- name Enable cachefilesd lineinfile dest=etcdefaultcachefilesd line=ldquoRUN=yesrdquo

- name Start cachefilesd service service name=cachefilesd state=restarted

configvmsynced_folder varwww id ldquovagrant-rootrdquo type ldquonfsrdquo mount_options [rwvers=3tcpfsc]

Vagrantfile

configvmsynced_folder varwww id ldquovagrant-rootrdquo type ldquonfsrdquo mount_options [rwvers=3tcpfsc]

Vagrantfile

-15+10

should you trust these numbers

Application Management

How to access mysql

- name add mysql user mysql_user name=ideato host= password=ideato priv=ALLGRANT login_user=root login_password=

- name config bind address to allow remote remote connections lineinfile dest=etcmysqlmycnf state=present regexp=bind-address = 127001 line=bind-address = 0000 backup=yes

- name restart mysql service name=mysql state=restarted

Permissions management in shared folders

configvmsynced_folder varwww id vagrant-root owner vagrant group vagrant mount_options [dmode=777fmode=777]

Use host ssh keys

configsshforward_agent = true

ForwardAgent yes

check ssh config file in your host machine

gruntgulp watch

httpwwwsebastien-hanfrblog20121218noac-performance-impact-on-web-applications

configvmsynced_folder varwww id ldquovagrant-rootrdquo type ldquonfsrdquo mount_options [lsquorwrsquovers=3tcpfsc actimeo=1]

Provisioning

to phansible or not to phansible

quick and easy way to start

theyrsquore general

old platforms are not supported

a lot of a good ideas you can steal from

if which(ansible-playbook) configvmprovision ansible do |ansible| ansibleplaybook = ansibleplaybookyml ansibleinventory_path = ansibleinventoriesdev ansiblelimit = all ansibleextra_vars = private_interface 1921683399 hostname default end else configvmprovision shell path ansiblewindowssh args [default] end

can you assume everyone in your team have the same version

if which(ansible-playbook) configvmprovision ansible do |ansible| ansibleplaybook = ansibleplaybookyml ansibleinventory_path = ansibleinventoriesdev ansiblelimit = all ansibleextra_vars = private_interface 1921683399 hostname default end else configvmprovision shell path ansiblewindowssh args [default] end

the provisioning tool is a moving part wanna update be careful

create Vagrant indipendent provision

scripts

configvmprovision shell path =gt scriptsbootstrapsh args =gt varwww

configvmprovision shell path =gt ldquoscriptsprovisionsh args =gt varwww

create your own template

httpsgithubcomideatosrlvagrant-php-template

yoursquore in control of provisioning command

you can perform additional checks on host machine

Distributing VMs

provisioning does not create immutable vm by default

eg package update on LTS

live on the edge and fix provision script

use stable package repositories

httpsspeakerdeckcommitchellhvagrant-usage-patterns

Create and distribute your own VM

Golden image

vagrant package - -name myboxbox

publish it somewhere (http atlas)

cvmbox_url = ldquohttpmyboxboxrdquo

- Donrsquot make assumptions about the host

- Provision first then bake your own image

- The more moving part the harder will get

Keep it simple

Thank you

_orso_

micheleorselli ideatosrl

moideatoit

class AppKernel extends Kernel public function getCacheDir() if (in_array($this-gtenvironment array(dev test))) return devshmappnamecache $this-gtenvironment

return parentgetCacheDir()

public function getLogDir() if (in_array($this-gtenvironment array(dev lsquotest))) return devshmappnamelogs

return parentgetLogDir()

+13-16

IO move DB on RAMif you use sqlite move it on devshm

vagrant plugin install vagrantcachier

if Vagranthas_plugin(vagrant-cachier) configcachescope = box

configcachesynced_folder_opts = type nfs mount_options [rwvers=3tcpnolock] end

Vagrantfile

if Vagranthas_plugin(vagrant-cachier) configcachescope = box

configcachesynced_folder_opts = type nfs mount_options [rwvers=3tcpnolock] end

Vagrantfile

+30for reprovisioning a box with git php apache mysql

use cachefilesd for nfs

- name Install cachefilesd apt pkg=cachefilesd state=present

- name Enable cachefilesd lineinfile dest=etcdefaultcachefilesd line=ldquoRUN=yesrdquo

- name Start cachefilesd service service name=cachefilesd state=restarted

configvmsynced_folder varwww id ldquovagrant-rootrdquo type ldquonfsrdquo mount_options [rwvers=3tcpfsc]

Vagrantfile

configvmsynced_folder varwww id ldquovagrant-rootrdquo type ldquonfsrdquo mount_options [rwvers=3tcpfsc]

Vagrantfile

-15+10

should you trust these numbers

Application Management

How to access mysql

- name add mysql user mysql_user name=ideato host= password=ideato priv=ALLGRANT login_user=root login_password=

- name config bind address to allow remote remote connections lineinfile dest=etcmysqlmycnf state=present regexp=bind-address = 127001 line=bind-address = 0000 backup=yes

- name restart mysql service name=mysql state=restarted

Permissions management in shared folders

configvmsynced_folder varwww id vagrant-root owner vagrant group vagrant mount_options [dmode=777fmode=777]

Use host ssh keys

configsshforward_agent = true

ForwardAgent yes

check ssh config file in your host machine

gruntgulp watch

httpwwwsebastien-hanfrblog20121218noac-performance-impact-on-web-applications

configvmsynced_folder varwww id ldquovagrant-rootrdquo type ldquonfsrdquo mount_options [lsquorwrsquovers=3tcpfsc actimeo=1]

Provisioning

to phansible or not to phansible

quick and easy way to start

theyrsquore general

old platforms are not supported

a lot of a good ideas you can steal from

if which(ansible-playbook) configvmprovision ansible do |ansible| ansibleplaybook = ansibleplaybookyml ansibleinventory_path = ansibleinventoriesdev ansiblelimit = all ansibleextra_vars = private_interface 1921683399 hostname default end else configvmprovision shell path ansiblewindowssh args [default] end

can you assume everyone in your team have the same version

if which(ansible-playbook) configvmprovision ansible do |ansible| ansibleplaybook = ansibleplaybookyml ansibleinventory_path = ansibleinventoriesdev ansiblelimit = all ansibleextra_vars = private_interface 1921683399 hostname default end else configvmprovision shell path ansiblewindowssh args [default] end

the provisioning tool is a moving part wanna update be careful

create Vagrant indipendent provision

scripts

configvmprovision shell path =gt scriptsbootstrapsh args =gt varwww

configvmprovision shell path =gt ldquoscriptsprovisionsh args =gt varwww

create your own template

httpsgithubcomideatosrlvagrant-php-template

yoursquore in control of provisioning command

you can perform additional checks on host machine

Distributing VMs

provisioning does not create immutable vm by default

eg package update on LTS

live on the edge and fix provision script

use stable package repositories

httpsspeakerdeckcommitchellhvagrant-usage-patterns

Create and distribute your own VM

Golden image

vagrant package - -name myboxbox

publish it somewhere (http atlas)

cvmbox_url = ldquohttpmyboxboxrdquo

- Donrsquot make assumptions about the host

- Provision first then bake your own image

- The more moving part the harder will get

Keep it simple

Thank you

_orso_

micheleorselli ideatosrl

moideatoit

IO move DB on RAMif you use sqlite move it on devshm

vagrant plugin install vagrantcachier

if Vagranthas_plugin(vagrant-cachier) configcachescope = box

configcachesynced_folder_opts = type nfs mount_options [rwvers=3tcpnolock] end

Vagrantfile

if Vagranthas_plugin(vagrant-cachier) configcachescope = box

configcachesynced_folder_opts = type nfs mount_options [rwvers=3tcpnolock] end

Vagrantfile

+30for reprovisioning a box with git php apache mysql

use cachefilesd for nfs

- name Install cachefilesd apt pkg=cachefilesd state=present

- name Enable cachefilesd lineinfile dest=etcdefaultcachefilesd line=ldquoRUN=yesrdquo

- name Start cachefilesd service service name=cachefilesd state=restarted

configvmsynced_folder varwww id ldquovagrant-rootrdquo type ldquonfsrdquo mount_options [rwvers=3tcpfsc]

Vagrantfile

configvmsynced_folder varwww id ldquovagrant-rootrdquo type ldquonfsrdquo mount_options [rwvers=3tcpfsc]

Vagrantfile

-15+10

should you trust these numbers

Application Management

How to access mysql

- name add mysql user mysql_user name=ideato host= password=ideato priv=ALLGRANT login_user=root login_password=

- name config bind address to allow remote remote connections lineinfile dest=etcmysqlmycnf state=present regexp=bind-address = 127001 line=bind-address = 0000 backup=yes

- name restart mysql service name=mysql state=restarted

Permissions management in shared folders

configvmsynced_folder varwww id vagrant-root owner vagrant group vagrant mount_options [dmode=777fmode=777]

Use host ssh keys

configsshforward_agent = true

ForwardAgent yes

check ssh config file in your host machine

gruntgulp watch

httpwwwsebastien-hanfrblog20121218noac-performance-impact-on-web-applications

configvmsynced_folder varwww id ldquovagrant-rootrdquo type ldquonfsrdquo mount_options [lsquorwrsquovers=3tcpfsc actimeo=1]

Provisioning

to phansible or not to phansible

quick and easy way to start

theyrsquore general

old platforms are not supported

a lot of a good ideas you can steal from

if which(ansible-playbook) configvmprovision ansible do |ansible| ansibleplaybook = ansibleplaybookyml ansibleinventory_path = ansibleinventoriesdev ansiblelimit = all ansibleextra_vars = private_interface 1921683399 hostname default end else configvmprovision shell path ansiblewindowssh args [default] end

can you assume everyone in your team have the same version

if which(ansible-playbook) configvmprovision ansible do |ansible| ansibleplaybook = ansibleplaybookyml ansibleinventory_path = ansibleinventoriesdev ansiblelimit = all ansibleextra_vars = private_interface 1921683399 hostname default end else configvmprovision shell path ansiblewindowssh args [default] end

the provisioning tool is a moving part wanna update be careful

create Vagrant indipendent provision

scripts

configvmprovision shell path =gt scriptsbootstrapsh args =gt varwww

configvmprovision shell path =gt ldquoscriptsprovisionsh args =gt varwww

create your own template

httpsgithubcomideatosrlvagrant-php-template

yoursquore in control of provisioning command

you can perform additional checks on host machine

Distributing VMs

provisioning does not create immutable vm by default

eg package update on LTS

live on the edge and fix provision script

use stable package repositories

httpsspeakerdeckcommitchellhvagrant-usage-patterns

Create and distribute your own VM

Golden image

vagrant package - -name myboxbox

publish it somewhere (http atlas)

cvmbox_url = ldquohttpmyboxboxrdquo

- Donrsquot make assumptions about the host

- Provision first then bake your own image

- The more moving part the harder will get

Keep it simple

Thank you

_orso_

micheleorselli ideatosrl

moideatoit

vagrant plugin install vagrantcachier

if Vagranthas_plugin(vagrant-cachier) configcachescope = box

configcachesynced_folder_opts = type nfs mount_options [rwvers=3tcpnolock] end

Vagrantfile

if Vagranthas_plugin(vagrant-cachier) configcachescope = box

configcachesynced_folder_opts = type nfs mount_options [rwvers=3tcpnolock] end

Vagrantfile

+30for reprovisioning a box with git php apache mysql

use cachefilesd for nfs

- name Install cachefilesd apt pkg=cachefilesd state=present

- name Enable cachefilesd lineinfile dest=etcdefaultcachefilesd line=ldquoRUN=yesrdquo

- name Start cachefilesd service service name=cachefilesd state=restarted

configvmsynced_folder varwww id ldquovagrant-rootrdquo type ldquonfsrdquo mount_options [rwvers=3tcpfsc]

Vagrantfile

configvmsynced_folder varwww id ldquovagrant-rootrdquo type ldquonfsrdquo mount_options [rwvers=3tcpfsc]

Vagrantfile

-15+10

should you trust these numbers

Application Management

How to access mysql

- name add mysql user mysql_user name=ideato host= password=ideato priv=ALLGRANT login_user=root login_password=

- name config bind address to allow remote remote connections lineinfile dest=etcmysqlmycnf state=present regexp=bind-address = 127001 line=bind-address = 0000 backup=yes

- name restart mysql service name=mysql state=restarted

Permissions management in shared folders

configvmsynced_folder varwww id vagrant-root owner vagrant group vagrant mount_options [dmode=777fmode=777]

Use host ssh keys

configsshforward_agent = true

ForwardAgent yes

check ssh config file in your host machine

gruntgulp watch

httpwwwsebastien-hanfrblog20121218noac-performance-impact-on-web-applications

configvmsynced_folder varwww id ldquovagrant-rootrdquo type ldquonfsrdquo mount_options [lsquorwrsquovers=3tcpfsc actimeo=1]

Provisioning

to phansible or not to phansible

quick and easy way to start

theyrsquore general

old platforms are not supported

a lot of a good ideas you can steal from

if which(ansible-playbook) configvmprovision ansible do |ansible| ansibleplaybook = ansibleplaybookyml ansibleinventory_path = ansibleinventoriesdev ansiblelimit = all ansibleextra_vars = private_interface 1921683399 hostname default end else configvmprovision shell path ansiblewindowssh args [default] end

can you assume everyone in your team have the same version

if which(ansible-playbook) configvmprovision ansible do |ansible| ansibleplaybook = ansibleplaybookyml ansibleinventory_path = ansibleinventoriesdev ansiblelimit = all ansibleextra_vars = private_interface 1921683399 hostname default end else configvmprovision shell path ansiblewindowssh args [default] end

the provisioning tool is a moving part wanna update be careful

create Vagrant indipendent provision

scripts

configvmprovision shell path =gt scriptsbootstrapsh args =gt varwww

configvmprovision shell path =gt ldquoscriptsprovisionsh args =gt varwww

create your own template

httpsgithubcomideatosrlvagrant-php-template

yoursquore in control of provisioning command

you can perform additional checks on host machine

Distributing VMs

provisioning does not create immutable vm by default

eg package update on LTS

live on the edge and fix provision script

use stable package repositories

httpsspeakerdeckcommitchellhvagrant-usage-patterns

Create and distribute your own VM

Golden image

vagrant package - -name myboxbox

publish it somewhere (http atlas)

cvmbox_url = ldquohttpmyboxboxrdquo

- Donrsquot make assumptions about the host

- Provision first then bake your own image

- The more moving part the harder will get

Keep it simple

Thank you

_orso_

micheleorselli ideatosrl

moideatoit

if Vagranthas_plugin(vagrant-cachier) configcachescope = box

configcachesynced_folder_opts = type nfs mount_options [rwvers=3tcpnolock] end

Vagrantfile

if Vagranthas_plugin(vagrant-cachier) configcachescope = box

configcachesynced_folder_opts = type nfs mount_options [rwvers=3tcpnolock] end

Vagrantfile

+30for reprovisioning a box with git php apache mysql

use cachefilesd for nfs

- name Install cachefilesd apt pkg=cachefilesd state=present

- name Enable cachefilesd lineinfile dest=etcdefaultcachefilesd line=ldquoRUN=yesrdquo

- name Start cachefilesd service service name=cachefilesd state=restarted

configvmsynced_folder varwww id ldquovagrant-rootrdquo type ldquonfsrdquo mount_options [rwvers=3tcpfsc]

Vagrantfile

configvmsynced_folder varwww id ldquovagrant-rootrdquo type ldquonfsrdquo mount_options [rwvers=3tcpfsc]

Vagrantfile

-15+10

should you trust these numbers

Application Management

How to access mysql

- name add mysql user mysql_user name=ideato host= password=ideato priv=ALLGRANT login_user=root login_password=

- name config bind address to allow remote remote connections lineinfile dest=etcmysqlmycnf state=present regexp=bind-address = 127001 line=bind-address = 0000 backup=yes

- name restart mysql service name=mysql state=restarted

Permissions management in shared folders

configvmsynced_folder varwww id vagrant-root owner vagrant group vagrant mount_options [dmode=777fmode=777]

Use host ssh keys

configsshforward_agent = true

ForwardAgent yes

check ssh config file in your host machine

gruntgulp watch

httpwwwsebastien-hanfrblog20121218noac-performance-impact-on-web-applications

configvmsynced_folder varwww id ldquovagrant-rootrdquo type ldquonfsrdquo mount_options [lsquorwrsquovers=3tcpfsc actimeo=1]

Provisioning

to phansible or not to phansible

quick and easy way to start

theyrsquore general

old platforms are not supported

a lot of a good ideas you can steal from

if which(ansible-playbook) configvmprovision ansible do |ansible| ansibleplaybook = ansibleplaybookyml ansibleinventory_path = ansibleinventoriesdev ansiblelimit = all ansibleextra_vars = private_interface 1921683399 hostname default end else configvmprovision shell path ansiblewindowssh args [default] end

can you assume everyone in your team have the same version

if which(ansible-playbook) configvmprovision ansible do |ansible| ansibleplaybook = ansibleplaybookyml ansibleinventory_path = ansibleinventoriesdev ansiblelimit = all ansibleextra_vars = private_interface 1921683399 hostname default end else configvmprovision shell path ansiblewindowssh args [default] end

the provisioning tool is a moving part wanna update be careful

create Vagrant indipendent provision

scripts

configvmprovision shell path =gt scriptsbootstrapsh args =gt varwww

configvmprovision shell path =gt ldquoscriptsprovisionsh args =gt varwww

create your own template

httpsgithubcomideatosrlvagrant-php-template

yoursquore in control of provisioning command

you can perform additional checks on host machine

Distributing VMs

provisioning does not create immutable vm by default

eg package update on LTS

live on the edge and fix provision script

use stable package repositories

httpsspeakerdeckcommitchellhvagrant-usage-patterns

Create and distribute your own VM

Golden image

vagrant package - -name myboxbox

publish it somewhere (http atlas)

cvmbox_url = ldquohttpmyboxboxrdquo

- Donrsquot make assumptions about the host

- Provision first then bake your own image

- The more moving part the harder will get

Keep it simple

Thank you

_orso_

micheleorselli ideatosrl

moideatoit

if Vagranthas_plugin(vagrant-cachier) configcachescope = box

configcachesynced_folder_opts = type nfs mount_options [rwvers=3tcpnolock] end

Vagrantfile

+30for reprovisioning a box with git php apache mysql

use cachefilesd for nfs

- name Install cachefilesd apt pkg=cachefilesd state=present

- name Enable cachefilesd lineinfile dest=etcdefaultcachefilesd line=ldquoRUN=yesrdquo

- name Start cachefilesd service service name=cachefilesd state=restarted

configvmsynced_folder varwww id ldquovagrant-rootrdquo type ldquonfsrdquo mount_options [rwvers=3tcpfsc]

Vagrantfile

configvmsynced_folder varwww id ldquovagrant-rootrdquo type ldquonfsrdquo mount_options [rwvers=3tcpfsc]

Vagrantfile

-15+10

should you trust these numbers

Application Management

How to access mysql

- name add mysql user mysql_user name=ideato host= password=ideato priv=ALLGRANT login_user=root login_password=

- name config bind address to allow remote remote connections lineinfile dest=etcmysqlmycnf state=present regexp=bind-address = 127001 line=bind-address = 0000 backup=yes

- name restart mysql service name=mysql state=restarted

Permissions management in shared folders

configvmsynced_folder varwww id vagrant-root owner vagrant group vagrant mount_options [dmode=777fmode=777]

Use host ssh keys

configsshforward_agent = true

ForwardAgent yes

check ssh config file in your host machine

gruntgulp watch

httpwwwsebastien-hanfrblog20121218noac-performance-impact-on-web-applications

configvmsynced_folder varwww id ldquovagrant-rootrdquo type ldquonfsrdquo mount_options [lsquorwrsquovers=3tcpfsc actimeo=1]

Provisioning

to phansible or not to phansible

quick and easy way to start

theyrsquore general

old platforms are not supported

a lot of a good ideas you can steal from

if which(ansible-playbook) configvmprovision ansible do |ansible| ansibleplaybook = ansibleplaybookyml ansibleinventory_path = ansibleinventoriesdev ansiblelimit = all ansibleextra_vars = private_interface 1921683399 hostname default end else configvmprovision shell path ansiblewindowssh args [default] end

can you assume everyone in your team have the same version

if which(ansible-playbook) configvmprovision ansible do |ansible| ansibleplaybook = ansibleplaybookyml ansibleinventory_path = ansibleinventoriesdev ansiblelimit = all ansibleextra_vars = private_interface 1921683399 hostname default end else configvmprovision shell path ansiblewindowssh args [default] end

the provisioning tool is a moving part wanna update be careful

create Vagrant indipendent provision

scripts

configvmprovision shell path =gt scriptsbootstrapsh args =gt varwww

configvmprovision shell path =gt ldquoscriptsprovisionsh args =gt varwww

create your own template

httpsgithubcomideatosrlvagrant-php-template

yoursquore in control of provisioning command

you can perform additional checks on host machine

Distributing VMs

provisioning does not create immutable vm by default

eg package update on LTS

live on the edge and fix provision script

use stable package repositories

httpsspeakerdeckcommitchellhvagrant-usage-patterns

Create and distribute your own VM

Golden image

vagrant package - -name myboxbox

publish it somewhere (http atlas)

cvmbox_url = ldquohttpmyboxboxrdquo

- Donrsquot make assumptions about the host

- Provision first then bake your own image

- The more moving part the harder will get

Keep it simple

Thank you

_orso_

micheleorselli ideatosrl

moideatoit

use cachefilesd for nfs

- name Install cachefilesd apt pkg=cachefilesd state=present

- name Enable cachefilesd lineinfile dest=etcdefaultcachefilesd line=ldquoRUN=yesrdquo

- name Start cachefilesd service service name=cachefilesd state=restarted

configvmsynced_folder varwww id ldquovagrant-rootrdquo type ldquonfsrdquo mount_options [rwvers=3tcpfsc]

Vagrantfile

configvmsynced_folder varwww id ldquovagrant-rootrdquo type ldquonfsrdquo mount_options [rwvers=3tcpfsc]

Vagrantfile

-15+10

should you trust these numbers

Application Management

How to access mysql

- name add mysql user mysql_user name=ideato host= password=ideato priv=ALLGRANT login_user=root login_password=

- name config bind address to allow remote remote connections lineinfile dest=etcmysqlmycnf state=present regexp=bind-address = 127001 line=bind-address = 0000 backup=yes

- name restart mysql service name=mysql state=restarted

Permissions management in shared folders

configvmsynced_folder varwww id vagrant-root owner vagrant group vagrant mount_options [dmode=777fmode=777]

Use host ssh keys

configsshforward_agent = true

ForwardAgent yes

check ssh config file in your host machine

gruntgulp watch

httpwwwsebastien-hanfrblog20121218noac-performance-impact-on-web-applications

configvmsynced_folder varwww id ldquovagrant-rootrdquo type ldquonfsrdquo mount_options [lsquorwrsquovers=3tcpfsc actimeo=1]

Provisioning

to phansible or not to phansible

quick and easy way to start

theyrsquore general

old platforms are not supported

a lot of a good ideas you can steal from

if which(ansible-playbook) configvmprovision ansible do |ansible| ansibleplaybook = ansibleplaybookyml ansibleinventory_path = ansibleinventoriesdev ansiblelimit = all ansibleextra_vars = private_interface 1921683399 hostname default end else configvmprovision shell path ansiblewindowssh args [default] end

can you assume everyone in your team have the same version

if which(ansible-playbook) configvmprovision ansible do |ansible| ansibleplaybook = ansibleplaybookyml ansibleinventory_path = ansibleinventoriesdev ansiblelimit = all ansibleextra_vars = private_interface 1921683399 hostname default end else configvmprovision shell path ansiblewindowssh args [default] end

the provisioning tool is a moving part wanna update be careful

create Vagrant indipendent provision

scripts

configvmprovision shell path =gt scriptsbootstrapsh args =gt varwww

configvmprovision shell path =gt ldquoscriptsprovisionsh args =gt varwww

create your own template

httpsgithubcomideatosrlvagrant-php-template

yoursquore in control of provisioning command

you can perform additional checks on host machine

Distributing VMs

provisioning does not create immutable vm by default

eg package update on LTS

live on the edge and fix provision script

use stable package repositories

httpsspeakerdeckcommitchellhvagrant-usage-patterns

Create and distribute your own VM

Golden image

vagrant package - -name myboxbox

publish it somewhere (http atlas)

cvmbox_url = ldquohttpmyboxboxrdquo

- Donrsquot make assumptions about the host

- Provision first then bake your own image

- The more moving part the harder will get

Keep it simple

Thank you

_orso_

micheleorselli ideatosrl

moideatoit

- name Install cachefilesd apt pkg=cachefilesd state=present

- name Enable cachefilesd lineinfile dest=etcdefaultcachefilesd line=ldquoRUN=yesrdquo

- name Start cachefilesd service service name=cachefilesd state=restarted

configvmsynced_folder varwww id ldquovagrant-rootrdquo type ldquonfsrdquo mount_options [rwvers=3tcpfsc]

Vagrantfile

configvmsynced_folder varwww id ldquovagrant-rootrdquo type ldquonfsrdquo mount_options [rwvers=3tcpfsc]

Vagrantfile

-15+10

should you trust these numbers

Application Management

How to access mysql

- name add mysql user mysql_user name=ideato host= password=ideato priv=ALLGRANT login_user=root login_password=

- name config bind address to allow remote remote connections lineinfile dest=etcmysqlmycnf state=present regexp=bind-address = 127001 line=bind-address = 0000 backup=yes

- name restart mysql service name=mysql state=restarted

Permissions management in shared folders

configvmsynced_folder varwww id vagrant-root owner vagrant group vagrant mount_options [dmode=777fmode=777]

Use host ssh keys

configsshforward_agent = true

ForwardAgent yes

check ssh config file in your host machine

gruntgulp watch

httpwwwsebastien-hanfrblog20121218noac-performance-impact-on-web-applications

configvmsynced_folder varwww id ldquovagrant-rootrdquo type ldquonfsrdquo mount_options [lsquorwrsquovers=3tcpfsc actimeo=1]

Provisioning

to phansible or not to phansible

quick and easy way to start

theyrsquore general

old platforms are not supported

a lot of a good ideas you can steal from

if which(ansible-playbook) configvmprovision ansible do |ansible| ansibleplaybook = ansibleplaybookyml ansibleinventory_path = ansibleinventoriesdev ansiblelimit = all ansibleextra_vars = private_interface 1921683399 hostname default end else configvmprovision shell path ansiblewindowssh args [default] end

can you assume everyone in your team have the same version

if which(ansible-playbook) configvmprovision ansible do |ansible| ansibleplaybook = ansibleplaybookyml ansibleinventory_path = ansibleinventoriesdev ansiblelimit = all ansibleextra_vars = private_interface 1921683399 hostname default end else configvmprovision shell path ansiblewindowssh args [default] end

the provisioning tool is a moving part wanna update be careful

create Vagrant indipendent provision

scripts

configvmprovision shell path =gt scriptsbootstrapsh args =gt varwww

configvmprovision shell path =gt ldquoscriptsprovisionsh args =gt varwww

create your own template

httpsgithubcomideatosrlvagrant-php-template

yoursquore in control of provisioning command

you can perform additional checks on host machine

Distributing VMs

provisioning does not create immutable vm by default

eg package update on LTS

live on the edge and fix provision script

use stable package repositories

httpsspeakerdeckcommitchellhvagrant-usage-patterns

Create and distribute your own VM

Golden image

vagrant package - -name myboxbox

publish it somewhere (http atlas)

cvmbox_url = ldquohttpmyboxboxrdquo

- Donrsquot make assumptions about the host

- Provision first then bake your own image

- The more moving part the harder will get

Keep it simple

Thank you

_orso_

micheleorselli ideatosrl

moideatoit

configvmsynced_folder varwww id ldquovagrant-rootrdquo type ldquonfsrdquo mount_options [rwvers=3tcpfsc]

Vagrantfile

configvmsynced_folder varwww id ldquovagrant-rootrdquo type ldquonfsrdquo mount_options [rwvers=3tcpfsc]

Vagrantfile

-15+10

should you trust these numbers

Application Management

How to access mysql

- name add mysql user mysql_user name=ideato host= password=ideato priv=ALLGRANT login_user=root login_password=

- name config bind address to allow remote remote connections lineinfile dest=etcmysqlmycnf state=present regexp=bind-address = 127001 line=bind-address = 0000 backup=yes

- name restart mysql service name=mysql state=restarted

Permissions management in shared folders

configvmsynced_folder varwww id vagrant-root owner vagrant group vagrant mount_options [dmode=777fmode=777]

Use host ssh keys

configsshforward_agent = true

ForwardAgent yes

check ssh config file in your host machine

gruntgulp watch

httpwwwsebastien-hanfrblog20121218noac-performance-impact-on-web-applications

configvmsynced_folder varwww id ldquovagrant-rootrdquo type ldquonfsrdquo mount_options [lsquorwrsquovers=3tcpfsc actimeo=1]

Provisioning

to phansible or not to phansible

quick and easy way to start

theyrsquore general

old platforms are not supported

a lot of a good ideas you can steal from

if which(ansible-playbook) configvmprovision ansible do |ansible| ansibleplaybook = ansibleplaybookyml ansibleinventory_path = ansibleinventoriesdev ansiblelimit = all ansibleextra_vars = private_interface 1921683399 hostname default end else configvmprovision shell path ansiblewindowssh args [default] end

can you assume everyone in your team have the same version

if which(ansible-playbook) configvmprovision ansible do |ansible| ansibleplaybook = ansibleplaybookyml ansibleinventory_path = ansibleinventoriesdev ansiblelimit = all ansibleextra_vars = private_interface 1921683399 hostname default end else configvmprovision shell path ansiblewindowssh args [default] end

the provisioning tool is a moving part wanna update be careful

create Vagrant indipendent provision

scripts

configvmprovision shell path =gt scriptsbootstrapsh args =gt varwww

configvmprovision shell path =gt ldquoscriptsprovisionsh args =gt varwww

create your own template

httpsgithubcomideatosrlvagrant-php-template

yoursquore in control of provisioning command

you can perform additional checks on host machine

Distributing VMs

provisioning does not create immutable vm by default

eg package update on LTS

live on the edge and fix provision script

use stable package repositories

httpsspeakerdeckcommitchellhvagrant-usage-patterns

Create and distribute your own VM

Golden image

vagrant package - -name myboxbox

publish it somewhere (http atlas)

cvmbox_url = ldquohttpmyboxboxrdquo

- Donrsquot make assumptions about the host

- Provision first then bake your own image

- The more moving part the harder will get

Keep it simple

Thank you

_orso_

micheleorselli ideatosrl

moideatoit

configvmsynced_folder varwww id ldquovagrant-rootrdquo type ldquonfsrdquo mount_options [rwvers=3tcpfsc]

Vagrantfile

-15+10

should you trust these numbers

Application Management

How to access mysql

- name add mysql user mysql_user name=ideato host= password=ideato priv=ALLGRANT login_user=root login_password=

- name config bind address to allow remote remote connections lineinfile dest=etcmysqlmycnf state=present regexp=bind-address = 127001 line=bind-address = 0000 backup=yes

- name restart mysql service name=mysql state=restarted

Permissions management in shared folders

configvmsynced_folder varwww id vagrant-root owner vagrant group vagrant mount_options [dmode=777fmode=777]

Use host ssh keys

configsshforward_agent = true

ForwardAgent yes

check ssh config file in your host machine

gruntgulp watch

httpwwwsebastien-hanfrblog20121218noac-performance-impact-on-web-applications

configvmsynced_folder varwww id ldquovagrant-rootrdquo type ldquonfsrdquo mount_options [lsquorwrsquovers=3tcpfsc actimeo=1]

Provisioning

to phansible or not to phansible

quick and easy way to start

theyrsquore general

old platforms are not supported

a lot of a good ideas you can steal from

if which(ansible-playbook) configvmprovision ansible do |ansible| ansibleplaybook = ansibleplaybookyml ansibleinventory_path = ansibleinventoriesdev ansiblelimit = all ansibleextra_vars = private_interface 1921683399 hostname default end else configvmprovision shell path ansiblewindowssh args [default] end

can you assume everyone in your team have the same version

if which(ansible-playbook) configvmprovision ansible do |ansible| ansibleplaybook = ansibleplaybookyml ansibleinventory_path = ansibleinventoriesdev ansiblelimit = all ansibleextra_vars = private_interface 1921683399 hostname default end else configvmprovision shell path ansiblewindowssh args [default] end

the provisioning tool is a moving part wanna update be careful

create Vagrant indipendent provision

scripts

configvmprovision shell path =gt scriptsbootstrapsh args =gt varwww

configvmprovision shell path =gt ldquoscriptsprovisionsh args =gt varwww

create your own template

httpsgithubcomideatosrlvagrant-php-template

yoursquore in control of provisioning command

you can perform additional checks on host machine

Distributing VMs

provisioning does not create immutable vm by default

eg package update on LTS

live on the edge and fix provision script

use stable package repositories

httpsspeakerdeckcommitchellhvagrant-usage-patterns

Create and distribute your own VM

Golden image

vagrant package - -name myboxbox

publish it somewhere (http atlas)

cvmbox_url = ldquohttpmyboxboxrdquo

- Donrsquot make assumptions about the host

- Provision first then bake your own image

- The more moving part the harder will get

Keep it simple

Thank you

_orso_

micheleorselli ideatosrl

moideatoit

should you trust these numbers

Application Management

How to access mysql

- name add mysql user mysql_user name=ideato host= password=ideato priv=ALLGRANT login_user=root login_password=

- name config bind address to allow remote remote connections lineinfile dest=etcmysqlmycnf state=present regexp=bind-address = 127001 line=bind-address = 0000 backup=yes

- name restart mysql service name=mysql state=restarted

Permissions management in shared folders

configvmsynced_folder varwww id vagrant-root owner vagrant group vagrant mount_options [dmode=777fmode=777]

Use host ssh keys

configsshforward_agent = true

ForwardAgent yes

check ssh config file in your host machine

gruntgulp watch

httpwwwsebastien-hanfrblog20121218noac-performance-impact-on-web-applications

configvmsynced_folder varwww id ldquovagrant-rootrdquo type ldquonfsrdquo mount_options [lsquorwrsquovers=3tcpfsc actimeo=1]

Provisioning

to phansible or not to phansible

quick and easy way to start

theyrsquore general

old platforms are not supported

a lot of a good ideas you can steal from

if which(ansible-playbook) configvmprovision ansible do |ansible| ansibleplaybook = ansibleplaybookyml ansibleinventory_path = ansibleinventoriesdev ansiblelimit = all ansibleextra_vars = private_interface 1921683399 hostname default end else configvmprovision shell path ansiblewindowssh args [default] end

can you assume everyone in your team have the same version

if which(ansible-playbook) configvmprovision ansible do |ansible| ansibleplaybook = ansibleplaybookyml ansibleinventory_path = ansibleinventoriesdev ansiblelimit = all ansibleextra_vars = private_interface 1921683399 hostname default end else configvmprovision shell path ansiblewindowssh args [default] end

the provisioning tool is a moving part wanna update be careful

create Vagrant indipendent provision

scripts

configvmprovision shell path =gt scriptsbootstrapsh args =gt varwww

configvmprovision shell path =gt ldquoscriptsprovisionsh args =gt varwww

create your own template

httpsgithubcomideatosrlvagrant-php-template

yoursquore in control of provisioning command

you can perform additional checks on host machine

Distributing VMs

provisioning does not create immutable vm by default

eg package update on LTS

live on the edge and fix provision script

use stable package repositories

httpsspeakerdeckcommitchellhvagrant-usage-patterns

Create and distribute your own VM

Golden image

vagrant package - -name myboxbox

publish it somewhere (http atlas)

cvmbox_url = ldquohttpmyboxboxrdquo

- Donrsquot make assumptions about the host

- Provision first then bake your own image

- The more moving part the harder will get

Keep it simple

Thank you

_orso_

micheleorselli ideatosrl

moideatoit

Application Management

How to access mysql

- name add mysql user mysql_user name=ideato host= password=ideato priv=ALLGRANT login_user=root login_password=

- name config bind address to allow remote remote connections lineinfile dest=etcmysqlmycnf state=present regexp=bind-address = 127001 line=bind-address = 0000 backup=yes

- name restart mysql service name=mysql state=restarted

Permissions management in shared folders

configvmsynced_folder varwww id vagrant-root owner vagrant group vagrant mount_options [dmode=777fmode=777]

Use host ssh keys

configsshforward_agent = true

ForwardAgent yes

check ssh config file in your host machine

gruntgulp watch

httpwwwsebastien-hanfrblog20121218noac-performance-impact-on-web-applications

configvmsynced_folder varwww id ldquovagrant-rootrdquo type ldquonfsrdquo mount_options [lsquorwrsquovers=3tcpfsc actimeo=1]

Provisioning

to phansible or not to phansible

quick and easy way to start

theyrsquore general

old platforms are not supported

a lot of a good ideas you can steal from

if which(ansible-playbook) configvmprovision ansible do |ansible| ansibleplaybook = ansibleplaybookyml ansibleinventory_path = ansibleinventoriesdev ansiblelimit = all ansibleextra_vars = private_interface 1921683399 hostname default end else configvmprovision shell path ansiblewindowssh args [default] end

can you assume everyone in your team have the same version

if which(ansible-playbook) configvmprovision ansible do |ansible| ansibleplaybook = ansibleplaybookyml ansibleinventory_path = ansibleinventoriesdev ansiblelimit = all ansibleextra_vars = private_interface 1921683399 hostname default end else configvmprovision shell path ansiblewindowssh args [default] end

the provisioning tool is a moving part wanna update be careful

create Vagrant indipendent provision

scripts

configvmprovision shell path =gt scriptsbootstrapsh args =gt varwww

configvmprovision shell path =gt ldquoscriptsprovisionsh args =gt varwww

create your own template

httpsgithubcomideatosrlvagrant-php-template

yoursquore in control of provisioning command

you can perform additional checks on host machine

Distributing VMs

provisioning does not create immutable vm by default

eg package update on LTS

live on the edge and fix provision script

use stable package repositories

httpsspeakerdeckcommitchellhvagrant-usage-patterns

Create and distribute your own VM

Golden image

vagrant package - -name myboxbox

publish it somewhere (http atlas)

cvmbox_url = ldquohttpmyboxboxrdquo

- Donrsquot make assumptions about the host

- Provision first then bake your own image

- The more moving part the harder will get

Keep it simple

Thank you

_orso_

micheleorselli ideatosrl

moideatoit

How to access mysql

- name add mysql user mysql_user name=ideato host= password=ideato priv=ALLGRANT login_user=root login_password=

- name config bind address to allow remote remote connections lineinfile dest=etcmysqlmycnf state=present regexp=bind-address = 127001 line=bind-address = 0000 backup=yes

- name restart mysql service name=mysql state=restarted

Permissions management in shared folders

configvmsynced_folder varwww id vagrant-root owner vagrant group vagrant mount_options [dmode=777fmode=777]

Use host ssh keys

configsshforward_agent = true

ForwardAgent yes

check ssh config file in your host machine

gruntgulp watch

httpwwwsebastien-hanfrblog20121218noac-performance-impact-on-web-applications

configvmsynced_folder varwww id ldquovagrant-rootrdquo type ldquonfsrdquo mount_options [lsquorwrsquovers=3tcpfsc actimeo=1]

Provisioning

to phansible or not to phansible

quick and easy way to start

theyrsquore general

old platforms are not supported

a lot of a good ideas you can steal from

if which(ansible-playbook) configvmprovision ansible do |ansible| ansibleplaybook = ansibleplaybookyml ansibleinventory_path = ansibleinventoriesdev ansiblelimit = all ansibleextra_vars = private_interface 1921683399 hostname default end else configvmprovision shell path ansiblewindowssh args [default] end

can you assume everyone in your team have the same version

if which(ansible-playbook) configvmprovision ansible do |ansible| ansibleplaybook = ansibleplaybookyml ansibleinventory_path = ansibleinventoriesdev ansiblelimit = all ansibleextra_vars = private_interface 1921683399 hostname default end else configvmprovision shell path ansiblewindowssh args [default] end

the provisioning tool is a moving part wanna update be careful

create Vagrant indipendent provision

scripts

configvmprovision shell path =gt scriptsbootstrapsh args =gt varwww

configvmprovision shell path =gt ldquoscriptsprovisionsh args =gt varwww

create your own template

httpsgithubcomideatosrlvagrant-php-template

yoursquore in control of provisioning command

you can perform additional checks on host machine

Distributing VMs

provisioning does not create immutable vm by default

eg package update on LTS

live on the edge and fix provision script

use stable package repositories

httpsspeakerdeckcommitchellhvagrant-usage-patterns

Create and distribute your own VM

Golden image

vagrant package - -name myboxbox

publish it somewhere (http atlas)

cvmbox_url = ldquohttpmyboxboxrdquo

- Donrsquot make assumptions about the host

- Provision first then bake your own image

- The more moving part the harder will get

Keep it simple

Thank you

_orso_

micheleorselli ideatosrl

moideatoit

- name add mysql user mysql_user name=ideato host= password=ideato priv=ALLGRANT login_user=root login_password=

- name config bind address to allow remote remote connections lineinfile dest=etcmysqlmycnf state=present regexp=bind-address = 127001 line=bind-address = 0000 backup=yes

- name restart mysql service name=mysql state=restarted

Permissions management in shared folders

configvmsynced_folder varwww id vagrant-root owner vagrant group vagrant mount_options [dmode=777fmode=777]

Use host ssh keys

configsshforward_agent = true

ForwardAgent yes

check ssh config file in your host machine

gruntgulp watch

httpwwwsebastien-hanfrblog20121218noac-performance-impact-on-web-applications

configvmsynced_folder varwww id ldquovagrant-rootrdquo type ldquonfsrdquo mount_options [lsquorwrsquovers=3tcpfsc actimeo=1]

Provisioning

to phansible or not to phansible

quick and easy way to start

theyrsquore general

old platforms are not supported

a lot of a good ideas you can steal from

if which(ansible-playbook) configvmprovision ansible do |ansible| ansibleplaybook = ansibleplaybookyml ansibleinventory_path = ansibleinventoriesdev ansiblelimit = all ansibleextra_vars = private_interface 1921683399 hostname default end else configvmprovision shell path ansiblewindowssh args [default] end

can you assume everyone in your team have the same version

if which(ansible-playbook) configvmprovision ansible do |ansible| ansibleplaybook = ansibleplaybookyml ansibleinventory_path = ansibleinventoriesdev ansiblelimit = all ansibleextra_vars = private_interface 1921683399 hostname default end else configvmprovision shell path ansiblewindowssh args [default] end

the provisioning tool is a moving part wanna update be careful

create Vagrant indipendent provision

scripts

configvmprovision shell path =gt scriptsbootstrapsh args =gt varwww

configvmprovision shell path =gt ldquoscriptsprovisionsh args =gt varwww

create your own template

httpsgithubcomideatosrlvagrant-php-template

yoursquore in control of provisioning command

you can perform additional checks on host machine

Distributing VMs

provisioning does not create immutable vm by default

eg package update on LTS

live on the edge and fix provision script

use stable package repositories

httpsspeakerdeckcommitchellhvagrant-usage-patterns

Create and distribute your own VM

Golden image

vagrant package - -name myboxbox

publish it somewhere (http atlas)

cvmbox_url = ldquohttpmyboxboxrdquo

- Donrsquot make assumptions about the host

- Provision first then bake your own image

- The more moving part the harder will get

Keep it simple

Thank you

_orso_

micheleorselli ideatosrl

moideatoit

Permissions management in shared folders

configvmsynced_folder varwww id vagrant-root owner vagrant group vagrant mount_options [dmode=777fmode=777]

Use host ssh keys

configsshforward_agent = true

ForwardAgent yes

check ssh config file in your host machine

gruntgulp watch

httpwwwsebastien-hanfrblog20121218noac-performance-impact-on-web-applications

configvmsynced_folder varwww id ldquovagrant-rootrdquo type ldquonfsrdquo mount_options [lsquorwrsquovers=3tcpfsc actimeo=1]

Provisioning

to phansible or not to phansible

quick and easy way to start

theyrsquore general

old platforms are not supported

a lot of a good ideas you can steal from

if which(ansible-playbook) configvmprovision ansible do |ansible| ansibleplaybook = ansibleplaybookyml ansibleinventory_path = ansibleinventoriesdev ansiblelimit = all ansibleextra_vars = private_interface 1921683399 hostname default end else configvmprovision shell path ansiblewindowssh args [default] end

can you assume everyone in your team have the same version

if which(ansible-playbook) configvmprovision ansible do |ansible| ansibleplaybook = ansibleplaybookyml ansibleinventory_path = ansibleinventoriesdev ansiblelimit = all ansibleextra_vars = private_interface 1921683399 hostname default end else configvmprovision shell path ansiblewindowssh args [default] end

the provisioning tool is a moving part wanna update be careful

create Vagrant indipendent provision

scripts

configvmprovision shell path =gt scriptsbootstrapsh args =gt varwww

configvmprovision shell path =gt ldquoscriptsprovisionsh args =gt varwww

create your own template

httpsgithubcomideatosrlvagrant-php-template

yoursquore in control of provisioning command

you can perform additional checks on host machine

Distributing VMs

provisioning does not create immutable vm by default

eg package update on LTS

live on the edge and fix provision script

use stable package repositories

httpsspeakerdeckcommitchellhvagrant-usage-patterns

Create and distribute your own VM

Golden image

vagrant package - -name myboxbox

publish it somewhere (http atlas)

cvmbox_url = ldquohttpmyboxboxrdquo

- Donrsquot make assumptions about the host

- Provision first then bake your own image

- The more moving part the harder will get

Keep it simple

Thank you

_orso_

micheleorselli ideatosrl

moideatoit

configvmsynced_folder varwww id vagrant-root owner vagrant group vagrant mount_options [dmode=777fmode=777]

Use host ssh keys

configsshforward_agent = true

ForwardAgent yes

check ssh config file in your host machine

gruntgulp watch

httpwwwsebastien-hanfrblog20121218noac-performance-impact-on-web-applications

configvmsynced_folder varwww id ldquovagrant-rootrdquo type ldquonfsrdquo mount_options [lsquorwrsquovers=3tcpfsc actimeo=1]

Provisioning

to phansible or not to phansible

quick and easy way to start

theyrsquore general

old platforms are not supported

a lot of a good ideas you can steal from

if which(ansible-playbook) configvmprovision ansible do |ansible| ansibleplaybook = ansibleplaybookyml ansibleinventory_path = ansibleinventoriesdev ansiblelimit = all ansibleextra_vars = private_interface 1921683399 hostname default end else configvmprovision shell path ansiblewindowssh args [default] end

can you assume everyone in your team have the same version

if which(ansible-playbook) configvmprovision ansible do |ansible| ansibleplaybook = ansibleplaybookyml ansibleinventory_path = ansibleinventoriesdev ansiblelimit = all ansibleextra_vars = private_interface 1921683399 hostname default end else configvmprovision shell path ansiblewindowssh args [default] end

the provisioning tool is a moving part wanna update be careful

create Vagrant indipendent provision

scripts

configvmprovision shell path =gt scriptsbootstrapsh args =gt varwww

configvmprovision shell path =gt ldquoscriptsprovisionsh args =gt varwww

create your own template

httpsgithubcomideatosrlvagrant-php-template

yoursquore in control of provisioning command

you can perform additional checks on host machine

Distributing VMs

provisioning does not create immutable vm by default

eg package update on LTS

live on the edge and fix provision script

use stable package repositories

httpsspeakerdeckcommitchellhvagrant-usage-patterns

Create and distribute your own VM

Golden image

vagrant package - -name myboxbox

publish it somewhere (http atlas)

cvmbox_url = ldquohttpmyboxboxrdquo

- Donrsquot make assumptions about the host

- Provision first then bake your own image

- The more moving part the harder will get

Keep it simple

Thank you

_orso_

micheleorselli ideatosrl

moideatoit

Use host ssh keys

configsshforward_agent = true

ForwardAgent yes

check ssh config file in your host machine

gruntgulp watch

httpwwwsebastien-hanfrblog20121218noac-performance-impact-on-web-applications

configvmsynced_folder varwww id ldquovagrant-rootrdquo type ldquonfsrdquo mount_options [lsquorwrsquovers=3tcpfsc actimeo=1]

Provisioning

to phansible or not to phansible

quick and easy way to start

theyrsquore general

old platforms are not supported

a lot of a good ideas you can steal from

if which(ansible-playbook) configvmprovision ansible do |ansible| ansibleplaybook = ansibleplaybookyml ansibleinventory_path = ansibleinventoriesdev ansiblelimit = all ansibleextra_vars = private_interface 1921683399 hostname default end else configvmprovision shell path ansiblewindowssh args [default] end

can you assume everyone in your team have the same version

if which(ansible-playbook) configvmprovision ansible do |ansible| ansibleplaybook = ansibleplaybookyml ansibleinventory_path = ansibleinventoriesdev ansiblelimit = all ansibleextra_vars = private_interface 1921683399 hostname default end else configvmprovision shell path ansiblewindowssh args [default] end

the provisioning tool is a moving part wanna update be careful

create Vagrant indipendent provision

scripts

configvmprovision shell path =gt scriptsbootstrapsh args =gt varwww

configvmprovision shell path =gt ldquoscriptsprovisionsh args =gt varwww

create your own template

httpsgithubcomideatosrlvagrant-php-template

yoursquore in control of provisioning command

you can perform additional checks on host machine

Distributing VMs

provisioning does not create immutable vm by default

eg package update on LTS

live on the edge and fix provision script

use stable package repositories

httpsspeakerdeckcommitchellhvagrant-usage-patterns

Create and distribute your own VM

Golden image

vagrant package - -name myboxbox

publish it somewhere (http atlas)

cvmbox_url = ldquohttpmyboxboxrdquo

- Donrsquot make assumptions about the host

- Provision first then bake your own image

- The more moving part the harder will get

Keep it simple

Thank you

_orso_

micheleorselli ideatosrl

moideatoit

configsshforward_agent = true

ForwardAgent yes

check ssh config file in your host machine

gruntgulp watch

httpwwwsebastien-hanfrblog20121218noac-performance-impact-on-web-applications

configvmsynced_folder varwww id ldquovagrant-rootrdquo type ldquonfsrdquo mount_options [lsquorwrsquovers=3tcpfsc actimeo=1]

Provisioning

to phansible or not to phansible

quick and easy way to start

theyrsquore general

old platforms are not supported

a lot of a good ideas you can steal from

if which(ansible-playbook) configvmprovision ansible do |ansible| ansibleplaybook = ansibleplaybookyml ansibleinventory_path = ansibleinventoriesdev ansiblelimit = all ansibleextra_vars = private_interface 1921683399 hostname default end else configvmprovision shell path ansiblewindowssh args [default] end

can you assume everyone in your team have the same version

if which(ansible-playbook) configvmprovision ansible do |ansible| ansibleplaybook = ansibleplaybookyml ansibleinventory_path = ansibleinventoriesdev ansiblelimit = all ansibleextra_vars = private_interface 1921683399 hostname default end else configvmprovision shell path ansiblewindowssh args [default] end

the provisioning tool is a moving part wanna update be careful

create Vagrant indipendent provision

scripts

configvmprovision shell path =gt scriptsbootstrapsh args =gt varwww

configvmprovision shell path =gt ldquoscriptsprovisionsh args =gt varwww

create your own template

httpsgithubcomideatosrlvagrant-php-template

yoursquore in control of provisioning command

you can perform additional checks on host machine

Distributing VMs

provisioning does not create immutable vm by default

eg package update on LTS

live on the edge and fix provision script

use stable package repositories

httpsspeakerdeckcommitchellhvagrant-usage-patterns

Create and distribute your own VM

Golden image

vagrant package - -name myboxbox

publish it somewhere (http atlas)

cvmbox_url = ldquohttpmyboxboxrdquo

- Donrsquot make assumptions about the host

- Provision first then bake your own image

- The more moving part the harder will get

Keep it simple

Thank you

_orso_

micheleorselli ideatosrl

moideatoit

ForwardAgent yes

check ssh config file in your host machine

gruntgulp watch

httpwwwsebastien-hanfrblog20121218noac-performance-impact-on-web-applications

configvmsynced_folder varwww id ldquovagrant-rootrdquo type ldquonfsrdquo mount_options [lsquorwrsquovers=3tcpfsc actimeo=1]

Provisioning

to phansible or not to phansible

quick and easy way to start

theyrsquore general

old platforms are not supported

a lot of a good ideas you can steal from

if which(ansible-playbook) configvmprovision ansible do |ansible| ansibleplaybook = ansibleplaybookyml ansibleinventory_path = ansibleinventoriesdev ansiblelimit = all ansibleextra_vars = private_interface 1921683399 hostname default end else configvmprovision shell path ansiblewindowssh args [default] end

can you assume everyone in your team have the same version

if which(ansible-playbook) configvmprovision ansible do |ansible| ansibleplaybook = ansibleplaybookyml ansibleinventory_path = ansibleinventoriesdev ansiblelimit = all ansibleextra_vars = private_interface 1921683399 hostname default end else configvmprovision shell path ansiblewindowssh args [default] end

the provisioning tool is a moving part wanna update be careful

create Vagrant indipendent provision

scripts

configvmprovision shell path =gt scriptsbootstrapsh args =gt varwww

configvmprovision shell path =gt ldquoscriptsprovisionsh args =gt varwww

create your own template

httpsgithubcomideatosrlvagrant-php-template

yoursquore in control of provisioning command

you can perform additional checks on host machine

Distributing VMs

provisioning does not create immutable vm by default

eg package update on LTS

live on the edge and fix provision script

use stable package repositories

httpsspeakerdeckcommitchellhvagrant-usage-patterns

Create and distribute your own VM

Golden image

vagrant package - -name myboxbox

publish it somewhere (http atlas)

cvmbox_url = ldquohttpmyboxboxrdquo

- Donrsquot make assumptions about the host

- Provision first then bake your own image

- The more moving part the harder will get

Keep it simple

Thank you

_orso_

micheleorselli ideatosrl

moideatoit

gruntgulp watch

httpwwwsebastien-hanfrblog20121218noac-performance-impact-on-web-applications

configvmsynced_folder varwww id ldquovagrant-rootrdquo type ldquonfsrdquo mount_options [lsquorwrsquovers=3tcpfsc actimeo=1]

Provisioning

to phansible or not to phansible

quick and easy way to start

theyrsquore general

old platforms are not supported

a lot of a good ideas you can steal from

if which(ansible-playbook) configvmprovision ansible do |ansible| ansibleplaybook = ansibleplaybookyml ansibleinventory_path = ansibleinventoriesdev ansiblelimit = all ansibleextra_vars = private_interface 1921683399 hostname default end else configvmprovision shell path ansiblewindowssh args [default] end

can you assume everyone in your team have the same version

if which(ansible-playbook) configvmprovision ansible do |ansible| ansibleplaybook = ansibleplaybookyml ansibleinventory_path = ansibleinventoriesdev ansiblelimit = all ansibleextra_vars = private_interface 1921683399 hostname default end else configvmprovision shell path ansiblewindowssh args [default] end

the provisioning tool is a moving part wanna update be careful

create Vagrant indipendent provision

scripts

configvmprovision shell path =gt scriptsbootstrapsh args =gt varwww

configvmprovision shell path =gt ldquoscriptsprovisionsh args =gt varwww

create your own template

httpsgithubcomideatosrlvagrant-php-template

yoursquore in control of provisioning command

you can perform additional checks on host machine

Distributing VMs

provisioning does not create immutable vm by default

eg package update on LTS

live on the edge and fix provision script

use stable package repositories

httpsspeakerdeckcommitchellhvagrant-usage-patterns

Create and distribute your own VM

Golden image

vagrant package - -name myboxbox

publish it somewhere (http atlas)

cvmbox_url = ldquohttpmyboxboxrdquo

- Donrsquot make assumptions about the host

- Provision first then bake your own image

- The more moving part the harder will get

Keep it simple

Thank you

_orso_

micheleorselli ideatosrl

moideatoit

configvmsynced_folder varwww id ldquovagrant-rootrdquo type ldquonfsrdquo mount_options [lsquorwrsquovers=3tcpfsc actimeo=1]

Provisioning

to phansible or not to phansible

quick and easy way to start

theyrsquore general

old platforms are not supported

a lot of a good ideas you can steal from

if which(ansible-playbook) configvmprovision ansible do |ansible| ansibleplaybook = ansibleplaybookyml ansibleinventory_path = ansibleinventoriesdev ansiblelimit = all ansibleextra_vars = private_interface 1921683399 hostname default end else configvmprovision shell path ansiblewindowssh args [default] end

can you assume everyone in your team have the same version

if which(ansible-playbook) configvmprovision ansible do |ansible| ansibleplaybook = ansibleplaybookyml ansibleinventory_path = ansibleinventoriesdev ansiblelimit = all ansibleextra_vars = private_interface 1921683399 hostname default end else configvmprovision shell path ansiblewindowssh args [default] end

the provisioning tool is a moving part wanna update be careful

create Vagrant indipendent provision

scripts

configvmprovision shell path =gt scriptsbootstrapsh args =gt varwww

configvmprovision shell path =gt ldquoscriptsprovisionsh args =gt varwww

create your own template

httpsgithubcomideatosrlvagrant-php-template

yoursquore in control of provisioning command

you can perform additional checks on host machine

Distributing VMs

provisioning does not create immutable vm by default

eg package update on LTS

live on the edge and fix provision script

use stable package repositories

httpsspeakerdeckcommitchellhvagrant-usage-patterns

Create and distribute your own VM

Golden image

vagrant package - -name myboxbox

publish it somewhere (http atlas)

cvmbox_url = ldquohttpmyboxboxrdquo

- Donrsquot make assumptions about the host

- Provision first then bake your own image

- The more moving part the harder will get

Keep it simple

Thank you

_orso_

micheleorselli ideatosrl

moideatoit

Provisioning

to phansible or not to phansible

quick and easy way to start

theyrsquore general

old platforms are not supported

a lot of a good ideas you can steal from

if which(ansible-playbook) configvmprovision ansible do |ansible| ansibleplaybook = ansibleplaybookyml ansibleinventory_path = ansibleinventoriesdev ansiblelimit = all ansibleextra_vars = private_interface 1921683399 hostname default end else configvmprovision shell path ansiblewindowssh args [default] end

can you assume everyone in your team have the same version

if which(ansible-playbook) configvmprovision ansible do |ansible| ansibleplaybook = ansibleplaybookyml ansibleinventory_path = ansibleinventoriesdev ansiblelimit = all ansibleextra_vars = private_interface 1921683399 hostname default end else configvmprovision shell path ansiblewindowssh args [default] end

the provisioning tool is a moving part wanna update be careful

create Vagrant indipendent provision

scripts

configvmprovision shell path =gt scriptsbootstrapsh args =gt varwww

configvmprovision shell path =gt ldquoscriptsprovisionsh args =gt varwww

create your own template

httpsgithubcomideatosrlvagrant-php-template

yoursquore in control of provisioning command

you can perform additional checks on host machine

Distributing VMs

provisioning does not create immutable vm by default

eg package update on LTS

live on the edge and fix provision script

use stable package repositories

httpsspeakerdeckcommitchellhvagrant-usage-patterns

Create and distribute your own VM

Golden image

vagrant package - -name myboxbox

publish it somewhere (http atlas)

cvmbox_url = ldquohttpmyboxboxrdquo

- Donrsquot make assumptions about the host

- Provision first then bake your own image

- The more moving part the harder will get

Keep it simple

Thank you

_orso_

micheleorselli ideatosrl

moideatoit

to phansible or not to phansible

quick and easy way to start

theyrsquore general

old platforms are not supported

a lot of a good ideas you can steal from

if which(ansible-playbook) configvmprovision ansible do |ansible| ansibleplaybook = ansibleplaybookyml ansibleinventory_path = ansibleinventoriesdev ansiblelimit = all ansibleextra_vars = private_interface 1921683399 hostname default end else configvmprovision shell path ansiblewindowssh args [default] end

can you assume everyone in your team have the same version

if which(ansible-playbook) configvmprovision ansible do |ansible| ansibleplaybook = ansibleplaybookyml ansibleinventory_path = ansibleinventoriesdev ansiblelimit = all ansibleextra_vars = private_interface 1921683399 hostname default end else configvmprovision shell path ansiblewindowssh args [default] end

the provisioning tool is a moving part wanna update be careful

create Vagrant indipendent provision

scripts

configvmprovision shell path =gt scriptsbootstrapsh args =gt varwww

configvmprovision shell path =gt ldquoscriptsprovisionsh args =gt varwww

create your own template

httpsgithubcomideatosrlvagrant-php-template

yoursquore in control of provisioning command

you can perform additional checks on host machine

Distributing VMs

provisioning does not create immutable vm by default

eg package update on LTS

live on the edge and fix provision script

use stable package repositories

httpsspeakerdeckcommitchellhvagrant-usage-patterns

Create and distribute your own VM

Golden image

vagrant package - -name myboxbox

publish it somewhere (http atlas)

cvmbox_url = ldquohttpmyboxboxrdquo

- Donrsquot make assumptions about the host

- Provision first then bake your own image

- The more moving part the harder will get

Keep it simple

Thank you

_orso_

micheleorselli ideatosrl

moideatoit

quick and easy way to start

theyrsquore general

old platforms are not supported

a lot of a good ideas you can steal from

if which(ansible-playbook) configvmprovision ansible do |ansible| ansibleplaybook = ansibleplaybookyml ansibleinventory_path = ansibleinventoriesdev ansiblelimit = all ansibleextra_vars = private_interface 1921683399 hostname default end else configvmprovision shell path ansiblewindowssh args [default] end

can you assume everyone in your team have the same version

if which(ansible-playbook) configvmprovision ansible do |ansible| ansibleplaybook = ansibleplaybookyml ansibleinventory_path = ansibleinventoriesdev ansiblelimit = all ansibleextra_vars = private_interface 1921683399 hostname default end else configvmprovision shell path ansiblewindowssh args [default] end

the provisioning tool is a moving part wanna update be careful

create Vagrant indipendent provision

scripts

configvmprovision shell path =gt scriptsbootstrapsh args =gt varwww

configvmprovision shell path =gt ldquoscriptsprovisionsh args =gt varwww

create your own template

httpsgithubcomideatosrlvagrant-php-template

yoursquore in control of provisioning command

you can perform additional checks on host machine

Distributing VMs

provisioning does not create immutable vm by default

eg package update on LTS

live on the edge and fix provision script

use stable package repositories

httpsspeakerdeckcommitchellhvagrant-usage-patterns

Create and distribute your own VM

Golden image

vagrant package - -name myboxbox

publish it somewhere (http atlas)

cvmbox_url = ldquohttpmyboxboxrdquo

- Donrsquot make assumptions about the host

- Provision first then bake your own image

- The more moving part the harder will get

Keep it simple

Thank you

_orso_

micheleorselli ideatosrl

moideatoit

if which(ansible-playbook) configvmprovision ansible do |ansible| ansibleplaybook = ansibleplaybookyml ansibleinventory_path = ansibleinventoriesdev ansiblelimit = all ansibleextra_vars = private_interface 1921683399 hostname default end else configvmprovision shell path ansiblewindowssh args [default] end

can you assume everyone in your team have the same version

if which(ansible-playbook) configvmprovision ansible do |ansible| ansibleplaybook = ansibleplaybookyml ansibleinventory_path = ansibleinventoriesdev ansiblelimit = all ansibleextra_vars = private_interface 1921683399 hostname default end else configvmprovision shell path ansiblewindowssh args [default] end

the provisioning tool is a moving part wanna update be careful

create Vagrant indipendent provision

scripts

configvmprovision shell path =gt scriptsbootstrapsh args =gt varwww

configvmprovision shell path =gt ldquoscriptsprovisionsh args =gt varwww

create your own template

httpsgithubcomideatosrlvagrant-php-template

yoursquore in control of provisioning command

you can perform additional checks on host machine

Distributing VMs

provisioning does not create immutable vm by default

eg package update on LTS

live on the edge and fix provision script

use stable package repositories

httpsspeakerdeckcommitchellhvagrant-usage-patterns

Create and distribute your own VM

Golden image

vagrant package - -name myboxbox

publish it somewhere (http atlas)

cvmbox_url = ldquohttpmyboxboxrdquo

- Donrsquot make assumptions about the host

- Provision first then bake your own image

- The more moving part the harder will get

Keep it simple

Thank you

_orso_

micheleorselli ideatosrl

moideatoit

can you assume everyone in your team have the same version

if which(ansible-playbook) configvmprovision ansible do |ansible| ansibleplaybook = ansibleplaybookyml ansibleinventory_path = ansibleinventoriesdev ansiblelimit = all ansibleextra_vars = private_interface 1921683399 hostname default end else configvmprovision shell path ansiblewindowssh args [default] end

the provisioning tool is a moving part wanna update be careful

create Vagrant indipendent provision

scripts

configvmprovision shell path =gt scriptsbootstrapsh args =gt varwww

configvmprovision shell path =gt ldquoscriptsprovisionsh args =gt varwww

create your own template

httpsgithubcomideatosrlvagrant-php-template

yoursquore in control of provisioning command

you can perform additional checks on host machine

Distributing VMs

provisioning does not create immutable vm by default

eg package update on LTS

live on the edge and fix provision script

use stable package repositories

httpsspeakerdeckcommitchellhvagrant-usage-patterns

Create and distribute your own VM

Golden image

vagrant package - -name myboxbox

publish it somewhere (http atlas)

cvmbox_url = ldquohttpmyboxboxrdquo

- Donrsquot make assumptions about the host

- Provision first then bake your own image

- The more moving part the harder will get

Keep it simple

Thank you

_orso_

micheleorselli ideatosrl

moideatoit

if which(ansible-playbook) configvmprovision ansible do |ansible| ansibleplaybook = ansibleplaybookyml ansibleinventory_path = ansibleinventoriesdev ansiblelimit = all ansibleextra_vars = private_interface 1921683399 hostname default end else configvmprovision shell path ansiblewindowssh args [default] end

the provisioning tool is a moving part wanna update be careful

create Vagrant indipendent provision

scripts

configvmprovision shell path =gt scriptsbootstrapsh args =gt varwww

configvmprovision shell path =gt ldquoscriptsprovisionsh args =gt varwww

create your own template

httpsgithubcomideatosrlvagrant-php-template

yoursquore in control of provisioning command

you can perform additional checks on host machine

Distributing VMs

provisioning does not create immutable vm by default

eg package update on LTS

live on the edge and fix provision script

use stable package repositories

httpsspeakerdeckcommitchellhvagrant-usage-patterns

Create and distribute your own VM

Golden image

vagrant package - -name myboxbox

publish it somewhere (http atlas)

cvmbox_url = ldquohttpmyboxboxrdquo

- Donrsquot make assumptions about the host

- Provision first then bake your own image

- The more moving part the harder will get

Keep it simple

Thank you

_orso_

micheleorselli ideatosrl

moideatoit

the provisioning tool is a moving part wanna update be careful

create Vagrant indipendent provision

scripts

configvmprovision shell path =gt scriptsbootstrapsh args =gt varwww

configvmprovision shell path =gt ldquoscriptsprovisionsh args =gt varwww

create your own template

httpsgithubcomideatosrlvagrant-php-template

yoursquore in control of provisioning command

you can perform additional checks on host machine

Distributing VMs

provisioning does not create immutable vm by default

eg package update on LTS

live on the edge and fix provision script

use stable package repositories

httpsspeakerdeckcommitchellhvagrant-usage-patterns

Create and distribute your own VM

Golden image

vagrant package - -name myboxbox

publish it somewhere (http atlas)

cvmbox_url = ldquohttpmyboxboxrdquo

- Donrsquot make assumptions about the host

- Provision first then bake your own image

- The more moving part the harder will get

Keep it simple

Thank you

_orso_

micheleorselli ideatosrl

moideatoit

create Vagrant indipendent provision

scripts

configvmprovision shell path =gt scriptsbootstrapsh args =gt varwww

configvmprovision shell path =gt ldquoscriptsprovisionsh args =gt varwww

create your own template

httpsgithubcomideatosrlvagrant-php-template

yoursquore in control of provisioning command

you can perform additional checks on host machine

Distributing VMs

provisioning does not create immutable vm by default

eg package update on LTS

live on the edge and fix provision script

use stable package repositories

httpsspeakerdeckcommitchellhvagrant-usage-patterns

Create and distribute your own VM

Golden image

vagrant package - -name myboxbox

publish it somewhere (http atlas)

cvmbox_url = ldquohttpmyboxboxrdquo

- Donrsquot make assumptions about the host

- Provision first then bake your own image

- The more moving part the harder will get

Keep it simple

Thank you

_orso_

micheleorselli ideatosrl

moideatoit

configvmprovision shell path =gt scriptsbootstrapsh args =gt varwww

configvmprovision shell path =gt ldquoscriptsprovisionsh args =gt varwww

create your own template

httpsgithubcomideatosrlvagrant-php-template

yoursquore in control of provisioning command

you can perform additional checks on host machine

Distributing VMs

provisioning does not create immutable vm by default

eg package update on LTS

live on the edge and fix provision script

use stable package repositories

httpsspeakerdeckcommitchellhvagrant-usage-patterns

Create and distribute your own VM

Golden image

vagrant package - -name myboxbox

publish it somewhere (http atlas)

cvmbox_url = ldquohttpmyboxboxrdquo

- Donrsquot make assumptions about the host

- Provision first then bake your own image

- The more moving part the harder will get

Keep it simple

Thank you

_orso_

micheleorselli ideatosrl

moideatoit

create your own template

httpsgithubcomideatosrlvagrant-php-template

yoursquore in control of provisioning command

you can perform additional checks on host machine

Distributing VMs

provisioning does not create immutable vm by default

eg package update on LTS

live on the edge and fix provision script

use stable package repositories

httpsspeakerdeckcommitchellhvagrant-usage-patterns

Create and distribute your own VM

Golden image

vagrant package - -name myboxbox

publish it somewhere (http atlas)

cvmbox_url = ldquohttpmyboxboxrdquo

- Donrsquot make assumptions about the host

- Provision first then bake your own image

- The more moving part the harder will get

Keep it simple

Thank you

_orso_

micheleorselli ideatosrl

moideatoit

yoursquore in control of provisioning command

you can perform additional checks on host machine

Distributing VMs

provisioning does not create immutable vm by default

eg package update on LTS

live on the edge and fix provision script

use stable package repositories

httpsspeakerdeckcommitchellhvagrant-usage-patterns

Create and distribute your own VM

Golden image

vagrant package - -name myboxbox

publish it somewhere (http atlas)

cvmbox_url = ldquohttpmyboxboxrdquo

- Donrsquot make assumptions about the host

- Provision first then bake your own image

- The more moving part the harder will get

Keep it simple

Thank you

_orso_

micheleorselli ideatosrl

moideatoit

Distributing VMs

provisioning does not create immutable vm by default

eg package update on LTS

live on the edge and fix provision script

use stable package repositories

httpsspeakerdeckcommitchellhvagrant-usage-patterns

Create and distribute your own VM

Golden image

vagrant package - -name myboxbox

publish it somewhere (http atlas)

cvmbox_url = ldquohttpmyboxboxrdquo

- Donrsquot make assumptions about the host

- Provision first then bake your own image

- The more moving part the harder will get

Keep it simple

Thank you

_orso_

micheleorselli ideatosrl

moideatoit

provisioning does not create immutable vm by default

eg package update on LTS

live on the edge and fix provision script

use stable package repositories

httpsspeakerdeckcommitchellhvagrant-usage-patterns

Create and distribute your own VM

Golden image

vagrant package - -name myboxbox

publish it somewhere (http atlas)

cvmbox_url = ldquohttpmyboxboxrdquo

- Donrsquot make assumptions about the host

- Provision first then bake your own image

- The more moving part the harder will get

Keep it simple

Thank you

_orso_

micheleorselli ideatosrl

moideatoit

live on the edge and fix provision script

use stable package repositories

httpsspeakerdeckcommitchellhvagrant-usage-patterns

Create and distribute your own VM

Golden image

vagrant package - -name myboxbox

publish it somewhere (http atlas)

cvmbox_url = ldquohttpmyboxboxrdquo

- Donrsquot make assumptions about the host

- Provision first then bake your own image

- The more moving part the harder will get

Keep it simple

Thank you

_orso_

micheleorselli ideatosrl

moideatoit

httpsspeakerdeckcommitchellhvagrant-usage-patterns

Create and distribute your own VM

Golden image

vagrant package - -name myboxbox

publish it somewhere (http atlas)

cvmbox_url = ldquohttpmyboxboxrdquo

- Donrsquot make assumptions about the host

- Provision first then bake your own image

- The more moving part the harder will get

Keep it simple

Thank you

_orso_

micheleorselli ideatosrl

moideatoit

Golden image

vagrant package - -name myboxbox

publish it somewhere (http atlas)

cvmbox_url = ldquohttpmyboxboxrdquo

- Donrsquot make assumptions about the host

- Provision first then bake your own image

- The more moving part the harder will get

Keep it simple

Thank you

_orso_

micheleorselli ideatosrl

moideatoit

vagrant package - -name myboxbox

publish it somewhere (http atlas)

cvmbox_url = ldquohttpmyboxboxrdquo

- Donrsquot make assumptions about the host

- Provision first then bake your own image

- The more moving part the harder will get

Keep it simple

Thank you

_orso_

micheleorselli ideatosrl

moideatoit

- Donrsquot make assumptions about the host

- Provision first then bake your own image

- The more moving part the harder will get

Keep it simple

Thank you

_orso_

micheleorselli ideatosrl

moideatoit

Keep it simple

Thank you

_orso_

micheleorselli ideatosrl

moideatoit

Thank you

_orso_

micheleorselli ideatosrl

moideatoit