Skip to content

Commit

Permalink
Start rewriting Vagrantfile for Ubuntu 14.04 (gratipay#2327 and grati…
Browse files Browse the repository at this point in the history
  • Loading branch information
techtonik committed Nov 1, 2014
1 parent 6119091 commit cf90d8e
Showing 1 changed file with 37 additions and 25 deletions.
62 changes: 37 additions & 25 deletions Vagrantfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,35 +5,47 @@
VAGRANTFILE_API_VERSION = "2"

Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
config.vm.provider "virtualbox" do |v|
v.customize ["modifyvm", :id, "--natdnshostresolver1", "on"]
end

# For now we have a custom built vagrant image. It was built in the following manner:
#
# - Use 'precise64' as a base.
# - perform a 'vagrant up' using this vagrantfile:
# https://github.com/gratipay/gratipay.com/blob/83312e60c6b31c298ffca61036baa9849044c75e/Vagrantfile
# - drop database gratipay
# - drop role gratipay
#
# Here are some instructions for modifying an existing box:
#
# http://www.pvcloudsystems.com/2012/10/vagrant-modify-existing-box/
#
# I used that successfully on https://github.com/gratipay/gratipay.com/pull/2815.
# We use multi-machine config here. First one to rebuild the box from scratch
# (it is normally commented) and second (faster) that download built version.

config.vm.box = "gratipay"
config.vm.box_url = File.exist?("gratipay.box") ? "file://gratipay.box" : "https://downloads.gratipay.com/gratipay.box"
# Previous configs are:
# - https://github.com/gratipay/gratipay.com/blob/83312e60c6b31c298ffca61036baa9849044c75e/Vagrantfile
# - https://github.com/gratipay/gratipay.com/blob/fc0b4395e85259cdd17d9fe8560bf654abd756ce/Vagrantfile

# Sync the project directory and expose the app
config.vm.network "private_network", ip: "172.27.36.119"
config.vm.synced_folder ".", "/vagrant", type: "nfs"

# --- [ common access parameters ] ---

# Gratipay app is accessible at http://localhost:8537/ from host
#
config.vm.network :forwarded_port, guest: 8537, host: 8537

# TODO: Pin apt-get packages to the same versions Heroku uses
# Current folder is available as /vagrant from guest.
# We speed up access by installing and using NFS as described here:
# https://docs.vagrantup.com/v2/synced-folders/nfs.html
config.vm.synced_folder ".", "/vagrant", type: "nfs"
config.vm.network "private_network", ip: "172.27.36.119"


# --- [ boxes ] ---
# after you bootstrap this box, saving it into a gratipay.box is as easy as
# $ vagrant package --output gratipay.box
config.vm.define "basebox" do |base|
# using Ubuntu 14.04, because it is what our hosting (Heroku) uses
# (search cedar-14 for details)
base.vm.box = "ubuntu/trusty64"

# [ ] use the same package versions as Heroku

end

# disable snapshot box for now
#config.vm.define "gratipay" do |box|
# box.vm.box = "gratipay"
# config.vm.box_url = File.exist?("gratipay.box") ? "file://gratipay.box" : "https://downloads.gratipay.com/gratipay.box"
#
# config.vm.provision :shell,
# :path => "scripts/vagrant-setup.sh"
#end

# Installed dependencies are already part of the base image now
config.vm.provision :shell,
:path => "scripts/vagrant-setup.sh"
end

0 comments on commit cf90d8e

Please sign in to comment.