Skip to content

Docker Compose

import { Steps, Aside } from ‘@astrojs/starlight/components’;

  1. Clone and configure

    Terminal window
    git clone https://github.com/your-org/vitasync.git
    cd vitasync
    cp .env.example .env

    Edit .env — at minimum set:

    Terminal window
    JWT_SECRET=$(openssl rand -base64 32)
    ENCRYPTION_KEY=$(openssl rand -hex 32)
    OAUTH_REDIRECT_BASE_URL=http://localhost:3001
  2. Start all services

    Terminal window
    docker compose up -d

    Services started:

    ServicePort
    api3001
    worker— (background)
    web3000
    postgres5432
    redis6379
  3. Watch logs

    Terminal window
    docker compose logs -f api worker
  4. Stop

    Terminal window
    docker compose down

The docker-compose.yml defines the following services:

services:
api: # Fastify REST API
worker: # BullMQ background sync worker
web: # Next.js dashboard
postgres: # PostgreSQL 16
redis: # Redis 7

Database migrations run automatically as an api startup step — no manual action needed.

Terminal window
docker compose -f docker-compose.dev.yml up

The dev compose file mounts source directories and runs apps with hot-reload via pnpm dev.

Terminal window
# Rebuild images after dependency changes
docker compose build
# Run database migrations manually
docker compose exec api pnpm db:migrate
# Open Drizzle Studio (DB explorer)
docker compose exec api pnpm db:studio
# Shell into the API container
docker compose exec api sh

Every push to any branch triggers a Docker build. Images are tagged according to their channel:

Branch patternChannelAvailable tags
mainstablelatest, 1.2.3, 1.2, 1, sha-xxxxxxx
beta/**betabeta, beta-xxxxxxx, sha-xxxxxxx
feature/**, fix/**, alpha/**alphaalpha, alpha-xxxxxxx, sha-xxxxxxx

Images are published to ghcr.io/your-org/vitasync-{api,worker,web}.

Terminal window
# Pull a specific pre-release build for testing
docker pull ghcr.io/your-org/vitasync-api:beta
# Pin to an exact alpha sha
docker pull ghcr.io/your-org/vitasync-api:alpha-abc1234

To swap a single service image in your compose file while keeping the rest on latest:

services:
api:
image: ghcr.io/your-org/vitasync-api:beta # override just the API
worker:
image: ghcr.io/your-org/vitasync-worker:latest
web:
image: ghcr.io/your-org/vitasync-web:latest