systemd

SystemD devops run and restart services

Getting an app to redeploy as fixes and upgrades are uploaded to a linux server For most webapps I oversee it is desirable to have a mechanism in place not only for having them start when the server reboots, but also to restart the app when I need to deploy an update or (most recently) a fix to the application.1 This process requires sudo access2 and five files for a full redeployment system3:

Clojure app setup for Auto-deploy with raw systemd

REPLACED [2022-11-11 Fri] The below is hopefully informative, but it actually only causes a thing to deploy once and then to re-deploy on system restart. For instructions that ACTUALLY auto-deploy, see https://tech.toryanderson.com/2022/11/11/systemd-devops-run-and-restart-services/ Updated [2022-09-19 Mon] Fixed error in deploy script that occurred if trying to restart but nothing was in the docket Updated [2022-07-13 Wed] Enhanced the server-side deploy script to operate more transparently if files are missing.

Should I put my systemd [Install] section in my .path file or my .service file?

Configuring systemd to redeploy my service when I commit a new source .jar file, I have a path file that goes along with the service and uses a PathChanged directive. The [Install] section should be in the path file, not the service file, but I notice this makes “systemctl enable MYAPP” impossible. It turns out that enable MYAPP assumes you mean MYAPP.service, so you actually just do systemctl enable MYAPP.path and you’re set.