This repository has been archived by the owner on Dec 24, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
cloud-config-slave.yaml
80 lines (78 loc) · 3.65 KB
/
cloud-config-slave.yaml
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
#cloud-config
coreos:
etcd:
# generate a new token for each unique cluster from h/vttps://discovery.etcd.io/new
discovery: ---change this line ---"
# use $public_ipv4 if your datacenter of choice does not support private networking
addr: $private_ipv4:4001
peer-addr: $private_ipv4:7001
fleet:
public-ip: $private_ipv4 # used for fleetctl ssh command
units:
- name: etcd.service
command: start
- name: fleet.service
command: start
- name: docker-consul.service
command: start
content: |
[Unit]
Description=Consul
After=docker.service
Requires=docker.service
[Service]
Restart=on-failure
TimeoutStartSec=0
EnvironmentFile=/etc/environment
ExecStartPre=-/usr/bin/docker kill consul
ExecStartPre=-/usr/bin/docker rm consul
ExecStartPre=/usr/bin/docker pull progrium/consul
ExecStartPre=-/usr/bin/etcdctl mk /consul $COREOS_PUBLIC_IPV4
ExecStart=/usr/bin/sh -c "/usr/bin/docker run --rm --net=host --name consul progrium/consul -server -bootstrap-expect 3 -advertise $(/usr/bin/ip -o -4 addr list eth0 | /usr/bin/grep global | /usr/bin/awk \'{print $4}\' | /usr/bin/cut -d/ -f1)"
ExecStop=/usr/bin/docker stop consul
- name: consul-discovery.service
command: start
content: |
[Unit]
Description=Consul Discovery
BindsTo=docker-consul.service
After=docker-consul.service
[Service]
Restart=on-failure
EnvironmentFile=/etc/environment
ExecStart=/bin/sh -c "while true; do etcdctl mk /services/consul $COREOS_PUBLIC_IPV4 --ttl 60;/usr/bin/docker exec consul consul join $(etcdctl get /services/consul);sleep 45;done"
ExecStop=/usr/bin/etcdctl rm /services/consul --with-value %H
- name: docker-registrator.service
command: start
content: |
[Unit]
Description=Registrator
After=After=docker.service
Requires=docker.service
[Service]
Restart=on-failure
TimeoutStartSec=0
EnvironmentFile=/etc/environment
ExecStartPre=-/usr/bin/docker kill registrator
ExecStartPre=-/usr/bin/docker rm registrator
ExecStartPre=/usr/bin/docker pull progrium/registrator
ExecStart=/usr/bin/sh -c "/usr/bin/docker run --rm --name registrator -h $(/usr/bin/cat /etc/hostname) -v /var/run/docker.sock:/tmp/docker.sock progrium/registrator consul://$(/usr/bin/ip -o -4 addr list eth0 | grep global | awk \'{print $4}\' | cut -d/ -f1):8500"
ExecStop=/usr/bin/docker stop registrator
- name: mesos-slave.service
command: start
content: |
[Unit]
Description=Mesos Slave
After=After=docker.service
Requires=docker.service
[Service]
Restart=on-failure
TimeoutStartSec=0
EnvironmentFile=/etc/environment
ExecStartPre=-/usr/bin/docker kill mesos_bootstrap mesos_slave
ExecStartPre=-/usr/bin/docker rm mesos_bootstrap mesos_slave
ExecStartPre=/usr/bin/docker pull jakexks/livewyer-mesos-slave
ExecStart=/usr/bin/sh -c "/usr/bin/docker run --rm --name mesos_bootstrap -e HOST_IP=$(/usr/bin/ip -o -4 addr list eth0 | grep global | awk \'{print $4}\' | cut -d/ -f1) -v /usr/bin/docker:/usr/bin/docker:ro -v /var/run/docker.sock:/docker.sock -v /lib64/libdevmapper.so.1.02:/lib/libdevmapper.so.1.02:ro -v /lib64/libpthread.so.0:/lib/libpthread.so.0:ro -v /lib64/libsqlite3.so.0:/lib/libsqlite3.so.0:ro -v /lib64/libudev.so.1:/lib/libudev.so.1:ro jakexks/livewyer-mesos-slave"
ExecStop=/usr/bin/docker stop mesos_bootstrap mesos_slave
update:
reboot-strategy: etcd-lock