github.com/fafucoder/cilium@v1.6.11/examples/mesos/Vagrantfile (about) 1 # -*- mode: ruby -*- 2 # vi: set ft=ruby : 3 4 Vagrant.require_version ">= 2.0.0" 5 6 $bootstrap = <<SCRIPT 7 sudo sed -i -re 's/([a-z]{2}\.)?archive.ubuntu.com|security.ubuntu.com/old-releases.ubuntu.com/g' /etc/apt/sources.list 8 apt-get update 9 #apt-get -y upgrade 10 #install new kernel? 11 12 apt -y install docker.io 13 14 curl -sL http://repos.mesosphere.com/ubuntu/pool/main/m/mesos/mesos_1.5.0-2.0.1.ubuntu1704_amd64.deb > /tmp/mesos_1.5.0-2.0.1.ubuntu1704_amd64.deb 15 apt -y install /tmp/mesos_1.5.0-2.0.1.ubuntu1704_amd64.deb 16 17 # remove openjdk-9 as it conflicts with zookeeper 18 # removing openjdk-9 will install openjdk-8 automatically 19 apt -y remove openjdk-9-jre-headless 20 21 echo "/var/lib/mesos" > /etc/mesos/work_dir 22 echo "zk://192.168.44.11:2181/mesos" > /etc/mesos/zk 23 echo "192.168.44.11" > /etc/mesos-master/ip 24 echo "192.168.44.11" > /etc/mesos-slave/ip 25 echo "/var/run/docker.sock" > /etc/mesos-slave/docker_socket 26 echo "docker,mesos" > /etc/mesos-slave/containerizers 27 echo "docker" > /etc/mesos-slave/image_providers 28 echo "filesystem/linux,docker/runtime" > /etc/mesos-slave/isolation 29 echo "/opt/cni/bin" > /etc/mesos-slave/network_cni_plugins_dir 30 echo "/etc/cni/net.d" > /etc/mesos-slave/network_cni_config_dir 31 32 curl -sL https://downloads.mesosphere.com/marathon/releases/1.6.322/marathon-1.6.322-2bf46b341.tgz | tar -xz 33 mv marathon-1.6.322-2bf46b341 marathon 34 35 # allow default user to use docker 36 usermod -aG docker vagrant 37 38 curl -sL https://github.com/docker/compose/releases/download/1.14.0/docker-compose-`uname -s`-`uname -m` > /usr/bin/docker-compose 39 chmod a+x /usr/bin/docker-compose 40 41 service zookeeper restart 42 service mesos-master restart 43 service mesos-slave restart 44 45 cd /home/vagrant/allfiles 46 47 docker-compose up -d 48 49 while [[ -z $cilium_docker ]]; do 50 sleep 1 51 cilium_docker=$(docker ps -a -q --filter="ancestor=cilium/cilium:stable" --filter="status=running") 52 done 53 54 # copy cilium from container to host 55 mkdir /home/vagrant/bin 56 docker cp $cilium_docker:/usr/bin/cilium /home/vagrant/bin/cilium 57 docker exec $cilium_docker /cni-install.sh 58 echo 'PATH=$PATH:/home/vagrant/bin' >> /home/vagrant/.bashrc 59 60 chown -R vagrant:vagrant /home/vagrant/ 61 echo "Deploying Vagrant VM + Cilium + Mesos...done" 62 63 echo 'cd /home/vagrant/allfiles' >> /home/vagrant/.bashrc 64 SCRIPT 65 66 Vagrant.configure(2) do |config| 67 config.vm.box = "bento/ubuntu-17.04" 68 config.vm.provision "file", source: "./allfiles", destination: "./allfiles" 69 config.vm.provision "bootstrap", type: "shell", inline: $bootstrap 70 config.vm.network "forwarded_port", guest: 8080, host: 8080 71 config.vm.network "private_network", ip: "192.168.44.11" 72 config.vm.provider "virtualbox" do |v| 73 v.memory = 1024 74 end 75 end