Skip to content

Instantly share code, notes, and snippets.

@sailor
Created March 25, 2015 13:09
Show Gist options
  • Star 14 You must be signed in to star a gist
  • Fork 3 You must be signed in to fork a gist
  • Save sailor/b5b89d077ca8f856ec39 to your computer and use it in GitHub Desktop.
Save sailor/b5b89d077ca8f856ec39 to your computer and use it in GitHub Desktop.
Vagrantfile for Rails development environment
VAGRANTFILE_API_VERSION = '2'
$install = <<SCRIPT
curl -L https://github.com/docker/fig/releases/download/1.0.1/fig-`uname -s`-`uname -m` > /usr/local/bin/fig
chmod +x /usr/local/bin/fig
SCRIPT
$build = <<SCRIPT
cd /vagrant
fig build
fig run web rake db:create
fig run web rake db:migrate
fig run web rake db:seed
SCRIPT
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
config.vm.provider 'virtualbox' do |v|
v.memory = 2048
v.cpus = 2
end
config.vm.box = 'ubuntu/trusty64'
config.vm.provision 'docker'
config.vm.provision 'shell', inline: $install
config.vm.network :private_network, ip: '172.17.8.100'
config.vm.network 'forwarded_port', guest: 1080, host: 1080
config.vm.synced_folder '.', '/vagrant', type: 'nfs', mount_options: ['nolock,vers=3,udp,noatime,actimeo=1']
config.vm.provision 'shell', inline: $build
config.vm.provision 'shell', inline: 'cd /vagrant && fig up -d', run: 'always'
end
@thedug
Copy link

thedug commented Apr 18, 2015

I'm running a similar setup and I've had some issues with NFS reliability. Is this still working well for you?

@derek-adair
Copy link

NFS is problematic within Vagrant in my experience. It was quite a headache getting it all set up.

Define "reliability" though. What specifici problems are you having? Slow performance?

here is an article comparing different means to sync files between vagrant and host machine that you sould find enlightening.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment