chain-rdeveloper portal
build

Deployment Guide

Overview

Chainr local deployment is orchestrated with Docker Compose from modules/docker-compose.yml.

Current deployment model:

  • Nginx is the only public entrypoint (8000:80)

  • Frontend apps (fe-core, fe-public) run behind Nginx

  • Core backend services communicate on internal service networks

  • Databases are isolated per service domain where available

The dev host on AWS adds the production overlay instead: nothing is published, and Cloudflare reaches nginx only through an outbound-only Cloudflare Tunnel. See Cloudflare Tunnel for how it fits, setting one up for a new environment, and operating it.

Current Compose Topology

Public Entry

  • nginx → exposed on host :8000

Core Services

  • svc-auth (FastAPI, internal)

  • svc-bff (FastAPI, internal)

  • svc-core (FastAPI, exposed on :8080 for dev)

  • svc-ai (FastAPI, exposed on :5000 for dev)

Frontend Services

  • fe-core (Vite dev target, internal)

  • fe-public (Vite dev target, internal)

Data Services

  • redis (shared cache/session store for BFF/auth path)

  • postgres-core (dedicated database for svc-core, host :5432)

  • postgres-ai (dedicated database for svc-ai, host :5433)

Database Design Status

The target design is one dedicated Postgres database per core service.

Current status:

  • svc-core → dedicated Postgres is in place (postgres-core)

  • svc-ai → dedicated Postgres is in place (postgres-ai)

  • svc-auth → dedicated Postgres is planned, not yet added in Compose

  • svc-bff → dedicated Postgres is planned, not yet added in Compose

Networks

Compose network segmentation currently uses:

  • frontend-network for Nginx ↔ frontend apps

  • bff-network for Nginx/BFF/auth/Redis interactions

  • backend-network for service-to-service API calls

  • db-network for svc-core ↔ postgres-core

  • ai-network for svc-ai and AI data dependencies

  • postgres-core-external, postgres-ai-external for dev tooling access

  • ai-egress-network for everything svc-ai sends out: model calls, web search, page fetches, tools

Service Startup Notes

  • nginx waits for svc-auth, svc-bff, and frontend services

  • svc-core waits for postgres-core health

  • svc-ai waits for postgres-ai health

  • Redis is consumed by svc-auth and svc-bff

Migration Notes

Each service that owns a database should manage migrations independently (Alembic in service repo).

Current migration-enabled services:

  • svc-core (Postgres + Alembic)

  • svc-ai (Postgres + Alembic)

Planned next step:

  • Add dedicated Postgres + migration flow for svc-auth and svc-bff