-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathVagrantfile
83 lines (67 loc) · 2.73 KB
/
Vagrantfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
# -*- mode: ruby -*-
# vi: set ft=ruby :
Vagrant.configure(2) do |config|
config.vm.box = "ubuntu/trusty64"
config.vm.network "private_network", ip: "10.10.10.10"
config.vm.hostname = "marathon-consul"
config.vm.provider "virtualbox" do |vb|
vb.name = "marathon-consul"
end
config.vm.post_up_message = """
* Mesos: http://10.10.10.10:5050
* Marathon: http://10.10.10.10:8080
* Consul: http://10.10.10.10:8500
"""
config.vm.provision "shell", inline: <<-SHELL
curl -s https://bintray.com/user/downloadSubjectPublicKey?username=allegro | sudo apt-key add -
sudo apt-key adv --keyserver keyserver.ubuntu.com --recv E56151BF
DISTRO=$(lsb_release -is | tr '[:upper:]' '[:lower:]')
CODENAME=$(lsb_release -cs)
echo "deb http://repos.mesosphere.io/${DISTRO} ${CODENAME} main" | \
sudo tee /etc/apt/sources.list.d/mesosphere.list
echo "deb http://dl.bintray.com/v1/content/allegro/deb /" | \
sudo tee /etc/apt/sources.list.d/marathon-consul.list
sudo add-apt-repository ppa:webupd8team/java
sudo apt-get -y update
echo oracle-java8-installer shared/accepted-oracle-license-v1-1 select true | sudo /usr/bin/debconf-set-selections
sudo apt-get -qy install curl unzip oracle-java8-set-default zookeeperd mesos marathon marathon-consul
echo "10.10.10.10" > /etc/mesos-slave/hostname
mkdir -p /etc/marathon/conf
echo "http_callback" > /etc/marathon/conf/event_subscriber
echo "http://10.10.10.10:4000/events" > /etc/marathon/conf/http_endpoints
mkdir -p /usr/share/consul
mkdir -p /etc/consul.d/server
mkdir -p /var/consul
CONSUL_VERSION=0.7.2
curl -OLs https://releases.hashicorp.com/consul/${CONSUL_VERSION}/consul_${CONSUL_VERSION}_linux_amd64.zip
unzip -o consul_${CONSUL_VERSION}_linux_amd64.zip -d /usr/local/bin && rm consul_${CONSUL_VERSION}_linux_amd64.zip
curl -OLs https://releases.hashicorp.com/consul/${CONSUL_VERSION}/consul_${CONSUL_VERSION}_web_ui.zip
unzip -o consul_${CONSUL_VERSION}_web_ui.zip -d /usr/share/consul/ui && rm consul_${CONSUL_VERSION}_web_ui.zip
cat > /etc/consul.d/server/config.json <<EOF
{
"bootstrap": true,
"server": true,
"datacenter": "dc1",
"data_dir": "/var/consul",
"advertise_addr": "10.10.10.10",
"client_addr": "10.10.10.10",
"log_level": "INFO",
"enable_syslog": true,
"ui_dir": "/usr/share/consul/ui"
}
EOF
cat > /etc/init/consul.conf <<EOF
description "Consul server process"
start on (local-filesystems and net-device-up IFACE=eth0)
stop on runlevel [!12345]
respawn
exec consul agent -config-dir /etc/consul.d/server
EOF
service zookeeper restart
service mesos-slave restart
service mesos-master restart
service marathon restart
service consul restart
service marathon-consul restart
SHELL
end