@@ -71,6 +71,37 @@ You will be creating a set of files under a new ``vagrant`` directory:
71
71
end
72
72
end
73
73
74
+ This is the main configuration file used by Vagrant. The ``config.vm.box ``
75
+ and ``config.vm.box_url `` values specify that a preconfigured "box" will be
76
+ used for the base virtual machine. This ``precise32.box `` file happens to be
77
+ a 32bit Ubuntu Linux machine with certain packages already installed (e.g.
78
+ `Puppet `_) and is used extensively within the `Vagrant Docs `_.
79
+
80
+ The ``config.vm.network `` will create a `private network `_ and specify the IP
81
+ address of the virtual machine in that network. You can change the IP
82
+ address to a different private IP address if you wish (such as
83
+ 192.168.50.12, 172.16.32.64, or 10.9.8.7 just to list a few examples), just
84
+ be sure to update the ``host_ipaddress `` value in the ``puppet.facter ``
85
+ section as well. The last number in the ``host_ipaddress `` must be 1 (so the
86
+ example host IP address values would be 192.168.50.1, 172.16.32.1, or
87
+ 10.9.8.1 respectively).
88
+
89
+ The ``config.vm.synced_folder `` specifies that the directory one level above
90
+ this file (your project directory) will be synced with the ``/vagrant ``
91
+ directory within the virtual machine. When you make a change to a file in
92
+ your project directory, that change should be reflected in the virtual
93
+ machine. The reverse is true as well. The commented out `NFS setting `_ can
94
+ be useful but is not required. If you would like to use NFS, just uncomment
95
+ the setting (remove the ``# ``).
96
+
97
+ The ``config.vm.provision `` sections will execute the
98
+ ``vagrant/puppet/modules.sh `` and ``vagrant/puppet/manifests/symfony.pp ``
99
+ scripts that you will create next.
100
+
101
+ There are a number of other settings for the `Vagrantfile `_ which you can
102
+ use to customize your virtual machine. These are just the basics to get you
103
+ started.
104
+
74
105
3. Create a new file ``vagrant/puppet/modules.sh `` and paste the following
75
106
into it.
76
107
@@ -98,6 +129,9 @@ You will be creating a set of files under a new ``vagrant`` directory:
98
129
puppet module install puppetlabs-git;
99
130
fi
100
131
132
+ This script will be executed within the virtual machine to install necessary
133
+ Puppet modules for the next script.
134
+
101
135
4. Create a new file ``vagrant/puppet/manifests/symfony.pp `` and paste the
102
136
following into it.
103
137
@@ -276,12 +310,28 @@ You will be creating a set of files under a new ``vagrant`` directory:
276
310
line => " || !in_array(@\$_SERVER['REMOTE_ADDR'], array('127.0.0.1', 'fe80::1', '::1', '${::host_ipaddress}'))",
277
311
}
278
312
313
+ This file performs the bulk of the work to configure your virtual machine
314
+ for web development. It will install Apache, MySQL, PHP, and Git. It will
315
+ configure Apache to use recommended Symfony settings and will set your
316
+ project ``web/ `` directory as the web server's document root. If there are
317
+ no vendors in your project, it will execute ``php composer.phar install `` to
318
+ retrieve them. Also, it will update your project ``web/app_dev.php `` file to
319
+ allow your physical host machine (specified by the ``host_ipaddress `` in the
320
+ ``vagrant/Vagrantfile ``) to have access to view your project website during
321
+ development.
322
+
279
323
5. Create a new file ``vagrant/.gitignore `` and paste the following into it.
280
324
281
325
.. code-block :: text
282
326
283
327
.vagrant
284
328
329
+ When the virtual machine is created by Vagrant, it will create a
330
+ ``vagrant/.vagrant `` directory to store its files. That directory should not
331
+ be committed in your version control system. This ``vagrant/.gitignore ``
332
+ file will prevent the ``vagrant/.vagrant `` directory from being listed in
333
+ the ``git status `` command.
334
+
285
335
6. Switch to the vagrant directory.
286
336
287
337
.. code-block :: bash
@@ -376,3 +426,8 @@ another developer's machine.
376
426
377
427
.. _`VirtualBox` : https://www.virtualbox.org/wiki/Downloads
378
428
.. _`Vagrant` : http://downloads.vagrantup.com/
429
+ .. _`Puppet` : http://www.puppetlabs.com/
430
+ .. _`Vagrant Docs` : http://docs.vagrantup.com/v2/
431
+ .. _`private network` : http://docs.vagrantup.com/v2/networking/private_network.html
432
+ .. _`NFS setting` : http://docs.vagrantup.com/v2/synced-folders/nfs.html
433
+ .. _`Vagrantfile` : http://docs.vagrantup.com/v2/vagrantfile/index.html
0 commit comments