Skip to content

Server Deployment

This guide covers deploying Loryth on a Linux host with Docker Compose, isolated PostgreSQL databases, TLS ingress, and optional chat sandboxes.

Compose Layering

Always pass Compose files explicitly on a server so the local development override (docker-compose.override.yml) is never applied:

docker compose \
  -f docker-compose.yml \
  -f docker-compose.server.yml \
  -f docker-compose.ingress.yml \
  --profile website --profile docs \
  up -d --build
  • docker-compose.yml: Base infrastructure, 16 services, migrations job, web UI, and Nginx gateway.
  • docker-compose.server.yml: Binds the gateway to loopback (127.0.0.1:8088 by default) and removes development port exposures.
  • docker-compose.ingress.yml: Connects the gateway to an external TLS reverse proxy network (lab-ingress) serving LORYTH_DOMAIN, app.<LORYTH_DOMAIN>, and docs.<LORYTH_DOMAIN>.

Environment Configuration

Copy .env.server.example to .env, set distinct secrets, and restrict file permissions:

  • LORYTH_DOMAIN: Base domain (maps root to website, app. to workspace/API, docs. to documentation).
  • LORYTH_SETTINGS_KEY: Encryption key required before saving AI provider keys in Settings.
  • LORYTH_ANDROID_DOWNLOADS_PATH: Persistent host directory mounted read-only into the website container for /downloads/ APK, RPM, checksum, and update feed JSON files.

Migrations & Upgrades

Each service has its own PostgreSQL database, role, and revision_log. Before upgrading:

  1. Back up PostgreSQL (pg_dumpall | gzip > postgres.sql.gz) and verify the archive with gzip -t.
  2. Build updated images (and docker compose --profile sandbox build sandbox-image if using on-demand chat sandboxes).
  3. Stop the gateway to pause writes, run docker compose ... run --rm migrations, then bring the stack back up with up -d.

Security & Privacy Defaults

  • IAM Bearer Validation: All backend APIs validate bearer tokens against loryth-iam; new signups start pending until approved by an admin.
  • Private Journals: Journal entries, recordings, and reflections are restricted strictly to their creator with no admin bypass.
  • Optional gVisor Sandboxes: Install runsc on the Docker host and set RUNTIME_SANDBOX_RUNTIME=runsc to isolate per-user chat sandboxes.

For operational deployment scripts and pilot diagnostics, see docker/server-deployment.md in the repository and Admin Access.