Files
openwork/packaging/docker/docker-compose.den-dev.yml
2026-03-13 09:41:34 -07:00

136 lines
4.5 KiB
YAML

# docker-compose.den-dev.yml — Den local testability stack
#
# Usage (from repo root):
# docker compose -f packaging/docker/docker-compose.den-dev.yml up
#
# Then open the printed web UI or Den demo URL.
#
# Env overrides (optional, via export or .env):
# DEN_API_PORT — host port to map to Den control plane :8788
# DEN_WEB_PORT — host port to map to the cloud web app :3005
# DEN_BETTER_AUTH_SECRET — Better Auth secret (auto-generated by den-dev-up.sh)
# DEN_BETTER_AUTH_URL — browser-facing auth origin (default: http://localhost:<DEN_WEB_PORT>)
# DEN_CORS_ORIGINS — comma-separated trusted origins for Better Auth + CORS
# DEN_PROVISIONER_MODE — stub or render (default: stub)
# DEN_WORKER_URL_TEMPLATE — worker URL template used by stub provisioning
x-shared: &shared
image: node:22-bookworm-slim
working_dir: /app
volumes:
- ../../:/app
- pnpm-store:/root/.local/share/pnpm/store
services:
mysql:
image: mysql:8.4
environment:
MYSQL_ROOT_PASSWORD: password
MYSQL_DATABASE: openwork_den
healthcheck:
test: ["CMD-SHELL", "mysqladmin ping -h 127.0.0.1 -ppassword --silent"]
interval: 5s
timeout: 5s
retries: 30
start_period: 10s
volumes:
- den-mysql-data:/var/lib/mysql
den:
<<: *shared
depends_on:
mysql:
condition: service_healthy
entrypoint: ["/bin/sh", "-c"]
command:
- |
set -e
apt-get update -qq && apt-get install -y -qq --no-install-recommends \
curl ca-certificates >/dev/null 2>&1
corepack enable && corepack prepare pnpm@10.27.0 --activate
echo "[den] Installing dependencies..."
pnpm install --no-frozen-lockfile --network-concurrency 1 --child-concurrency 1
echo "[den] Running migrations..."
pnpm --filter @openwork/den db:migrate
echo ""
echo "============================================"
echo " Den control plane"
echo " Demo/API: http://localhost:${DEN_API_PORT:-8788}"
echo " Health: http://localhost:${DEN_API_PORT:-8788}/health"
echo " Auth URL: ${DEN_BETTER_AUTH_URL:-http://localhost:3005}"
echo "============================================"
echo ""
exec pnpm --filter @openwork/den dev
ports:
- "${DEN_API_PORT:-8788}:8788"
healthcheck:
test: ["CMD-SHELL", "curl -sf http://localhost:8788/health || exit 1"]
interval: 5s
timeout: 5s
retries: 30
start_period: 120s
environment:
CI: "true"
OPENWORK_DEV_MODE: "1"
DATABASE_URL: mysql://root:password@mysql:3306/openwork_den
BETTER_AUTH_SECRET: ${DEN_BETTER_AUTH_SECRET:-dev-den-local-auth-secret-please-override-1234567890}
BETTER_AUTH_URL: ${DEN_BETTER_AUTH_URL:-http://localhost:3005}
PORT: "8788"
CORS_ORIGINS: ${DEN_CORS_ORIGINS:-http://localhost:3005,http://127.0.0.1:3005,http://localhost:8788,http://127.0.0.1:8788}
PROVISIONER_MODE: ${DEN_PROVISIONER_MODE:-stub}
WORKER_URL_TEMPLATE: ${DEN_WORKER_URL_TEMPLATE:-}
POLAR_FEATURE_GATE_ENABLED: "false"
web:
<<: *shared
depends_on:
den:
condition: service_healthy
entrypoint: ["/bin/sh", "-c"]
command:
- |
set -e
apt-get update -qq && apt-get install -y -qq --no-install-recommends \
curl ca-certificates >/dev/null 2>&1
corepack enable && corepack prepare pnpm@10.27.0 --activate
echo "[den-web] Installing dependencies..."
pnpm install --no-frozen-lockfile --network-concurrency 1 --child-concurrency 1
echo ""
echo "============================================"
echo " OpenWork Cloud web app"
echo " URL: http://localhost:${DEN_WEB_PORT:-3005}"
echo " Den API: http://localhost:${DEN_API_PORT:-8788}"
echo "============================================"
echo ""
exec pnpm --filter @different-ai/openwork-web dev
ports:
- "${DEN_WEB_PORT:-3005}:3005"
healthcheck:
test: ["CMD-SHELL", "curl -sf http://localhost:3005/api/den/health || exit 1"]
interval: 5s
timeout: 10s
retries: 30
start_period: 180s
environment:
CI: "true"
OPENWORK_DEV_MODE: "1"
DEN_API_BASE: http://den:8788
DEN_AUTH_FALLBACK_BASE: http://den:8788
DEN_AUTH_ORIGIN: ${DEN_BETTER_AUTH_URL:-http://localhost:3005}
NEXT_PUBLIC_OPENWORK_AUTH_CALLBACK_URL: ${DEN_BETTER_AUTH_URL:-http://localhost:3005}
volumes:
den-mysql-data:
pnpm-store: