Deploying with Docker and Docker Compose

Updated:
Author: Erkin Khidirov

For containerized environments, Slyber DB provides an official multi-architecture image at ghcr.io/slyber-app/slyber-db:latest supporting both linux/amd64 and linux/arm64. The container runs as an unprivileged slyber_db user (UID 10001) with all Linux capabilities dropped.

1. Quick Start with docker run

Pull the image, generate isolated client and admin secrets (≥ 32 bytes), attach a persistent /data volume, and verify node health:

Bash
docker pull ghcr.io/slyber-app/slyber-db:latest
docker rm -f slyber-db 2>/dev/null || true

CLIENT_SECRET=$(head -c 24 /dev/urandom | od -An -tx1 | tr -d ' \n')
ADMIN_SECRET=$(head -c 24 /dev/urandom | od -An -tx1 | tr -d ' \n')

docker run -d \
  --name slyber-db \
  --restart unless-stopped \
  --stop-timeout 20 \
  -p 127.0.0.1:9110:9110 \
  -p 127.0.0.1:9095:9095 \
  -v slyber_db_data:/data \
  -e SLYBER_DB_MODE="standalone" \
  -e SLYBER_DB_NODE_ID="1" \
  -e SLYBER_DB_CLIENT_SECRET="${CLIENT_SECRET}" \
  -e SLYBER_DB_ADMIN_SECRET="${ADMIN_SECRET}" \
  ghcr.io/slyber-app/slyber-db:latest && \
  sleep 2 && \
  docker exec slyber-db slyber_db --healthcheck=http://127.0.0.1:9110/healthz && \
  docker exec slyber-db slyber_db --healthcheck=https://127.0.0.1:9095/healthz && \
  echo "Client Port  : 127.0.0.1:9110" && \
  echo "Admin HTTPS  : 127.0.0.1:9095" && \
  echo "Client Secret: ${CLIENT_SECRET}" && \
  echo "Admin Secret : ${ADMIN_SECRET}"

Setting --stop-timeout 20 ensures the daemon completes graceful shutdown within the default SLYBER_DB_SHUTDOWN_TIMEOUT=15s and cleanly flushes all shard buffers to disk.

2. Production Setup with Docker Compose

Create a docker-compose.yml file:

Code
services:
  slyber-db:
    image: ghcr.io/slyber-app/slyber-db:latest
    container_name: slyber-db
    restart: unless-stopped
    stop_grace_period: 20s
    security_opt:
      - no-new-privileges:true
    cap_drop:
      - ALL
    ulimits:
      nofile:
        soft: 65535
        hard: 65535
    logging:
      driver: "json-file"
      options:
        max-size: "50m"
        max-file: "3"
    ports:
      - "${SLYBER_DB_BIND_IP:-127.0.0.1}:${SLYBER_DB_PORT:-9110}:9110"
      - "${SLYBER_DB_BIND_IP:-127.0.0.1}:${SLYBER_DB_CLUSTER_PORT:-9111}:9111"
      - "${SLYBER_DB_BIND_IP:-127.0.0.1}:${SLYBER_DB_ADMIN_PORT:-9095}:9095"
    volumes:
      - slyber_db_data:/data
    environment:
      SLYBER_DB_MODE: "${SLYBER_DB_MODE:-standalone}"
      SLYBER_DB_NODE_ID: "${SLYBER_DB_NODE_ID:-1}"
      SLYBER_DB_DATA_DIR: "/data"
      SLYBER_DB_ADDR: "0.0.0.0:9110"
      SLYBER_DB_CLUSTER_ADDR: "0.0.0.0:9111"
      SLYBER_DB_ADMIN_ADDR: "0.0.0.0:9095"
      SLYBER_DB_SYNC_MODE: "${SLYBER_DB_SYNC_MODE:-full}"
      SLYBER_DB_SHARDS: "${SLYBER_DB_SHARDS:-16}"
      SLYBER_DB_GROUPS: "${SLYBER_DB_GROUPS:-64}"
      SLYBER_DB_BLOCK_CACHE_MB: "${SLYBER_DB_BLOCK_CACHE_MB:-256}"
      SLYBER_DB_BALLAST_MB: "${SLYBER_DB_BALLAST_MB:-64}"
      SLYBER_DB_CLIENT_SECRET: "${SLYBER_DB_CLIENT_SECRET:?Set SLYBER_DB_CLIENT_SECRET in .env}"
      SLYBER_DB_ADMIN_SECRET: "${SLYBER_DB_ADMIN_SECRET:?Set SLYBER_DB_ADMIN_SECRET in .env}"
      SLYBER_DB_CLUSTER_SECRET: "${SLYBER_DB_CLUSTER_SECRET:-}"
      SLYBER_DB_SHUTDOWN_TIMEOUT: "15s"
    healthcheck:
      test: ["CMD", "/usr/local/bin/slyber_db", "--healthcheck=http://127.0.0.1:9110/healthz"]
      interval: 10s
      timeout: 3s
      retries: 5
      start_period: 5s

volumes:
  slyber_db_data:

Create a .env file next to docker-compose.yml and launch the stack:

Bash
cat > .env <<EOF
SLYBER_DB_BIND_IP=127.0.0.1
SLYBER_DB_CLIENT_SECRET=$(head -c 24 /dev/urandom | od -An -tx1 | tr -d ' \n')
SLYBER_DB_ADMIN_SECRET=$(head -c 24 /dev/urandom | od -An -tx1 | tr -d ' \n')
EOF
chmod 600 .env
docker compose up -d

3. Ports and Docker Subnet Allowlisting

By default, Slyber DB's built-in IPAllowlist permits loopback, RFC 1918 private networks (10.0.0.0/8, 172.16.0.0/12, 192.168.0.0/16), and CGNAT/Mesh (100.64.0.0/10). Services running on custom Docker bridge networks—including signaling gateways, Slyber SFU Server, and Slyber TURN Server—connect seamlessly without overriding SLYBER_DB_ALLOWLIST, while unauthorized public IP addresses are dropped immediately via TCP RST before TLS 1.3 allocation.

4. Enabling Disk Encryption in Docker

To enable AES-256-GCM encryption at rest inside Docker, mount a read-only key file and configure SLYBER_DB_ENCRYPTION_KEY_FILE:

Bash
openssl rand -hex 32 > ./aes256.key
chmod 400 ./aes256.key

Add the bind mount ./aes256.key:/etc/slyber_db/aes256.key:ro and environment variable SLYBER_DB_ENCRYPTION_KEY_FILE: "/etc/slyber_db/aes256.key" to docker-compose.yml. Encryption mode is locked in /data/IDENTITY upon initial volume creation.