Deploying Podman Quadlet services over SSH
Quadlet lets you describe a Podman container in a .container file that systemd turns into a service. Catapult's experimental quadlet recipe builds and transfers the application image, renders the Quadlet files for the new release and installs them on the server. Systemd manages the service after deployment.
Start with one unit
The Quadlet Hello World example serves a static page with BusyBox. It publishes the container on the server's loopback interface.
[Unit]
Description=Catapult Hello World
[Container]
Image={{image}}
PublishPort=127.0.0.1:8789:8080
[Install]
WantedBy=default.targetCatapult replaces with the image reference for the release. WantedBy=default.target lets the user systemd manager start the service when it starts.
Deploy as a rootless service
The example uses Podman locally. The server needs Podman with Quadlet, systemd, cgroups v2 and curl for the HTTP check. For a rootless deployment, enable lingering for the SSH user with sudo loginctl enable-linger <user> so its systemd manager stays available after logout and starts at boot. See the Quadlet server requirements.
From the example directory, copy the sample configuration and fill in the SSH user and host.
cp deploy.config.example.json deploy.config.json
# Set SSH_USER and SSH_IP in deploy.config.json.
npx cata config:validate
npx cata deploy:setup
npx cata deploy
npx cata run 'curl -fsS http://127.0.0.1:8789/'The response contains Hello World. Catapult waits for the unit to become active and for its container to be running. The example then checks HTTP on port 8789.
Restart and rollback
On deployment, Catapult updates the unit for the new release and restarts the service. A service bound to a fixed port can be briefly unavailable during that restart.
npx cata rollback reinstalls the rendered units from the restored release and restarts the changed services with their previous image. Applied migrations and persistent data stay in place.
See the Quadlet recipe for multiple units, dependencies and migration jobs. If your stack is already defined in a Compose file, see Deploying a Compose stack over SSH.