Skip to content

Commit 595be20

Browse files
Merge pull request #414 from autonomys/systemd
add systemd files for production process management
2 parents 06736fd + e673c0c commit 595be20

File tree

2 files changed

+33
-0
lines changed

2 files changed

+33
-0
lines changed

systemd/logrotate

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
/var/log/auto-drive-backend.log {
2+
daily
3+
rotate 7
4+
compress
5+
missingok
6+
notifempty
7+
create 0644 ubuntu ubuntu
8+
su ubuntu ubuntu
9+
postrotate
10+
systemctl restart auto-drive-backend.service > /dev/null 2>/dev/null || true
11+
endscript
12+
}

systemd/systemd

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
[Unit]
2+
Description=Auto Drive Backend Service
3+
After=network.target
4+
5+
[Service]
6+
User=ubuntu
7+
Environment=PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
8+
WorkingDirectory=/home/ubuntu/deploy
9+
ExecStart=/usr/bin/docker compose --env-file /home/ubuntu/deploy/auto-drive/.env -f /home/ubuntu/deploy/auto-drive/docker-compose.prod.yml up -d --remove-orphans
10+
Restart=always
11+
RestartSec=5
12+
SyslogIdentifier=auto-drive-backend
13+
StandardOutput=append:/var/log/auto-drive-backend.log
14+
StandardError=append:/var/log/auto-drive-backend.log
15+
16+
# Resource limits
17+
CPUQuota=90%
18+
MemoryMax=4G
19+
20+
[Install]
21+
WantedBy=multi-user.target

0 commit comments

Comments
 (0)