Last active
August 29, 2015 14:02
-
-
Save bennibu/1a8eae17f2e2ea3ba5ae to your computer and use it in GitHub Desktop.
foodsoft Vagrantfile
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- mode: ruby -*- | |
# vi: set ft=ruby : | |
# Vagrantfile API/syntax version. Don't touch unless you know what you're doing! | |
VAGRANTFILE_API_VERSION = "2" | |
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config| | |
# Choose vagrant provider, lxc is much faster, so use it if you can | |
# | |
# Install lxc plugin first: https://github.com/fgrehm/vagrant-lxc | |
config.vm.box = "fgrehm/trusty64-lxc" | |
# | |
# Or if lxc plugin can't be installed: | |
# config.vm.box = "ubuntu/trusty64" | |
config.vm.network "forwarded_port", guest: 3000, host: 8000 | |
config.vm.network "forwarded_port", guest: 1080, host: 8080 | |
# If true, then any SSH connections made will enable agent forwarding. | |
# Default value: false | |
# config.ssh.forward_agent = true | |
# Mount foodsoft into container | |
config.vm.synced_folder "./", "/home/vagrant/foodsoft" | |
# Disable default vagrant folder | |
config.vm.synced_folder "./", "/vagrant", disabled: true | |
# Tune virtualbox provider | |
config.vm.provider "virtualbox" do |vb| | |
vb.memory = 1024 | |
end | |
config.vm.provision 'shell', privileged: false, inline: <<-SHELL | |
sudo apt-get update | |
sudo apt-get upgrade -y | |
sudo apt-get install -y git ruby2.0 ruby2.0-dev libsqlite3-dev libmysqlclient-dev nodejs redis-server build-essential tmux phantomjs | |
sudo update-alternatives --install /usr/bin/ruby ruby /usr/bin/ruby2.0 50 | |
sudo update-alternatives --install /usr/bin/gem gem /usr/bin/gem2.0 50 | |
# If you wanna use ruby2.1 instead .. | |
# sudo add-apt-repository ppa:brightbox/ruby-ng -y && sudo apt-get update && sudo apt-get install ruby2.1 ruby2.1-dev -y | |
sudo gem install bundler mailcatcher --no-ri --no-rdoc | |
echo -e "\n**** Install mysql server with root password 'foobar'\n" | |
sudo debconf-set-selections <<< 'mysql-server mysql-server/root_password password foobar' && | |
sudo debconf-set-selections <<< 'mysql-server mysql-server/root_password_again password foobar' && | |
sudo apt-get install -y mysql-server | |
cd /home/vagrant/foodsoft | |
bundle install --path .bundle | |
cp -ub config/app_config.yml.SAMPLE config/app_config.yml | |
cp -ub config/environments/development.rb.SAMPLE config/environments/development.rb | |
if [ ! -f config/database.yml ] | |
then | |
cp config/database.yml.MySQL_SAMPLE config/database.yml | |
sed -i '/development:/a \ \ username: root\n\ \ password: foobar' config/database.yml | |
sed -i '/test:/a \ \ username: root\n\ \ password: foobar' config/database.yml | |
fi | |
cp -ub config/initializers/secret_token.rb.SAMPLE config/initializers/secret_token.rb | |
bundle exec rake db:setup | |
SHELL | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment