A basic Ubuntu 12.04 Vagrant setup with Laravel4 and PHP 5.5. PHP 5.4 w/ Apache 2.2 is available on the php54 branch.
- VirtualBox - Free virtualization software Download Virtualbox
- Vagrant 1.3+ - Tool for working with virtualbox images Download Vagrant
- Git - Source Control Management Download Git
- Clone this repository
git clone http://github.com/bryannielsen/Laravel4-Vagrant.git
- run
vagrant up
inside the newly created directory - (the first time you run vagrant it will need to fetch the virtual box image which is ~300mb so depending on your download speed this could take some time)
- Vagrant will then use puppet to provision the base virtual box with our LAMP stack (this could take a few minutes) also note that composer will need to fetch all of the packages defined in the app's composer.json which will add some more time to the first provisioning run
- You can verify that everything was successful by opening http://localhost:8888 in a browser
Note: You may have to change permissions on the www/app/storage folder to 777 under the host OS
For example: chmod -R 777 www/app/storage/
Some basic information on interacting with the vagrant box
- 8888 - Apache
- 8889 - MySQL
- 5433 - PostgreSQL
- User: root
- Password: (blank)
- DB Name: database
Accessible at http://localhost:8888/phpmyadmin using MySQL access credentials above.
XDebug is included in the build but disabled by default because of the effect it can have on performance.
To enable XDebug:
- Set the variable
$use_xdebug = "1"
at the beginning ofpuppet/manifests/phpbase.pp
- Then you will need to provision the box either with
vagrant up
or by running the commandvagrant provision
if the box is already up - Now you can connect to XDebug on port 9001
XDebug Tools
Note: All XDebug settings can be configured in the php.ini template at puppet/modules/php/templates/php.ini.erb
Vagrant is very well documented but here are a few common commands:
vagrant up
starts the virtual machine and provisions itvagrant suspend
will essentially put the machine to 'sleep' withvagrant resume
waking it back upvagrant halt
attempts a graceful shutdown of the machine and will need to be brought back withvagrant up
vagrant ssh
gives you shell access to the virtual machine
Easy deployment to the cloud (AWS), via vagrant up --provider=aws
. The Vagrantfile contains configuration options for setting your keypair name, the the location of your key and the name of your server.
- OS - Ubuntu 12.04
- Apache - 2.4.6
- PHP - 5.5.4
- MySQL - 5.5.32
- PostgreSQL - 9.1
- Beanstalkd - 1.4.6
- Redis - 2.2.12
- Memcached - 1.4.13