-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcloud-init
180 lines (160 loc) · 4.16 KB
/
cloud-init
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
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
#cloud-config
# IO scripts that pulls other scripts from Github
write_files:
- path: /var/lib/io/updateScripts
permissions: 0755
owner: core:core
content: |
#!/usr/bin/sh -
mkdir -p /opt/data
if [ ! -d /opt/data/.git ]; then
git clone https://github.com/nuxeo/nuxeo.io.git /opt/data
else
cd /opt/data && git pull --all
fi
cd /opt/data
git checkout master
- path: /etc/systemd/system/docker.service.d/increase-ulimit.conf
owner: core:core
permissions: 0644
content: |
[Service]
LimitMEMLOCK=infinity
- path: /etc/systemd/system/etcd.service.d/90-manual.conf
owner: core:core
permissions: 0644
content: |
[Service]
LimitMEMLOCK=infinity
LimitCORE=infinity
users:
- name: dmetzler
coreos-ssh-import-github: dmetzler
groups:
- sudo
- docker
- name: troger
coreos-ssh-import-github: troger
groups:
- sudo
- docker
- name: vpasquier
coreos-ssh-import-github: vpasquier
groups:
- sudo
- docker
- name: akervern
coreos-ssh-import-github: akervern
groups:
- sudo
- docker
coreos:
update:
reboot-strategy: off
etcd:
discovery: ##ETCD_TOKEN##
addr: $private_ipv4:4001
peer-addr: $private_ipv4:7001
units:
- name: format-xvdb.service
command: start
content: |
[Unit]
Description=Formats xvdb
[Service]
Type=oneshot
RemainAfterExit=yes
ExecStart=/usr/sbin/wipefs -f /dev/xvdb
ExecStart=/usr/sbin/mkfs.btrfs -f /dev/xvdb
- name: format-xvdc.service
command: start
content: |
[Unit]
Description=Formats xvdc
[Service]
Type=oneshot
RemainAfterExit=yes
ExecStart=/usr/sbin/wipefs -f /dev/xvdc
ExecStart=/usr/sbin/mkfs.btrfs -f /dev/xvdc
- name: var-lib-docker.mount
command: start
content: |
[Unit]
Description=Mount ephemeral to /var/lib/docker
Requires=format-xvdb.service
After=format-xvdb.service
Before=docker.service
[Mount]
What=/dev/xvdb
Where=/var/lib/docker
Type=btrfs
- name: data.mount
command: start
content: |
[Unit]
Description=Mount ephemeral to /data
Requires=format-xvdc.service
After=format-xvdc.service
Before=docker.service
[Mount]
What=/dev/xvdc
Where=/data
Type=btrfs
- name: etcd.service
command: start
- name: fleet.service
command: start
runtime: no
content: |
[Unit]
Description=fleet
Requires=etcd.service
After=etcd.service
[Service]
Environment=FLEET_PUBLIC_IP=$private_ipv4
ExecStart=/usr/bin/fleet
Restart=always
RestartSec=5s
# Execution of the Github pull script (only run once)
- name: github-script.service
command: start
content: |
[Unit]
Description=Get Nuxeo.io runtime scripts
[Service]
Type=oneshot
ExecStart=/var/lib/io/updateScripts
RemainAfterExit=yes
# init-cluster
- name: cluster-init.service
command: stop
content: |
[Unit]
Description=Init Arken.io cluster
ConditionFileNotEmpty=/opt/data/systemd/cluster-init/start.sh
[Service]
Type=oneshot
ExecStart=/opt/data/systemd/cluster-init/start.sh
# Dynamic reverse proxy
- name: gogeta.service
command: stop
content: |
[Unit]
Description=Gogeta Core service
ConditionFileNotEmpty=/opt/data/systemd/gogeta/start.sh
[Service]
Environment='GOGETA_NAME=gogeta'
ExecStart=/opt/data/systemd/gogeta/start.sh
ExecStop=/opt/data/systemd/gogeta/stop.sh
Restart=always
RestartSec=10s
# init-node
- name: node-init.service
command: start
content: |
[Unit]
Description=Init Arken.io node
After=github-script.service fleet.service etcd.service docker.service
[Service]
Type=oneshot
ExecStart=/opt/data/systemd/node-init/start.sh