My systemd service file is in the name of os.service
and has the following line of configuration.
# This systemd service file will help supervise os service
[Unit]
Description=Os Server
After= network.target
[Service]
# Preferably configure a non-privileged user
# User=deploy
# Group=deploy
# Environment variables shared across the config
#EnvironmentFile= # environment file to be used, includes RACK_ENV
EnvironmentFile=/home/deploy/test/shared/.env
SyslogIdentifier=test
PIDFile=/home/deploy/test/shared/tmp/server.pid
# Specify the path to your test application root
# WorkingDirectory=/home/deploy/test/
# Start/Reload/Stop syntax
ExecStart=/home/deploy/test/current
# TimeoutSec=15
# TimeoutStopSec=10
RestartSec=5s
# Restart os, always if it dies for some reason
Restart=always
[Install]
WantedBy=multi-user.target
In server when I disconnect my ssh connection then service dies and results in 502 Bad Gateway. I have to ssh and run systemctl --user start os.service
to start and make it work. Again once i close my terminal then os.service dies again.