35 lines
1.2 KiB
Desktop File
35 lines
1.2 KiB
Desktop File
[Unit]
|
|
# Description is a human-readable name for the service.
|
|
Description=Greenlight 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 greenlight user, loading the environment variables from
|
|
# /etc/environment and using the working directory /home/greenlight.
|
|
Type=exec
|
|
User=greenlight
|
|
Group=greenlight
|
|
EnvironmentFile=/etc/environment
|
|
WorkingDirectory=/home/greenlight
|
|
ExecStart=/home/greenlight/api -port=4000 -db-dsn=${GREENLIGHT_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
|