Skip to content

Docker Compose deployment ​

Create the Compose configuration ​

Create a deployment directory and run all subsequent commands there:

sh
mkdir -p ~/sayrud
cd ~/sayrud
sudo install -d -o 10001 -g 10001 -m 0750 ./config ./data
umask 077
printf 'SAYRUD_IMAGE=ghcr.io/sayrud/sayrud:latest\nPOSTGRES_PASSWORD=%s\nREDIS_PASSWORD=%s\n' \
  "$(openssl rand -hex 24)" "$(openssl rand -hex 24)" > .env

POSTGRES_PASSWORD and REDIS_PASSWORD in .env are the PostgreSQL and Redis passwords. You will also need them in the installation wizard.

Save the following as compose.yaml:

yaml
services:
  sayrud:
    image: ${SAYRUD_IMAGE:?Set SAYRUD_IMAGE in .env}
    restart: unless-stopped
    ports:
      - "2830:2830"
    stop_grace_period: 45s
    volumes:
      - ./config:/home/app/config
      - ./data:/home/app/data
    depends_on:
      postgres:
        condition: service_healthy
      redis:
        condition: service_healthy

  postgres:
    image: postgres:17-alpine
    restart: unless-stopped
    environment:
      POSTGRES_DB: sayrud
      POSTGRES_USER: sayrud
      POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:?Set POSTGRES_PASSWORD in .env}
    volumes:
      - postgres_data:/var/lib/postgresql/data
    healthcheck:
      test: ["CMD-SHELL", "pg_isready -h 127.0.0.1 -U sayrud -d sayrud"]
      interval: 2s
      timeout: 3s
      retries: 30

  redis:
    image: redis:7-alpine
    restart: unless-stopped
    environment:
      REDISCLI_AUTH: ${REDIS_PASSWORD:?Set REDIS_PASSWORD in .env}
    command: ["redis-server", "--appendonly", "yes", "--requirepass", "${REDIS_PASSWORD}"]
    volumes:
      - redis_data:/data
    healthcheck:
      test: ["CMD-SHELL", "redis-cli ping | grep -qx PONG"]
      interval: 2s
      timeout: 3s
      retries: 30

volumes:
  postgres_data:
  redis_data:

Start and install ​

sh
docker compose config --quiet
docker compose up -d
docker compose ps
docker compose logs --tail=100 sayrud

Open http://server-address:2830/setup, copy the token after Setup token: in the logs, and follow the web installation guide. Enter these database settings:

FieldValue
PostgreSQL host and portpostgres, 5432
Database name and usernamesayrud, sayrud
PostgreSQL passwordPOSTGRES_PASSWORD from .env
PostgreSQL SSL modeNo encryption
Redis addressredis:6379
Redis usernamedefault
Redis passwordREDIS_PASSWORD from .env

Inside the application container, 127.0.0.1 refers to the application itself, not the other containers. For existing databases, enter addresses reachable from the container.

Configuration is stored in ./config/sayrud.yaml, and uploaded files in ./data/storage.

Upgrade and back up ​

Stop the application and back up the database and local files:

sh
umask 077
docker compose stop sayrud
docker compose exec -T postgres pg_dump -U sayrud -d sayrud -Fc > sayrud.dump
sudo tar -czf - .env config data > sayrud-files.tar.gz

Update SAYRUD_IMAGE in .env, then upgrade:

sh
docker compose pull sayrud
docker compose up -d sayrud
docker compose logs --tail=100 sayrud
curl -fsS http://127.0.0.1:2830/-/readyz

Do not run docker compose down -v; it deletes the database volumes.