systemd service
To run your Garvan binary on boot, drop a systemd unit file in /etc/systemd/system/ and enable it.
Unit file
[Unit]
Description=My Garvan app
After=network.target
[Service]
Type=simple
User=www-data
WorkingDirectory=/srv/my-app
ExecStart=/srv/my-app/bin/app.bin
Restart=on-failure
RestartSec=5
EnvironmentFile=/srv/my-app/.env
[Install]
WantedBy=multi-user.target
Enabling the service
sudo systemctl daemon-reload
sudo systemctl enable --now my-app.service
sudo journalctl -u my-app.service -f
The last command tails the logs — useful while you're setting things up.