This repository has been archived by the owner on Jan 1, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 4
/
cloud-config.yaml
77 lines (68 loc) · 2.52 KB
/
cloud-config.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
#cloud-config
users:
- name: tiddlywiki
uid: 2000
homedir: /home/tiddlywiki
write_files:
- path: /etc/systemd/system/tiddlywiki-periodic-restart.timer
permissions: 0644
owner: root
content: |
[Unit]
Description=Periodic TiddlyWiki restart
[Timer]
OnCalendar=weekly
Persistent=true
[Install]
WantedBy=timers.target
- path: /etc/systemd/system/tiddlywiki-periodic-restart.service
permissions: 0644
owner: root
content: |
[Unit]
Description=Periodic TiddlyWiki restart
[Service]
Type=oneshot
ExecStart=/usr/bin/systemctl try-restart tiddlywiki.service
- path: /etc/systemd/system/tiddlywiki.service
permissions: 0644
owner: root
content: |
[Unit]
Description=TiddlyWiki
[Service]
EnvironmentFile=/home/tiddlywiki/systemd/tiddlywiki.env
WorkingDirectory=/home/tiddlywiki/docker
ExecStartPre=-/usr/bin/docker stop docker-compose
ExecStartPre=-/usr/bin/docker rm docker-compose
ExecStart=/usr/bin/docker run --name=docker-compose \
--rm --env-file env-file \
-v /var/run/docker.sock:/var/run/docker.sock \
-v "/home/tiddlywiki/docker:/rootfs/home/tiddlywiki/docker" \
-w "/rootfs/home/tiddlywiki/docker" \
docker/compose:1.19.0 \
up --build --force-recreate
ExecStop=/usr/bin/docker run --name=docker-compose \
--rm --env-file env-file \
-v /var/run/docker.sock:/var/run/docker.sock \
-v "/home/tiddlywiki/docker:/rootfs/home/tiddlywiki/docker" \
-w "/rootfs/home/tiddlywiki/docker" \
docker/compose:1.19.0 \
down
ExecStopPost=/usr/bin/docker stop docker-compose
RestartSec=15
Restart=always
runcmd:
- mkdir /home/tiddlywiki/systemd
- mkdir /home/tiddlywiki/letsencrypt
- mkdir /home/tiddlywiki/docker
- mkdir /home/tiddlywiki/docker/apache
- mkdir /home/tiddlywiki/docker/automation
- mkdir /home/tiddlywiki/docker/letsencrypt
- mkdir /home/tiddlywiki/docker/tiddlywiki
- chown -R tiddlywiki /home/tiddlywiki
- chgrp -R tiddlywiki /home/tiddlywiki
- systemctl daemon-reload
- systemctl start tiddlywiki.service || true
- systemctl enable tiddlywiki-periodic-restart.service || true
- systemctl start tiddlywiki-periodic-restart.service || true