Skip to content

Configure persistent storage

A durable deployment needs to configure two services :

  • a database (PostgreSQL or SQLite) for state machines, executions and history;
  • a Valkey/Redis instance for the async job queue, activity tasks and pending tasks.

Docker Compose

Compose is a convenient way to orchestrate the three services together. The Stegflow settings shown below (STEGFLOW_*) are the important part: you can apply them just as well with docker run -e or a mounted config file. See the configuration reference for how configuration is applied.

Pick your database backend:

services:
  stegflow:
    image: stegflow/stegflow:beta
    ports:
      - "8080:8080"
    environment:
      STEGFLOW_ENGINE__DATABASE__PROVIDER: PostgreSql
      STEGFLOW_ENGINE__DATABASE__CONNECTIONSTRING: "Host=db;Database=stegflow;Username=stegflow;Password=secret"
      STEGFLOW_ENGINE__VALKEY__CONNECTIONSTRING: "valkey:6379"
    depends_on:
      - db
      - valkey

  db:
    image: postgres:18
    environment:
      POSTGRES_DB: stegflow
      POSTGRES_USER: stegflow
      POSTGRES_PASSWORD: secret
    volumes:
      - db-data:/var/lib/postgresql

  valkey:
    image: valkey/valkey:8
    command: ["valkey-server", "--appendonly", "yes"]
    volumes:
      - valkey-data:/data

volumes:
  db-data:
  valkey-data:
services:
  stegflow:
    image: stegflow/stegflow:beta
    ports:
      - "8080:8080"
    environment:
      STEGFLOW_ENGINE__DATABASE__PROVIDER: Sqlite
      STEGFLOW_ENGINE__DATABASE__CONNECTIONSTRING: "Data Source=/data/stegflow.db"
      STEGFLOW_ENGINE__VALKEY__CONNECTIONSTRING: "valkey:6379"
    volumes:
      - stegflow-data:/data
    depends_on:
      - valkey

  valkey:
    image: valkey/valkey:8
    command: ["valkey-server", "--appendonly", "yes"]
    volumes:
      - valkey-data:/data

volumes:
  stegflow-data:
  valkey-data:

The container runs as a non-root user, so the /data volume must be writable by it.

Start everything:

docker compose up -d

The console is available on http://localhost:8080, and the data is kept in named volumes across restarts.