Skip to content

Instantly share code, notes, and snippets.

@davidkelley
Last active June 15, 2016 16:34
Show Gist options
  • Save davidkelley/10591220 to your computer and use it in GitHub Desktop.
Save davidkelley/10591220 to your computer and use it in GitHub Desktop.
Configures Vagrant to run Docker & Fig
# Run Application specific setup tasks here!
#!/usr/bin/env bash
cd /vagrant
fig run web foreman run rake db:create
fig run web foreman run rake db:migrate
#!/usr/bin/env bash
echo 'vagrant ALL= (ALL:ALL) NOPASSWD: ALL' >> /etc/sudoers
apt-get update -y
apt-get install linux-image-extra-`uname -r` -y
apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 36A1D7869245C8950F966E92D8576A8BA88D21E9
echo deb http://get.docker.io/ubuntu docker main > /etc/apt/sources.list.d/docker.list
apt-get update -y
apt-get install lxc-docker -y
apt-get install curl -y
curl -L https://github.com/orchardup/fig/releases/download/0.3.2/linux > /usr/local/bin/fig
chmod +x /usr/local/bin/fig
#!/usr/bin/env bash
cd /vagrant
fig build
fig up -d
# -*- 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|
# Every Vagrant virtual environment requires a box to build off of.
config.vm.box = "ubuntu-raring-amd64"
# 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://cloud-images.ubuntu.com/vagrant/raring/current/raring-server-cloudimg-amd64-vagrant-disk1.box"
# Create a forwarded port mapping which allows access to a specific port
# within the machine from a port on the host machine.
[3306, 2345, 15672, 5672, 15674, 11211, 11371].each do |p|
config.vm.network :forwarded_port, guest: p, host: p
end
# Share an additional folder to the guest VM
config.vm.synced_folder ".", "/vagrant"
# Bootstrap to Docker
config.vm.provision :shell, path: ".script.bootstrap", :privileged => true
# Bootstrap to Fig
config.vm.provision :shell, path: ".script.fig", :privileged => true
# Bootstrap the App
config.vm.provision :shell, path: ".script.app", :privileged => true
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment