# SPDX-License-Identifier: LicenseRef-ConusAI-Template-1.0 # Local development for the mongodb profile: MongoDB and Valkey in Docker, the fake platform, the # migrate job, the demo data, the worker and the web shell. Nothing here is deployed: the platform # reads compose.yaml alone (conusai.json's `compose.file`). # # The dev MongoDB runs as a single-node replica set (AT-D15): `--replSet` plus the one-shot # `mongo-init` container's rs.initiate(), because a standalone mongod has no multi-document # transactions and the adapter refuses to boot against one. The advertised member host is the # compose service name, so app containers reach it as `mongo:27017` with `directConnection=true`; # `pnpm dev` on this machine uses the loopback publication with `directConnection=true` as well. 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 services: mongo: image: mongo:8.0 command: ["mongod", "--replSet", "rs0", "--bind_ip_all"] volumes: - mongo-data:/data/db # Published on loopback only, for `pnpm dev`, which runs the processes on this machine. ports: ["127.0.0.1:${DEV_MONGO_PORT:-57017}:27017"] healthcheck: test: ["CMD", "mongosh", "--quiet", "--eval", "db.adminCommand({ ping: 1 })"] interval: 5s timeout: 5s retries: 20 restart: unless-stopped mongo-init: image: mongo:8.0 command: - mongosh - --host - mongo:27017 - --quiet - --eval - | try { rs.initiate({ _id: "rs0", members: [{ _id: 0, host: "mongo:27017" }] }) } catch (e) { if (!/already initialized/.test(String(e))) throw e } depends_on: mongo: condition: service_healthy restart: "no" init: true valkey: image: valkey/valkey:9-alpine volumes: - valkey-data:/data ports: ["127.0.0.1:${DEV_VALKEY_PORT:-56380}:6379"] healthcheck: test: ["CMD-SHELL", "valkey-cli ping | grep -q PONG"] interval: 5s timeout: 5s retries: 20 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 migrate: environment: *development depends_on: mongo-init: condition: service_completed_successfully 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} MONGODB_URL: ${MONGODB_URL} REDIS_URL: ${REDIS_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" ports: ["127.0.0.1:3000:3000"] depends_on: mongo-init: condition: service_completed_successfully valkey: condition: service_healthy migrate: condition: service_completed_successfully seed: condition: service_completed_successfully platform: condition: service_healthy worker: environment: *development depends_on: mongo-init: condition: service_completed_successfully valkey: condition: service_healthy migrate: condition: service_completed_successfully platform: condition: service_healthy volumes: mongo-data: valkey-data: