My chef-solo cookbook with webserver configuration
- LAMP (PHP 5.4)
- Postgres 9.1
- Python with pip and virtualenv
- VirtualBox
# aptitude install virtualbox
- Vagrant >=1.6.1
- NFS
# aptitude install nfs-kernel-server nfs-common
-
Clone the project
$ git clone https://github.com/laborautonomo/vagrant-debian-7.4-x64-webserver.git $ cd vagrant-debian-7.4-x64-webserver
-
Change
Vagrantfile
with your preferencesconfig.vm.box = "chef/debian-7.4" config.vm.network "forwarded_port", guest: 80, host: 8080 config.vm.network "private_network", ip: "192.168.33.102" config.vm.post_up_message = "Your environment is ready and accessible in http://192.168.33.102" config.vm.synced_folder "/var/www", "/vagrant", type: "nfs" config.vm.provider "virtualbox" do |vb| vb.customize ["modifyvm", :id, "--memory", "1024"] end
-
Configure the MySQL root password in
cookbooks/mysql/recipes/default.rb
mysql_root_pwd = "your-password"
-
Configure Postgres in
cookbooks/postgres/recipes/default.rb
# Edit the following to change the name of the database user that will be created: db_user="user-name" db_pass="your-password" # Edit the following to change the version of PostgreSQL that is installed pg_version=9.1
-
Configure Apache2 default values of vhost in
cookbooks/apache2/recipes/default.rb
node.default['apache']['server_name'] = "192.168.33.102" node.default['apache']['server_admin'] = "your@email" node.default['apache']['doc_root'] = "/vagrant"
-
Configure the hosts and doc_roots of your websites in
cookbooks/apache2/recipes/sites_available.rb
SITES_AVAILABLE = [ {:server_name => 'host1',:doc_root => 'website1'}, {:server_name => 'host2', :doc_root => 'website2'}, ... ]
-
Finally, execute
vagrant up --provision