Skip to content

Deploying a Compose stack over SSH ​

If your application already uses a Compose file for its web service, workers, and dependencies, Catapult's experimental compose recipe can deploy that stack over SSH. Catapult builds the application image, transfers it to the server and starts the stack with Docker Compose or a Podman Compose provider.

Start with one service ​

The Compose Hello World example serves a static page with BusyBox. Its Compose file describes the build and publishes the service on the server's loopback interface.

yaml
services:
  web:
    build:
      context: .
      dockerfile: Containerfile
    ports:
      - '127.0.0.1:8788:8080'

The example selects Podman locally and on the server. Check that podman compose version succeeds as the SSH user on the server. The server also needs curl for the HTTP check. For Docker, use the Compose plugin and give the SSH user access to the Docker engine. See the Compose server requirements.

Deploy and check the response ​

From the example directory, copy the sample configuration and fill in the SSH user and host before running the Catapult commands.

bash
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:8788/'

The response contains Hello World. In this example, Catapult streams the locally built image over SSH and generates a Compose override that pins the application image for the release. The deployment checks HTTP on port 8788 before it finishes.

Keep data across releases ​

The Compose project name stays stable across deployments. Use named volumes or Catapult's shared_dirs for persistent data. Relative bind mounts resolve inside the release directory, which changes with each deployment.

npx cata rollback reapplies the Compose files and image recorded for the restored release. Data in volumes and applied database migrations stay in place.

See the Compose recipe for configuration and service healthchecks. For a Podman service managed directly by systemd, see Deploying Podman Quadlet services over SSH.