|
| 1 | +# -*- mode: ruby -*- |
| 2 | +# vi: set ft=ruby : |
| 3 | + |
| 4 | +# All Vagrant configuration is done below. The "2" in Vagrant.configure |
| 5 | +# configures the configuration version (we support older styles for |
| 6 | +# backwards compatibility). Please don't change it unless you know what |
| 7 | +# you're doing. |
| 8 | +Vagrant.configure(2) do |config| |
| 9 | + # The most common configuration options are documented and commented below. |
| 10 | + # For a complete reference, please see the online documentation at |
| 11 | + # https://docs.vagrantup.com. |
| 12 | + |
| 13 | + # Every Vagrant development environment requires a box. You can search for |
| 14 | + # boxes at https://atlas.hashicorp.com/search. |
| 15 | + config.vm.box = "ubuntu/trusty64" |
| 16 | + |
| 17 | + # Create a private network, which allows host-only access to the machine |
| 18 | + # using a specific IP. |
| 19 | + config.vm.network "private_network", ip: "192.168.62.54" |
| 20 | + |
| 21 | + # Provider-specific configuration so you can fine-tune various |
| 22 | + # backing providers for Vagrant. These expose provider-specific options. |
| 23 | + # Example for VirtualBox: |
| 24 | + # |
| 25 | + config.vm.provider "virtualbox" do |vb| |
| 26 | + # Customize the amount of memory on the VM: |
| 27 | + vb.memory = "1536" |
| 28 | + |
| 29 | + # A fix for speed issues with DNS resolution: |
| 30 | + # http://serverfault.com/questions/453185/vagrant-virtualbox-dns-10-0-2-3-not-working?rq=1 |
| 31 | + vb.customize ["modifyvm", :id, "--natdnshostresolver1", "on"] |
| 32 | + |
| 33 | + # Set the timesync threshold to 59 seconds, instead of the default 20 minutes. |
| 34 | + # 59 seconds chosen to ensure SimpleSAML never gets too far out of date. |
| 35 | + vb.customize ["guestproperty", "set", :id, "/VirtualBox/GuestAdd/VBoxService/--timesync-set-threshold", 59000] |
| 36 | + end |
| 37 | + # |
| 38 | + # View the documentation for the provider you are using for more |
| 39 | + # information on available options. |
| 40 | + |
| 41 | + # This provisioner runs on the first `vagrant up`. |
| 42 | + config.vm.provision "install", type: "shell", inline: <<-SHELL |
| 43 | + # Add Docker apt repository |
| 44 | + sudo apt-key adv --keyserver hkp://p80.pool.sks-keyservers.net:80 --recv-keys 58118E89F3A912897C070ADBF76221572C52609D |
| 45 | + sudo sh -c 'echo deb https://apt.dockerproject.org/repo ubuntu-trusty main > /etc/apt/sources.list.d/docker.list' |
| 46 | + sudo apt-get update -y |
| 47 | +
|
| 48 | + # Add NTP so that the LDAP queries don't unexpectedly fail. |
| 49 | + sudo apt-get install ntp -y |
| 50 | +
|
| 51 | + # Uninstall old lxc-docker |
| 52 | + apt-get purge lxc-docker |
| 53 | + apt-cache policy docker-engine |
| 54 | +
|
| 55 | + # Install docker and dependencies |
| 56 | + sudo apt-get install -y linux-image-extra-$(uname -r) |
| 57 | + sudo apt-get install -y docker-engine |
| 58 | +
|
| 59 | + # Add user vagrant to docker group |
| 60 | + sudo groupadd docker |
| 61 | + sudo usermod -aG docker vagrant |
| 62 | +
|
| 63 | + # Install Docker Compose |
| 64 | + curl -L https://github.com/docker/compose/releases/download/1.9.0/docker-compose-`uname -s`-`uname -m` > /usr/local/bin/docker-compose |
| 65 | + chmod +x /usr/local/bin/docker-compose |
| 66 | + SHELL |
| 67 | + |
| 68 | + # This provisioner runs on every `vagrant reload' (as well as the first |
| 69 | + # `vagrant up`), reinstalling from local directories |
| 70 | + config.vm.provision "recompose", type: "shell", run: "always", inline: <<-SHELL |
| 71 | +
|
| 72 | + cd /vagrant |
| 73 | + |
| 74 | + # Set necessary environment variables for shell access. |
| 75 | + export COMPOSER_CACHE_DIR=/tmp |
| 76 | + export DOCKER_UIDGID="$(id -u):$(id -g)" |
| 77 | + |
| 78 | + # Set up necessary env. vars to automatically be present each time. |
| 79 | + cat << 'EOF' >> /home/vagrant/.bashrc |
| 80 | +export COMPOSER_CACHE_DIR=/tmp |
| 81 | +export DOCKER_UIDGID="$(id -u):$(id -g)" |
| 82 | +EOF |
| 83 | +
|
| 84 | + SHELL |
| 85 | + |
| 86 | +end |
0 commit comments