Skip to content

Instantly share code, notes, and snippets.

@taylorlapeyre
Created April 16, 2013 21:55
Show Gist options
  • Save taylorlapeyre/5399974 to your computer and use it in GitHub Desktop.
Save taylorlapeyre/5399974 to your computer and use it in GitHub Desktop.
# -*- mode: ruby -*-
# vi: set ft=ruby :
$script = <<SCRIPT
sudo rm -rf /var/www
sudo ln -fs /vagrant/project/directory /var/www
sudo mysqladmin -s -uroot -pvagrant create project_db --force
sudo mysql -s -uroot -pvagrant -e 'GRANT ALL PRIVILEGES ON project_db.* \
TO "project_user"@"localhost" IDENTIFIED BY "SecurePassword";'
sudo mysql -s -uproject_user -pSecurePassword -h localhost \
project_db < /vagrant/path/to/project.sql
SCRIPT
Vagrant.configure("2") do |config|
# All Vagrant configuration is done here. The most common configuration
# options are documented and commented below. For a complete reference,
# please see the online documentation at vagrantup.com.
# Every Vagrant virtual environment requires a box to build off of.
config.vm.box = "develop"
# The url from where the 'config.vm.box' box will be fetched if it
# doesn't already exist on the user's system.
config.vm.box_url = "http://files.taylorlapeyre.me/treasure/boxes.develop.box"
config.vm.network :forwarded_port, guest: 80, host: 8080
config.vm.provision :shell, :inline => $script
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment