From 9465e7dbd14be668336356ebc97d0614b1b8049b Mon Sep 17 00:00:00 2001 From: Willem Luijt Date: Sat, 22 Jun 2013 17:01:06 -0700 Subject: [PATCH 01/12] Added Vagrant configuration cookbook --- cookbook/workflow/index.rst | 1 + cookbook/workflow/vagrant_configuration.rst | 380 ++++++++++++++++++++ 2 files changed, 381 insertions(+) create mode 100644 cookbook/workflow/vagrant_configuration.rst diff --git a/cookbook/workflow/index.rst b/cookbook/workflow/index.rst index 6b2382ae235..e6b99db9a72 100644 --- a/cookbook/workflow/index.rst +++ b/cookbook/workflow/index.rst @@ -6,3 +6,4 @@ Workflow new_project_git new_project_svn + vagrant_configuration diff --git a/cookbook/workflow/vagrant_configuration.rst b/cookbook/workflow/vagrant_configuration.rst new file mode 100644 index 00000000000..3175ca754d3 --- /dev/null +++ b/cookbook/workflow/vagrant_configuration.rst @@ -0,0 +1,380 @@ +.. index:: + single: Workflow; Vagrant + +Symfony Standard Edition with Vagrant +===================================== + +You can easily setup a development environment for the Symfony Standard Edition +by using Vagrant. Vagrant is a tool that can create a virtual machine (based on +a set of configuration files) with simple commands. In this case, you will be +creating a virtual machine that runs Linux and has an Apache web server, a +MySQL database server, and PHP (a LAMP stack). When you are finished creating +this Vagrant configuration in your project, you can store the files in your +version control system (git, svn, ...) and work with other developers without +having to help them configure their development machines! This configuration +is also a great way to try out the Symfony Standard Edition without having to +know how to configure a web server or database server. + +Prerequisites +------------- + +1. Download and install the latest `Virtualbox`_. + +2. Download and install the latest `Vagrant`_. + +3. Install the Symfony Standard Edition as detailed in :doc:`/cookbook/workflow/new_project_git`. + +Setup +----- + +You will be creating a set of files under a new ``vagrant`` directory: + +.. code-block:: text + + vagrant/.gitignore + vagrant/Vagrantfile + vagrant/puppet/modules.sh + vagrant/puppet/manifests/symfony.pp + +1. Create a new set of directories at the root of your project to store the + Vagrant configuration files: + + .. code-block:: bash + + $ mkdir vagrant + $ mkdir vagrant/puppet + $ mkdir vagrant/puppet/manifests + +2. Create a new file ``vagrant/Vagrantfile`` and paste the following into it. + + .. code-block:: text + + # -*- mode: ruby -*- + # vi: set ft=ruby : + + Vagrant.configure("2") do |config| + config.vm.box = "precise32" + + config.vm.box_url = "http://files.vagrantup.com/precise32.box" + + config.vm.network :private_network, ip: "192.168.33.10" + + config.vm.synced_folder "..", "/vagrant" #, :nfs => true + + config.vm.provision :shell, :path => "puppet/modules.sh" + + config.vm.provision :puppet do |puppet| + puppet.manifests_path = "puppet/manifests" + puppet.manifest_file = "symfony.pp" + puppet.facter = { + "fqdn" => "symfony.local", + "host_ipaddress" => "192.168.33.1", + } + end + end + +3. Create a new file ``vagrant/puppet/modules.sh`` and paste the following + into it. + + .. code-block:: text + + #!/bin/sh + + if [ ! -d "/etc/puppet/modules" ]; then + mkdir -p /etc/puppet/modules; + fi + + if [ ! -d "/etc/puppet/modules/apache" ]; then + puppet module install puppetlabs-apache; + fi + + if [ ! -d "/etc/puppet/modules/mysql" ]; then + puppet module install puppetlabs-mysql; + fi + + if [ ! -d "/etc/puppet/modules/apt" ]; then + puppet module install puppetlabs-apt; + fi + + if [ ! -d "/etc/puppet/modules/git" ]; then + puppet module install puppetlabs-git; + fi + +4. Create a new file ``vagrant/puppet/manifests/symfony.pp`` and paste the + following into it. + + .. code-block:: text + + # update system first before new packages are installed + class { 'apt': + always_apt_update => true, + } + Exec['apt_update'] -> Package <| |> + + + # install Apache + class { 'apache': } + class { 'apache::mod::php': } + + + # install MySQL + class { 'mysql': } + class { 'mysql::server': + config_hash => { 'root_password' => 'symfony' }, + } + class { 'mysql::php': } + + + # install Git for composer + class { 'git': } + + + # install PHP Extensions used with Symfony + class php-extensions { + package { ['php-apc', 'php5-intl', 'php5-xdebug']: + ensure => latest, + require => Package['httpd'], + notify => Service['httpd'], + } + } + + include php-extensions + + + # install a local composer.phar file + class composer { + exec { 'composerPhar': + cwd => '/vagrant', + command => 'curl -s http://getcomposer.org/installer | php', + path => ['/bin', '/usr/bin'], + creates => '/vagrant/composer.phar', + require => [ Class['apache::mod::php', 'git'], Package['curl'] ], + } + + package { 'curl': + ensure => present, + } + } + + include composer + + + # install the Symfony vendors using composer + class symfony { + exec { 'vendorsInstall': + cwd => '/vagrant', + command => 'php composer.phar install', + timeout => 1200, + path => ['/bin', '/usr/bin'], + creates => '/vagrant/vendor', + logoutput => true, + require => Exec['composerPhar'], + } + } + + include symfony + + + # Create a web server host using the Symfony web/ directory + apache::vhost { 'www.symfony.local': + priority => '10', + port => '80', + docroot_owner => 'vagrant', + docroot_group => 'vagrant', + docroot => '/vagrant/web/', + logroot => '/vagrant/app/logs/', + serveraliases => ['symfony.local',], + } + + # Create a database for Symfony + mysql::db { 'symfony': + user => 'symfony', + password => 'symfony', + host => 'localhost', + grant => ['all'], + } + + + # Configure Apache files to run as the "vagrant" user so that Symfony + # app/cache and app/logs files can be successfully created and accessed + # by the web server + + file_line { 'apache_user': + path => '/etc/apache2/httpd.conf', + line => 'User vagrant', + require => Package['httpd'], + notify => Service['httpd'], + } + + file_line { 'apache_group': + path => '/etc/apache2/httpd.conf', + line => 'Group vagrant', + require => Package['httpd'], + notify => Service['httpd'], + } + + + # Configure php.ini to follow recommended Symfony web/config.php settings + + file_line { 'php5_apache2_short_open_tag': + path => '/etc/php5/apache2/php.ini', + match => 'short_open_tag =', + line => 'short_open_tag = Off', + require => Class['apache::mod::php'], + notify => Service['httpd'], + } + + file_line { 'php5_cli_short_open_tag': + path => '/etc/php5/cli/php.ini', + match => 'short_open_tag =', + line => 'short_open_tag = Off', + require => Class['apache::mod::php'], + notify => Service['httpd'], + } + + file_line { 'php5_apache2_date_timezone': + path => '/etc/php5/apache2/php.ini', + match => 'date.timezone =', + line => 'date.timezone = UTC', + require => Class['apache::mod::php'], + notify => Service['httpd'], + } + + file_line { 'php5_cli_date_timezone': + path => '/etc/php5/cli/php.ini', + match => 'date.timezone =', + line => 'date.timezone = UTC', + require => Class['apache::mod::php'], + notify => Service['httpd'], + } + + file_line { 'php5_apache2_xdebug_max_nesting_level': + path => '/etc/php5/apache2/conf.d/xdebug.ini', + line => 'xdebug.max_nesting_level = 250', + require => [ Class['apache::mod::php'], Package['php5-xdebug'] ], + notify => Service['httpd'], + } + + file_line { 'php5_cli_xdebug_max_nesting_level': + path => '/etc/php5/cli/conf.d/xdebug.ini', + line => 'xdebug.max_nesting_level = 250', + require => [ Class['apache::mod::php'], Package['php5-xdebug'] ], + notify => Service['httpd'], + } + + + # Configure Symfony dev controllers so that the Vagrant host machine + # at the host_ipaddress (specified in the Vagrantfile) has access + + file_line { 'symfony_web_config_host_ipaddress': + path => '/vagrant/web/config.php', + match => '::1', + line => " '::1', '${::host_ipaddress}',", + } + + file_line { 'symfony_web_app_dev_host_ipaddress': + path => '/vagrant/web/app_dev.php', + match => '::1', + line => " || !in_array(@\$_SERVER['REMOTE_ADDR'], array('127.0.0.1', 'fe80::1', '::1', '${::host_ipaddress}'))", + } + +5. Create a new file ``vagrant/.gitignore`` and paste the following into it. + + .. code-block:: text + + .vagrant + +6. Switch to the vagrant directory. + + .. code-block:: bash + + $ cd vagrant + +7. Create the development virtual machine. + + .. code-block:: bash + + $ vagrant up + +A virtual machine is now being prepared in Virtualbox by Vagrant. This process +will take several minutes to complete on the initial run, so be patient. When +the process has completed, you can view the Symfony demo site in a browser at: + +http://192.168.33.10/app_dev.php + +Now you can start developing with Symfony! Any changes made to your Symfony +project directory will appear in the virtual machine. + +Further Configuration +--------------------- + +A MySQL database has been created on the Vagrant virtual machine which you can +use. Just update your app/config/parameters.yml file: + +.. code-block:: yaml + + parameters: + database_driver: pdo_mysql + database_host: 127.0.0.1 + database_port: ~ + database_name: symfony + database_user: symfony + database_password: symfony + +The database name, user, and password are "symfony". + +Other Vagrant Commands +---------------------- + +While you are in the ``vagrant`` directory, you can perform other commands. + +If you came across an issue during the initial setup, execute: + +.. code-block:: bash + + $ vagrant provision + +This will execute the ``vagrant/puppet/modules.sh`` and +``vagrant/puppet/manifests/symfony.pp`` scripts again. + +If you need to access the virtual machine command line, execute: + +.. code-block:: bash + + $ vagrant ssh + +While in the virtual machine command line, you can access your project code in +its ``/vagrant`` directory. This is useful when you want to update composer +dependencies for instance: + +.. code-block:: bash + + $ vagrant ssh + $ cd /vagrant + $ php composer.phar update + $ exit + +If you need to refresh the virtual machine, execute: + +.. code-block:: bash + + $ vagrant reload + +If you are done developing and want to remove the virtual machine, execute: + +.. code-block:: bash + + $ vagrant destroy + +And if you want to install again after destroying, execute: + +.. code-block:: bash + + $ vagrant up + +Hopefully your new Vagrant configuration will help you develop your Symfony +project without having to worry about your local server setup or the setup of +another developer's machine. + +.. _`Virtualbox`: https://www.virtualbox.org/wiki/Downloads +.. _`Vagrant`: http://downloads.vagrantup.com/ From 9eead8a24c9a30869cc702ef094fd279bd9ddcf6 Mon Sep 17 00:00:00 2001 From: Willem Luijt Date: Sun, 23 Jun 2013 17:37:28 -0700 Subject: [PATCH 02/12] Included some formatting tweaks --- cookbook/workflow/vagrant_configuration.rst | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/cookbook/workflow/vagrant_configuration.rst b/cookbook/workflow/vagrant_configuration.rst index 3175ca754d3..089d78eb63d 100644 --- a/cookbook/workflow/vagrant_configuration.rst +++ b/cookbook/workflow/vagrant_configuration.rst @@ -18,11 +18,9 @@ know how to configure a web server or database server. Prerequisites ------------- -1. Download and install the latest `Virtualbox`_. - -2. Download and install the latest `Vagrant`_. - -3. Install the Symfony Standard Edition as detailed in :doc:`/cookbook/workflow/new_project_git`. +#. Download and install the latest `VirtualBox`_. +#. Download and install the latest `Vagrant`_. +#. Install the Symfony Standard Edition as detailed in :doc:`/cookbook/workflow/new_project_git`. Setup ----- @@ -296,11 +294,11 @@ You will be creating a set of files under a new ``vagrant`` directory: $ vagrant up -A virtual machine is now being prepared in Virtualbox by Vagrant. This process +A virtual machine is now being prepared in VirtualBox by Vagrant. This process will take several minutes to complete on the initial run, so be patient. When the process has completed, you can view the Symfony demo site in a browser at: -http://192.168.33.10/app_dev.php + http://192.168.33.10/app_dev.php Now you can start developing with Symfony! Any changes made to your Symfony project directory will appear in the virtual machine. @@ -309,7 +307,7 @@ Further Configuration --------------------- A MySQL database has been created on the Vagrant virtual machine which you can -use. Just update your app/config/parameters.yml file: +use. Just update your ``app/config/parameters.yml`` file: .. code-block:: yaml @@ -372,9 +370,9 @@ And if you want to install again after destroying, execute: $ vagrant up -Hopefully your new Vagrant configuration will help you develop your Symfony +Hopefully, your new Vagrant configuration will help you develop your Symfony project without having to worry about your local server setup or the setup of another developer's machine. -.. _`Virtualbox`: https://www.virtualbox.org/wiki/Downloads +.. _`VirtualBox`: https://www.virtualbox.org/wiki/Downloads .. _`Vagrant`: http://downloads.vagrantup.com/ From dcc73913281c1cfae03724a8943aee4d15145fc2 Mon Sep 17 00:00:00 2001 From: Willem Luijt Date: Sun, 23 Jun 2013 17:39:45 -0700 Subject: [PATCH 03/12] Added a reference to the cookbook/workflow/vagrant_configuration doc --- cookbook/map.rst.inc | 2 ++ 1 file changed, 2 insertions(+) diff --git a/cookbook/map.rst.inc b/cookbook/map.rst.inc index 99498b50a7a..4772bfe840d 100644 --- a/cookbook/map.rst.inc +++ b/cookbook/map.rst.inc @@ -208,3 +208,5 @@ * :doc:`/cookbook/workflow/new_project_git` * :doc:`/cookbook/workflow/new_project_svn` + * :doc:`/cookbook/workflow/vagrant_configuration` + From 4ccb547413a375d151bc467a75587fbc2673522f Mon Sep 17 00:00:00 2001 From: Willem Luijt Date: Sun, 30 Jun 2013 13:18:56 -0700 Subject: [PATCH 04/12] Included more explanation for the created files --- cookbook/workflow/vagrant_configuration.rst | 55 +++++++++++++++++++++ 1 file changed, 55 insertions(+) diff --git a/cookbook/workflow/vagrant_configuration.rst b/cookbook/workflow/vagrant_configuration.rst index 089d78eb63d..f7c37fbcace 100644 --- a/cookbook/workflow/vagrant_configuration.rst +++ b/cookbook/workflow/vagrant_configuration.rst @@ -71,6 +71,37 @@ You will be creating a set of files under a new ``vagrant`` directory: end end + This is the main configuration file used by Vagrant. The ``config.vm.box`` + and ``config.vm.box_url`` values specify that a preconfigured "box" will be + used for the base virtual machine. This ``precise32.box`` file happens to be + a 32bit Ubuntu Linux machine with certain packages already installed (e.g. + `Puppet`_) and is used extensively within the `Vagrant Docs`_. + + The ``config.vm.network`` will create a `private network`_ and specify the IP + address of the virtual machine in that network. You can change the IP + address to a different private IP address if you wish (such as + 192.168.50.12, 172.16.32.64, or 10.9.8.7 just to list a few examples), just + be sure to update the ``host_ipaddress`` value in the ``puppet.facter`` + section as well. The last number in the ``host_ipaddress`` must be 1 (so the + example host IP address values would be 192.168.50.1, 172.16.32.1, or + 10.9.8.1 respectively). + + The ``config.vm.synced_folder`` specifies that the directory one level above + this file (your project directory) will be synced with the ``/vagrant`` + directory within the virtual machine. When you make a change to a file in + your project directory, that change should be reflected in the virtual + machine. The reverse is true as well. The commented out `NFS setting`_ can + be useful but is not required. If you would like to use NFS, just uncomment + the setting (remove the ``#``). + + The ``config.vm.provision`` sections will execute the + ``vagrant/puppet/modules.sh`` and ``vagrant/puppet/manifests/symfony.pp`` + scripts that you will create next. + + There are a number of other settings for the `Vagrantfile`_ which you can + use to customize your virtual machine. These are just the basics to get you + started. + 3. Create a new file ``vagrant/puppet/modules.sh`` and paste the following into it. @@ -98,6 +129,9 @@ You will be creating a set of files under a new ``vagrant`` directory: puppet module install puppetlabs-git; fi + This script will be executed within the virtual machine to install necessary + Puppet modules for the next script. + 4. Create a new file ``vagrant/puppet/manifests/symfony.pp`` and paste the following into it. @@ -276,12 +310,28 @@ You will be creating a set of files under a new ``vagrant`` directory: line => " || !in_array(@\$_SERVER['REMOTE_ADDR'], array('127.0.0.1', 'fe80::1', '::1', '${::host_ipaddress}'))", } + This file performs the bulk of the work to configure your virtual machine + for web development. It will install Apache, MySQL, PHP, and Git. It will + configure Apache to use recommended Symfony settings and will set your + project ``web/`` directory as the web server's document root. If there are + no vendors in your project, it will execute ``php composer.phar install`` to + retrieve them. Also, it will update your project ``web/app_dev.php`` file to + allow your physical host machine (specified by the ``host_ipaddress`` in the + ``vagrant/Vagrantfile``) to have access to view your project website during + development. + 5. Create a new file ``vagrant/.gitignore`` and paste the following into it. .. code-block:: text .vagrant + When the virtual machine is created by Vagrant, it will create a + ``vagrant/.vagrant`` directory to store its files. That directory should not + be committed in your version control system. This ``vagrant/.gitignore`` + file will prevent the ``vagrant/.vagrant`` directory from being listed in + the ``git status`` command. + 6. Switch to the vagrant directory. .. code-block:: bash @@ -376,3 +426,8 @@ another developer's machine. .. _`VirtualBox`: https://www.virtualbox.org/wiki/Downloads .. _`Vagrant`: http://downloads.vagrantup.com/ +.. _`Puppet`: http://www.puppetlabs.com/ +.. _`Vagrant Docs`: http://docs.vagrantup.com/v2/ +.. _`private network`: http://docs.vagrantup.com/v2/networking/private_network.html +.. _`NFS setting`: http://docs.vagrantup.com/v2/synced-folders/nfs.html +.. _`Vagrantfile`: http://docs.vagrantup.com/v2/vagrantfile/index.html From b3bea157651f444b983e9dd688329f4d3de34207 Mon Sep 17 00:00:00 2001 From: Willem Luijt Date: Sun, 25 May 2014 12:49:10 -0700 Subject: [PATCH 05/12] Updated vagrant configuration to work with updated Puppet modules --- cookbook/map.rst.inc | 1 - cookbook/workflow/vagrant_configuration.rst | 48 ++++++++++++--------- 2 files changed, 28 insertions(+), 21 deletions(-) diff --git a/cookbook/map.rst.inc b/cookbook/map.rst.inc index 4772bfe840d..971920963dd 100644 --- a/cookbook/map.rst.inc +++ b/cookbook/map.rst.inc @@ -209,4 +209,3 @@ * :doc:`/cookbook/workflow/new_project_git` * :doc:`/cookbook/workflow/new_project_svn` * :doc:`/cookbook/workflow/vagrant_configuration` - diff --git a/cookbook/workflow/vagrant_configuration.rst b/cookbook/workflow/vagrant_configuration.rst index f7c37fbcace..89a916d76d3 100644 --- a/cookbook/workflow/vagrant_configuration.rst +++ b/cookbook/workflow/vagrant_configuration.rst @@ -114,19 +114,19 @@ You will be creating a set of files under a new ``vagrant`` directory: fi if [ ! -d "/etc/puppet/modules/apache" ]; then - puppet module install puppetlabs-apache; + puppet module install -v 1.0.1 puppetlabs-apache; fi if [ ! -d "/etc/puppet/modules/mysql" ]; then - puppet module install puppetlabs-mysql; + puppet module install -v 2.2.3 puppetlabs-mysql; fi if [ ! -d "/etc/puppet/modules/apt" ]; then - puppet module install puppetlabs-apt; + puppet module install -v 1.4.2 puppetlabs-apt; fi if [ ! -d "/etc/puppet/modules/git" ]; then - puppet module install puppetlabs-git; + puppet module install -v 0.0.3 puppetlabs-git; fi This script will be executed within the virtual machine to install necessary @@ -145,16 +145,19 @@ You will be creating a set of files under a new ``vagrant`` directory: # install Apache - class { 'apache': } + class { 'apache': + mpm_module => 'prefork', + } class { 'apache::mod::php': } # install MySQL - class { 'mysql': } - class { 'mysql::server': - config_hash => { 'root_password' => 'symfony' }, + class { '::mysql::server': + root_password => 'symfony', + } + class { '::mysql::bindings': + php_enable => true, } - class { 'mysql::php': } # install Git for composer @@ -164,7 +167,7 @@ You will be creating a set of files under a new ``vagrant`` directory: # install PHP Extensions used with Symfony class php-extensions { package { ['php-apc', 'php5-intl', 'php5-xdebug']: - ensure => latest, + ensure => present, require => Package['httpd'], notify => Service['httpd'], } @@ -176,6 +179,7 @@ You will be creating a set of files under a new ``vagrant`` directory: # install a local composer.phar file class composer { exec { 'composerPhar': + user => 'vagrant', cwd => '/vagrant', command => 'curl -s http://getcomposer.org/installer | php', path => ['/bin', '/usr/bin'], @@ -194,13 +198,15 @@ You will be creating a set of files under a new ``vagrant`` directory: # install the Symfony vendors using composer class symfony { exec { 'vendorsInstall': - cwd => '/vagrant', - command => 'php composer.phar install', - timeout => 1200, - path => ['/bin', '/usr/bin'], - creates => '/vagrant/vendor', - logoutput => true, - require => Exec['composerPhar'], + user => 'vagrant', + cwd => '/vagrant', + environment => ['COMPOSER_HOME=/home/vagrant/.composer'], + command => 'php composer.phar install', + timeout => 1200, + path => ['/bin', '/usr/bin'], + creates => '/vagrant/vendor', + logoutput => true, + require => [ Class['php-extensions'], Exec['composerPhar'] ], } } @@ -232,14 +238,16 @@ You will be creating a set of files under a new ``vagrant`` directory: # by the web server file_line { 'apache_user': - path => '/etc/apache2/httpd.conf', + path => '/etc/apache2/apache2.conf', + match => 'User ', line => 'User vagrant', require => Package['httpd'], notify => Service['httpd'], } file_line { 'apache_group': - path => '/etc/apache2/httpd.conf', + path => '/etc/apache2/apache2.conf', + match => 'Group ', line => 'Group vagrant', require => Package['httpd'], notify => Service['httpd'], @@ -425,7 +433,7 @@ project without having to worry about your local server setup or the setup of another developer's machine. .. _`VirtualBox`: https://www.virtualbox.org/wiki/Downloads -.. _`Vagrant`: http://downloads.vagrantup.com/ +.. _`Vagrant`: http://www.vagrantup.com/downloads.html .. _`Puppet`: http://www.puppetlabs.com/ .. _`Vagrant Docs`: http://docs.vagrantup.com/v2/ .. _`private network`: http://docs.vagrantup.com/v2/networking/private_network.html From ed605b762f769dbc6080852ad2fe373cf5856798 Mon Sep 17 00:00:00 2001 From: Willem Luijt Date: Mon, 22 Dec 2014 05:18:07 -0800 Subject: [PATCH 06/12] Updated vagrant configuration to help prevent non-updating files when using VirtualBox shared folders --- cookbook/workflow/vagrant_configuration.rst | 1 + 1 file changed, 1 insertion(+) diff --git a/cookbook/workflow/vagrant_configuration.rst b/cookbook/workflow/vagrant_configuration.rst index 89a916d76d3..1a8b9d896f1 100644 --- a/cookbook/workflow/vagrant_configuration.rst +++ b/cookbook/workflow/vagrant_configuration.rst @@ -147,6 +147,7 @@ You will be creating a set of files under a new ``vagrant`` directory: # install Apache class { 'apache': mpm_module => 'prefork', + sendfile => 'Off', } class { 'apache::mod::php': } From 2f13008abdf0a010a7dfac7019b56f9eead54d07 Mon Sep 17 00:00:00 2001 From: Willem Luijt Date: Mon, 22 Dec 2014 05:24:34 -0800 Subject: [PATCH 07/12] Updated vagrant configuration to account for recent Symfony version dependencies --- cookbook/workflow/vagrant_configuration.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cookbook/workflow/vagrant_configuration.rst b/cookbook/workflow/vagrant_configuration.rst index 1a8b9d896f1..e6c188bae51 100644 --- a/cookbook/workflow/vagrant_configuration.rst +++ b/cookbook/workflow/vagrant_configuration.rst @@ -167,7 +167,7 @@ You will be creating a set of files under a new ``vagrant`` directory: # install PHP Extensions used with Symfony class php-extensions { - package { ['php-apc', 'php5-intl', 'php5-xdebug']: + package { ['php-apc', 'php5-curl', 'php5-intl', 'php5-xdebug']: ensure => present, require => Package['httpd'], notify => Service['httpd'], @@ -316,7 +316,7 @@ You will be creating a set of files under a new ``vagrant`` directory: file_line { 'symfony_web_app_dev_host_ipaddress': path => '/vagrant/web/app_dev.php', match => '::1', - line => " || !in_array(@\$_SERVER['REMOTE_ADDR'], array('127.0.0.1', 'fe80::1', '::1', '${::host_ipaddress}'))", + line => " || !(in_array(@\$_SERVER['REMOTE_ADDR'], array('127.0.0.1', 'fe80::1', '::1', '${::host_ipaddress}')) || php_sapi_name() === 'cli-server')", } This file performs the bulk of the work to configure your virtual machine From 0aff5158bf2d6fa020689ef31cd661195bcf8357 Mon Sep 17 00:00:00 2001 From: Willem Luijt Date: Mon, 22 Dec 2014 05:33:21 -0800 Subject: [PATCH 08/12] Updated ordered list formatting --- cookbook/workflow/vagrant_configuration.rst | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/cookbook/workflow/vagrant_configuration.rst b/cookbook/workflow/vagrant_configuration.rst index e6c188bae51..89811f4240d 100644 --- a/cookbook/workflow/vagrant_configuration.rst +++ b/cookbook/workflow/vagrant_configuration.rst @@ -34,7 +34,7 @@ You will be creating a set of files under a new ``vagrant`` directory: vagrant/puppet/modules.sh vagrant/puppet/manifests/symfony.pp -1. Create a new set of directories at the root of your project to store the +#. Create a new set of directories at the root of your project to store the Vagrant configuration files: .. code-block:: bash @@ -43,7 +43,7 @@ You will be creating a set of files under a new ``vagrant`` directory: $ mkdir vagrant/puppet $ mkdir vagrant/puppet/manifests -2. Create a new file ``vagrant/Vagrantfile`` and paste the following into it. +#. Create a new file ``vagrant/Vagrantfile`` and paste the following into it. .. code-block:: text @@ -102,7 +102,7 @@ You will be creating a set of files under a new ``vagrant`` directory: use to customize your virtual machine. These are just the basics to get you started. -3. Create a new file ``vagrant/puppet/modules.sh`` and paste the following +#. Create a new file ``vagrant/puppet/modules.sh`` and paste the following into it. .. code-block:: text @@ -132,7 +132,7 @@ You will be creating a set of files under a new ``vagrant`` directory: This script will be executed within the virtual machine to install necessary Puppet modules for the next script. -4. Create a new file ``vagrant/puppet/manifests/symfony.pp`` and paste the +#. Create a new file ``vagrant/puppet/manifests/symfony.pp`` and paste the following into it. .. code-block:: text @@ -329,7 +329,7 @@ You will be creating a set of files under a new ``vagrant`` directory: ``vagrant/Vagrantfile``) to have access to view your project website during development. -5. Create a new file ``vagrant/.gitignore`` and paste the following into it. +#. Create a new file ``vagrant/.gitignore`` and paste the following into it. .. code-block:: text @@ -341,13 +341,13 @@ You will be creating a set of files under a new ``vagrant`` directory: file will prevent the ``vagrant/.vagrant`` directory from being listed in the ``git status`` command. -6. Switch to the vagrant directory. +#. Switch to the vagrant directory. .. code-block:: bash $ cd vagrant -7. Create the development virtual machine. +#. Create the development virtual machine. .. code-block:: bash From 4737acf2aabafdf3ad7f2051faabbecde9ede330 Mon Sep 17 00:00:00 2001 From: Willem Luijt Date: Mon, 22 Dec 2014 05:37:21 -0800 Subject: [PATCH 09/12] Added a filename comment and adjusted some text --- cookbook/workflow/vagrant_configuration.rst | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/cookbook/workflow/vagrant_configuration.rst b/cookbook/workflow/vagrant_configuration.rst index 89811f4240d..6e71ea657b8 100644 --- a/cookbook/workflow/vagrant_configuration.rst +++ b/cookbook/workflow/vagrant_configuration.rst @@ -370,6 +370,7 @@ use. Just update your ``app/config/parameters.yml`` file: .. code-block:: yaml + # app/config/parameters.yml parameters: database_driver: pdo_mysql database_host: 127.0.0.1 @@ -378,7 +379,7 @@ use. Just update your ``app/config/parameters.yml`` file: database_user: symfony database_password: symfony -The database name, user, and password are "symfony". +The database name, user, and password are set to "symfony". Other Vagrant Commands ---------------------- From c96dd7316d136888bafa406cda97145df4377859 Mon Sep 17 00:00:00 2001 From: Willem Luijt Date: Mon, 22 Dec 2014 05:56:54 -0800 Subject: [PATCH 10/12] Updated vagrant configuration to use newer box configuration references from the Vagrant documentation --- cookbook/workflow/vagrant_configuration.rst | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/cookbook/workflow/vagrant_configuration.rst b/cookbook/workflow/vagrant_configuration.rst index 6e71ea657b8..2c729108895 100644 --- a/cookbook/workflow/vagrant_configuration.rst +++ b/cookbook/workflow/vagrant_configuration.rst @@ -51,9 +51,7 @@ You will be creating a set of files under a new ``vagrant`` directory: # vi: set ft=ruby : Vagrant.configure("2") do |config| - config.vm.box = "precise32" - - config.vm.box_url = "http://files.vagrantup.com/precise32.box" + config.vm.box = "hashicorp/precise32" config.vm.network :private_network, ip: "192.168.33.10" @@ -72,10 +70,10 @@ You will be creating a set of files under a new ``vagrant`` directory: end This is the main configuration file used by Vagrant. The ``config.vm.box`` - and ``config.vm.box_url`` values specify that a preconfigured "box" will be - used for the base virtual machine. This ``precise32.box`` file happens to be - a 32bit Ubuntu Linux machine with certain packages already installed (e.g. - `Puppet`_) and is used extensively within the `Vagrant Docs`_. + value specifies that a preconfigured "box" will be used for the base virtual + machine. This ``hashicorp/precise32`` reference happens to be a 32bit Ubuntu + Linux machine with certain packages already installed (e.g. `Puppet`_) and + is used extensively within the `Vagrant Docs`_. The ``config.vm.network`` will create a `private network`_ and specify the IP address of the virtual machine in that network. You can change the IP From 95064b665314d6bac7f5cb6c4d4591988e72a7eb Mon Sep 17 00:00:00 2001 From: Willem Luijt Date: Mon, 22 Dec 2014 06:18:51 -0800 Subject: [PATCH 11/12] Updated vagrant configuration to enable Xdebug by default --- cookbook/workflow/vagrant_configuration.rst | 31 +++++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/cookbook/workflow/vagrant_configuration.rst b/cookbook/workflow/vagrant_configuration.rst index 2c729108895..26ae6b520ab 100644 --- a/cookbook/workflow/vagrant_configuration.rst +++ b/cookbook/workflow/vagrant_configuration.rst @@ -302,6 +302,37 @@ You will be creating a set of files under a new ``vagrant`` directory: } + # Enable Xdebug support + + file_line { 'php5_apache2_xdebug_remote_enable': + path => '/etc/php5/apache2/conf.d/xdebug.ini', + line => 'xdebug.remote_enable = on', + require => [ Class['apache::mod::php'], Package['php5-xdebug'] ], + notify => Service['httpd'], + } + + file_line { 'php5_cli_xdebug_remote_enable': + path => '/etc/php5/cli/conf.d/xdebug.ini', + line => 'xdebug.remote_enable = on', + require => [ Class['apache::mod::php'], Package['php5-xdebug'] ], + notify => Service['httpd'], + } + + file_line { 'php5_apache2_xdebug_remote_connect_back': + path => '/etc/php5/apache2/conf.d/xdebug.ini', + line => 'xdebug.remote_connect_back = on', + require => [ Class['apache::mod::php'], Package['php5-xdebug'] ], + notify => Service['httpd'], + } + + file_line { 'php5_cli_xdebug_remote_connect_back': + path => '/etc/php5/cli/conf.d/xdebug.ini', + line => 'xdebug.remote_connect_back = on', + require => [ Class['apache::mod::php'], Package['php5-xdebug'] ], + notify => Service['httpd'], + } + + # Configure Symfony dev controllers so that the Vagrant host machine # at the host_ipaddress (specified in the Vagrantfile) has access From d1ae54cd4f2f8c2be4a945fe698588b75d243f95 Mon Sep 17 00:00:00 2001 From: Willem Luijt Date: Mon, 22 Dec 2014 06:44:43 -0800 Subject: [PATCH 12/12] Updated vagrant configuration to use the ubuntu/trusty32 box --- cookbook/workflow/vagrant_configuration.rst | 28 ++++++++++----------- 1 file changed, 13 insertions(+), 15 deletions(-) diff --git a/cookbook/workflow/vagrant_configuration.rst b/cookbook/workflow/vagrant_configuration.rst index 26ae6b520ab..0c65cf44a05 100644 --- a/cookbook/workflow/vagrant_configuration.rst +++ b/cookbook/workflow/vagrant_configuration.rst @@ -51,7 +51,7 @@ You will be creating a set of files under a new ``vagrant`` directory: # vi: set ft=ruby : Vagrant.configure("2") do |config| - config.vm.box = "hashicorp/precise32" + config.vm.box = "ubuntu/trusty32" config.vm.network :private_network, ip: "192.168.33.10" @@ -71,9 +71,8 @@ You will be creating a set of files under a new ``vagrant`` directory: This is the main configuration file used by Vagrant. The ``config.vm.box`` value specifies that a preconfigured "box" will be used for the base virtual - machine. This ``hashicorp/precise32`` reference happens to be a 32bit Ubuntu - Linux machine with certain packages already installed (e.g. `Puppet`_) and - is used extensively within the `Vagrant Docs`_. + machine. This ``ubuntu/trusty32`` reference happens to be a 32bit Ubuntu + Linux machine with certain packages already installed (e.g. `Puppet`_). The ``config.vm.network`` will create a `private network`_ and specify the IP address of the virtual machine in that network. You can change the IP @@ -112,19 +111,19 @@ You will be creating a set of files under a new ``vagrant`` directory: fi if [ ! -d "/etc/puppet/modules/apache" ]; then - puppet module install -v 1.0.1 puppetlabs-apache; + puppet module install -v 1.2.0 puppetlabs-apache; fi if [ ! -d "/etc/puppet/modules/mysql" ]; then - puppet module install -v 2.2.3 puppetlabs-mysql; + puppet module install -v 3.1.0 puppetlabs-mysql; fi if [ ! -d "/etc/puppet/modules/apt" ]; then - puppet module install -v 1.4.2 puppetlabs-apt; + puppet module install -v 1.7.0 puppetlabs-apt; fi if [ ! -d "/etc/puppet/modules/git" ]; then - puppet module install -v 0.0.3 puppetlabs-git; + puppet module install -v 0.3.0 puppetlabs-git; fi This script will be executed within the virtual machine to install necessary @@ -288,14 +287,14 @@ You will be creating a set of files under a new ``vagrant`` directory: } file_line { 'php5_apache2_xdebug_max_nesting_level': - path => '/etc/php5/apache2/conf.d/xdebug.ini', + path => '/etc/php5/apache2/conf.d/20-xdebug.ini', line => 'xdebug.max_nesting_level = 250', require => [ Class['apache::mod::php'], Package['php5-xdebug'] ], notify => Service['httpd'], } file_line { 'php5_cli_xdebug_max_nesting_level': - path => '/etc/php5/cli/conf.d/xdebug.ini', + path => '/etc/php5/cli/conf.d/20-xdebug.ini', line => 'xdebug.max_nesting_level = 250', require => [ Class['apache::mod::php'], Package['php5-xdebug'] ], notify => Service['httpd'], @@ -305,28 +304,28 @@ You will be creating a set of files under a new ``vagrant`` directory: # Enable Xdebug support file_line { 'php5_apache2_xdebug_remote_enable': - path => '/etc/php5/apache2/conf.d/xdebug.ini', + path => '/etc/php5/apache2/conf.d/20-xdebug.ini', line => 'xdebug.remote_enable = on', require => [ Class['apache::mod::php'], Package['php5-xdebug'] ], notify => Service['httpd'], } file_line { 'php5_cli_xdebug_remote_enable': - path => '/etc/php5/cli/conf.d/xdebug.ini', + path => '/etc/php5/cli/conf.d/20-xdebug.ini', line => 'xdebug.remote_enable = on', require => [ Class['apache::mod::php'], Package['php5-xdebug'] ], notify => Service['httpd'], } file_line { 'php5_apache2_xdebug_remote_connect_back': - path => '/etc/php5/apache2/conf.d/xdebug.ini', + path => '/etc/php5/apache2/conf.d/20-xdebug.ini', line => 'xdebug.remote_connect_back = on', require => [ Class['apache::mod::php'], Package['php5-xdebug'] ], notify => Service['httpd'], } file_line { 'php5_cli_xdebug_remote_connect_back': - path => '/etc/php5/cli/conf.d/xdebug.ini', + path => '/etc/php5/cli/conf.d/20-xdebug.ini', line => 'xdebug.remote_connect_back = on', require => [ Class['apache::mod::php'], Package['php5-xdebug'] ], notify => Service['httpd'], @@ -466,7 +465,6 @@ another developer's machine. .. _`VirtualBox`: https://www.virtualbox.org/wiki/Downloads .. _`Vagrant`: http://www.vagrantup.com/downloads.html .. _`Puppet`: http://www.puppetlabs.com/ -.. _`Vagrant Docs`: http://docs.vagrantup.com/v2/ .. _`private network`: http://docs.vagrantup.com/v2/networking/private_network.html .. _`NFS setting`: http://docs.vagrantup.com/v2/synced-folders/nfs.html .. _`Vagrantfile`: http://docs.vagrantup.com/v2/vagrantfile/index.html