The commands below use the fictional application name example-app. Replace it before running anything.
- Create a dedicated, non-login application user and
/srv/example-app/releases. - Put runtime secrets in
/etc/example-app/environment, owned by root with mode600. - Install and enable the supplied systemd unit after reviewing its paths and sandbox settings.
- Give the deployment user narrowly scoped permission to restart only this service.
- Add the deployment public key to that user's
authorized_keys. - Record the server host key locally with
ssh-keyscan, verify its fingerprint through a trusted channel, and save the verified line asDEPLOY_KNOWN_HOSTS. - Set repository environment secrets described in the README.
The remote script defaults to /srv/example-app, example-app, and a localhost readiness endpoint. Override APP_ROOT, SERVICE_NAME, and HEALTH_URL in a server-side wrapper if your application differs. Do not store runtime secrets in GitHub artifacts or the release directory.