This repository was archived by the owner on Sep 21, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathuser-data.sample
More file actions
91 lines (85 loc) · 3.11 KB
/
user-data.sample
File metadata and controls
91 lines (85 loc) · 3.11 KB
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
84
85
86
87
88
89
90
91
#cloud-config
coreos:
etcd:
# generate a new token for each unique cluster from https://discovery.etcd.io/new
# WARNING: replace each time you 'vagrant destroy'
#discovery: https://discovery.etcd.io/<token>
addr: $public_ipv4:4001
peer-addr: $public_ipv4:7001
units:
- name: etcd.service
command: start
- name: fleet.service
command: start
runtime: no
content: |
[Unit]
Description=fleet
[Service]
Environment=FLEET_PUBLIC_IP=$public_ipv4
ExecStart=/usr/bin/fleet
- name: docker-tcp.socket
command: start
enable: true
content: |
[Unit]
Description=Docker Socket for the API
[Socket]
ListenStream=2375
Service=docker.service
BindIPv6Only=both
[Install]
WantedBy=sockets.target
- name: skydns.service
command: start
content: |
[Unit]
Description=SkyDNS Service
After=docker.service
Requires=docker.service
[Service]
TimeoutStartSec=0
ExecStartPre=/usr/bin/docker pull planitar/skydns
ExecStartPre=-/usr/bin/docker rm -f skydns
ExecStart=/bin/bash -c ' \
DOCKER_IP=`ifconfig docker0 | sed -n "s/^ *inet \([0-9.]*\) .*$/\1/p"`; \
/usr/bin/docker run --name skydns -p $DOCKER_IP:53:53/udp \
planitar/skydns -addr 0.0.0.0:53 -nameservers 8.8.8.8:53,8.8.4.4:53 \
-machines "http://$DOCKER_IP:4001" -domain dev.plntr. -verbose; \
'
ExecStartPost=/bin/bash -c ' \
PUBLIC_IP=`ifconfig eth0 | sed -n "s/^ *inet \([0-9.]*\) .*$/\1/p"`; \
DOCKER_IP=`ifconfig docker0 | sed -n "s/^ *inet \([0-9.]*\) .*$/\1/p"`; \
etcdctl set /skydns/plntr/dev/dns/ns "{\\"host\\":\\"8.8.8.8\\"}"; \
etcdctl set /skydns/plntr/dev/dns/ns2 "{\\"host\\":\\"8.8.4.4\\"}"; \
etcdctl set /skydns/plntr/dev/host/%H "{\\"host\\":\\"$PUBLIC_IP\\"}"; \
{ \
echo "search dev.plntr"; \
echo "nameserver $DOCKER_IP"; \
} >/tmp/skydns.resolv.conf; \
sudo mv -b -S "~orig" /tmp/skydns.resolv.conf /etc/resolv.conf; \
'
ExecStop=/usr/bin/docker rm -f skydns
ExecStopPost=/bin/bash -c 'sudo mv /etc/resolv.conf~orig /etc/resolv.conf'
Restart=always
- name: monitord.service
command: start
content: |
[Unit]
Description=Monitoring Service
Requires=docker.service
Requires=skydns.service
After=skydns.service
[Service]
TimeoutStartSec=0
ExecStartPre=/usr/bin/docker pull planitar/monitord
ExecStartPre=-/usr/bin/docker rm -f monitord
ExecStart=/bin/bash -c ' \
/usr/bin/docker run --net host --name monitord planitar/monitord; \
'
ExecStartPost=/bin/bash -c ' \
DOCKER_IP=`ifconfig docker0 | sed -n "s/^ *inet \([0-9.]*\) .*$/\1/p"`; \
etcdctl set /skydns/plntr/dev/monitord/%H "{ \\"host\\": \\"$DOCKER_IP\\" }"; \
'
ExecStop=/usr/bin/docker rm -f monitord
Restart=always