Write a minimal production-quality systemd service unit.
IntermediateConceptProcesses, Signals & systemd
Answer
# /etc/systemd/system/api.service
[Unit]
Description=Orders API
After=network-online.target
Wants=network-online.target
[Service]
User=api
Group=api
WorkingDirectory=/opt/api
EnvironmentFile=/etc/api/api.env
ExecStart=/opt/api/bin/api --port 8080
Restart=on-failure
RestartSec=5
LimitNOFILE=65536
[Install]
WantedBy=multi-user.target
sudo systemctl daemon-reload && sudo systemctl enable --now api
More on Processes, Signals & systemd
What is the difference between a program, a process and a thread?BeginnerHow are new processes created in Linux?IntermediateWhat is a zombie process, and how do you get rid of it?IntermediateWhat is an orphan process?BeginnerExplain the process states shown in ps (R, S, D, T, Z).IntermediateWhy can't you kill a process in D state?Advanced