This commit is contained in:
@@ -0,0 +1,143 @@
|
||||
# SPDX-License-Identifier: LicenseRef-ConusAI-Template-1.0
|
||||
# Local development, and the one place the three Postgres roles of a linked managed database are
|
||||
# created by hand: on ConusAI Cloud the platform provisions them (data-services DS21), and
|
||||
# `dev/postgres-roles.sql` runs the same statements so what works here works there.
|
||||
#
|
||||
# pnpm dev # the whole app on this machine: Postgres in Docker, the fake platform, the
|
||||
# # migrate job, the demo data, the worker and the web shell (scripts/dev.mjs)
|
||||
# docker compose -f compose.yaml -f compose.dev.yaml up --build # all of it as containers
|
||||
#
|
||||
# Nothing here is deployed: the platform reads compose.yaml alone (conusai.json's `compose.file`).
|
||||
#
|
||||
# The platform is the fake one of @conusai-kit/testing, selected on purpose by CONUSAI_FAKE_PLATFORM=1
|
||||
# in a development run: the app refuses that switch in a production run, and refuses to start in one
|
||||
# without the real platform's variables (config/src/env.ts).
|
||||
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
|
||||
# The development Postgres below has pgvector, so the knowledge module stores its vectors there.
|
||||
KNOWLEDGE_VECTOR_STORE: pgvector
|
||||
|
||||
services:
|
||||
postgres:
|
||||
# Postgres 18 with pgvector: development chooses the pgvector store (KNOWLEDGE_VECTOR_STORE above),
|
||||
# and the migrate job creates the table with the extension.
|
||||
image: pgvector/pgvector:pg18
|
||||
environment:
|
||||
POSTGRES_PASSWORD: postgres
|
||||
POSTGRES_DB: appdev
|
||||
volumes:
|
||||
# Postgres 18 keeps its data in a version subdirectory, so the volume belongs one level up:
|
||||
# a mount at /var/lib/postgresql/data makes the image refuse the directory it finds.
|
||||
- postgres-data:/var/lib/postgresql
|
||||
- ./dev/postgres-roles.sql:/docker-entrypoint-initdb.d/10-roles.sql:ro
|
||||
# Published on loopback only, for `pnpm dev`, which runs the processes on this machine.
|
||||
ports: ["127.0.0.1:${DEV_POSTGRES_PORT:-55433}:5432"]
|
||||
healthcheck:
|
||||
test: ["CMD-SHELL", "pg_isready -U postgres -d appdev"]
|
||||
interval: 5s
|
||||
timeout: 5s
|
||||
retries: 20
|
||||
restart: unless-stopped
|
||||
|
||||
# The platform's services as the app uses them -- Blob, OCR, the AI gateway, audit, usage -- in
|
||||
# memory, from the same image: it is a dependency of the template's tests, so it is in the image.
|
||||
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
|
||||
|
||||
migrate:
|
||||
environment: *development
|
||||
depends_on:
|
||||
postgres:
|
||||
condition: service_healthy
|
||||
|
||||
# The demo data (apps/worker/src/seed.ts), once the schema is there. Safe to run again.
|
||||
seed:
|
||||
build:
|
||||
context: .
|
||||
dockerfile: Dockerfile
|
||||
target: runtime
|
||||
working_dir: /app
|
||||
command: ["node", "apps/worker/dist/seed-main.js"]
|
||||
environment:
|
||||
<<: *development
|
||||
CONUSAI_PUBLIC_URL: ${CONUSAI_PUBLIC_URL:-http://127.0.0.1:3000}
|
||||
POSTGRES_URL: ${POSTGRES_URL}
|
||||
POSTGRES_READER_URL: ${POSTGRES_READER_URL}
|
||||
depends_on:
|
||||
migrate:
|
||||
condition: service_completed_successfully
|
||||
platform:
|
||||
condition: service_healthy
|
||||
restart: "no"
|
||||
init: true
|
||||
|
||||
web:
|
||||
environment:
|
||||
<<: *development
|
||||
AUTH_DEV_LOGIN: "1"
|
||||
AUTH_INSECURE_COOKIES: "1"
|
||||
# Published on loopback only, so the app opens at http://127.0.0.1:3000 and nowhere else.
|
||||
ports: ["127.0.0.1:3000:3000"]
|
||||
depends_on:
|
||||
postgres:
|
||||
condition: service_healthy
|
||||
migrate:
|
||||
condition: service_completed_successfully
|
||||
# The demo data is there when the app opens.
|
||||
seed:
|
||||
condition: service_completed_successfully
|
||||
platform:
|
||||
condition: service_healthy
|
||||
|
||||
worker:
|
||||
environment: *development
|
||||
depends_on:
|
||||
postgres:
|
||||
condition: service_healthy
|
||||
migrate:
|
||||
condition: service_completed_successfully
|
||||
platform:
|
||||
condition: service_healthy
|
||||
|
||||
# kit:convex-better-auth:begin
|
||||
# With AUTH_PROVIDER=convex-better-auth: a Better Auth deployment on this machine, from the
|
||||
# platform's pinned self-hosted Convex image. Started only when asked for (better-auth/README.md):
|
||||
# docker compose -f compose.yaml -f compose.dev.yaml --profile better-auth up -d better-auth-backend
|
||||
better-auth-backend:
|
||||
profiles: ["better-auth"]
|
||||
image: build.conusai.com/conusai/convex-backend@sha256:1738f1673f8d63161043a7859710d2301b1e9d6271e06afbb7af31594ea3a58f
|
||||
environment:
|
||||
CONVEX_CLOUD_ORIGIN: http://127.0.0.1:3210
|
||||
CONVEX_SITE_ORIGIN: http://127.0.0.1:3211
|
||||
# Published on loopback only, for `pnpm dev` and `node better-auth/deploy.mjs` on this machine.
|
||||
ports: ["127.0.0.1:3210:3210", "127.0.0.1:3211:3211"]
|
||||
volumes:
|
||||
- better-auth-data:/convex/data
|
||||
restart: unless-stopped
|
||||
# kit:convex-better-auth:end
|
||||
|
||||
volumes:
|
||||
postgres-data:
|
||||
better-auth-data: # kit:convex-better-auth
|
||||
Reference in New Issue
Block a user