Files
template-app/profiles/convex/compose.dev.yaml
T

105 lines
3.6 KiB
YAML

# SPDX-License-Identifier: LicenseRef-ConusAI-Template-1.0
# Local development for the convex profile: a self-hosted Convex backend and its dashboard in
# Docker (the images the platform mirrors), the fake platform, and the web shell. The one-shot
# `convex-deploy` service pushes schema/functions before web starts; use `convex dev` separately
# when iterating on the backend function tree.
#
# First run: `docker compose -f compose.yaml -f profiles/convex/compose.dev.yaml up -d backend`
# then set CONVEX_SELF_HOSTED_ADMIN_KEY in .env to the key printed by
# `docker exec <backend> ./generate_admin_key.sh`.
x-development: &development
NODE_ENV: development
CONUSAI_FAKE_PLATFORM: "1"
CONUSAI_API_URL: http://platform:4010/api
CONUSAI_API_TOKEN: dev-token
CONUSAI_PROJECT_ID: "1"
CONUSAI_ORG_ID: dev
CONUSAI_ORG_SLUG: dev
CONVEX_SELF_HOSTED_URL: http://127.0.0.1:${DEV_CONVEX_PORT:-53210}
CONVEX_SELF_HOSTED_ADMIN_KEY: ${CONVEX_SELF_HOSTED_ADMIN_KEY:?set the key printed by generate_admin_key.sh}
services:
backend:
# The self-hosted Convex backend at the digest the platform pins (images/manifest.toml;
# mirrored by the platform's own registry -- no ghcr.io reference, the self-hosted rule D5/D22).
image: build.conusai.com/conusai/convex-backend@sha256:1738f1673f8d63161043a7859710d2301b1e9d6271e06afbb7af31594ea3a58f
environment:
INSTANCE_NAME: conusai-app-dev
INSTANCE_SECRET: acc6c73cc10bacee7b09653b8ce76f8731f153795da9c25490d47c6d3d163912 # dev-only, never a deployment
volumes:
- convex-data:/data
# Published on loopback only, for `pnpm dev` and `convex dev` on this machine. 3210 is the
# API (CONVEX_SELF_HOSTED_URL), 6791 the dashboard's view of it.
ports:
- "127.0.0.1:${DEV_CONVEX_PORT:-53210}:3210"
- "127.0.0.1:${DEV_CONVEX_HTTP_PORT:-56791}:6791"
healthcheck:
test: ["CMD-SHELL", "curl -sf http://127.0.0.1:3210/version"]
interval: 5s
timeout: 5s
retries: 20
restart: unless-stopped
dashboard:
image: build.conusai.com/conusai/convex-dashboard@sha256:b21b95c4abfe543b26d39e0a1e125d65b33bc216f99a0378e9a81642ced2f8c7
environment:
NEXT_PUBLIC_DEPLOYMENT_URL: http://127.0.0.1:${DEV_CONVEX_PORT:-53210}
ports: ["127.0.0.1:${DEV_CONVEX_DASHBOARD_PORT:-56792}:6791"]
depends_on:
backend:
condition: service_healthy
restart: unless-stopped
platform:
build:
context: .
dockerfile: Dockerfile
target: runtime
working_dir: /app
command: ["node", "node_modules/@conusai-kit/testing/dist/fake-platform/cli.js"]
environment:
PORT: "4010"
HOST: 0.0.0.0
PUBLIC_URL: http://platform:4010
expose: ["4010"]
healthcheck:
test: ["CMD", "node", "-e", "fetch('http://127.0.0.1:4010/__e2e/health').then(r=>process.exit(r.ok?0:1),()=>process.exit(1))"]
interval: 5s
timeout: 5s
retries: 20
init: true
restart: unless-stopped
web:
environment:
<<: *development
AUTH_DEV_LOGIN: "1"
AUTH_INSECURE_COOKIES: "1"
ports: ["127.0.0.1:3000:3000"]
depends_on:
backend:
condition: service_healthy
platform:
condition: service_healthy
convex-deploy:
environment: *development
depends_on:
backend:
condition: service_healthy
backup:
environment:
<<: *development
CONVEX_SELF_HOSTED_URL: http://backend:3210
CONVEX_BACKUP_INTERVAL_HOURS: "24"
CONVEX_BACKUP_RETENTION: "30"
depends_on:
backend:
condition: service_healthy
platform:
condition: service_healthy
volumes:
convex-data: