Skip to content

Commit 8d853c1

Browse files
committed
Add a systemd service definition for managing the coaching platform containers starting/stopping/restarting
1 parent 57e22a5 commit 8d853c1

File tree

1 file changed

+31
-0
lines changed

1 file changed

+31
-0
lines changed

service/refactor-platform.service

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
[Unit]
2+
Description=Refactor coaching platform service managed with docker compose
3+
Requires=docker.service
4+
After=docker.service network-online.target
5+
Wants=network-online.target
6+
7+
[Service]
8+
Type=oneshot
9+
RemainAfterExit=yes
10+
WorkingDirectory=/home/deploy
11+
ExecStart=/usr/bin/docker compose -f /home/deploy/docker-compose.yaml up -d --remove-orphans
12+
ExecStop=/usr/bin/docker compose -f /home/deploy/docker-compose.yaml down
13+
14+
# Restart configuration
15+
Restart=on-failure
16+
RestartSec=30s
17+
TimeoutStartSec=0
18+
19+
# Run as non-root user
20+
User=deploy
21+
Group=deploy
22+
23+
# Environment variables file for the service to use
24+
EnvironmentFile=-/home/deploy/.env
25+
26+
# Logging
27+
StandardOutput=journal
28+
StandardError=journal
29+
30+
[Install]
31+
WantedBy=multi-user.target

0 commit comments

Comments
 (0)