-
Notifications
You must be signed in to change notification settings - Fork 1
/
api.service
34 lines (29 loc) · 1.19 KB
/
api.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
32
33
34
[Unit]
# Description is a human-readable name for the service.
Description=Skel API service
# Wait until PostgreSQL is running and the network is "up" before starting the service.
After=postgresql.service
After=network-online.target
Wants=network-online.target
# Configure service start rate limiting. If the service is (re)started more than 5 times
# in 600 seconds then don't permit it to start anymore.
StartLimitIntervalSec=600
StartLimitBurst=5
[Service]
# Execute the API binary as the skel user, loading the environment variables from
# /etc/environment and using the working directory /home/skel.
Type=exec
User=skel
Group=skel
EnvironmentFile=/etc/environment
WorkingDirectory=/home/skel
ExecStart=/home/skel/api -port=4000 -db-dsn=${SKEL_DB_DSN} -env=production
# Automatically restart the service after a 5-second wait if it exits with a non-zero
# exit code. If it restarts more than 5 times in 600 seconds, then the rate limit we
# configured above will be hit and it won't be restarted anymore.
Restart=on-failure
RestartSec=5
[Install]
# Start the service automatically at boot time (the "multi-user.target" describes a boot
# state when the system will accept logins).
WantedBy=multi-user.target