-
Notifications
You must be signed in to change notification settings - Fork 1
/
trump.service
31 lines (28 loc) · 1.15 KB
/
trump.service
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
# /etc/systemd/system/trump.service
[Unit]
Description=Trump docker-compose service
Requires=docker.service
After=docker.service
[Service]
Restart=always
Group=docker
WorkingDirectory=/opt/trump-docker
# Stop manually started preprocessing container
ExecStartPre=/bin/bash -c 'docker ps | grep "slothofanarchy/trump-preprocessing" | cut -d" " -f 1 | xargs -n 1 docker stop || true'
# Pull from repo to get latest docker-compose.yml
ExecStartPre=sudo -u stud git pull
# Pull trump-preprocessing as it is not contained in docker-compose
ExecStartPre=/usr/bin/docker pull slothofanarchy/trump-preprocessing:latest
# Shutdown container (if running) when unit is stopped
ExecStartPre=/usr/bin/docker-compose down
# Pull latest container from Docker hub
ExecStartPre=/usr/bin/docker-compose pull --include-deps --ignore-pull-failures
# Start container when unit is started
ExecStart=/usr/bin/docker-compose up
# Reload: Pull images and restart changed ones
ExecReload=/bin/bash -c '/usr/bin/docker-compose pull -q && docker-compose up -d --no-deps'
# Stop container when unit is stopped
ExecStop=/usr/bin/docker-compose down
RestartSec=10
[Install]
WantedBy=multi-user.target