mirror of
https://github.com/Tria-plc/edr-platform.git
synced 2026-08-27 07:22:53 +00:00
Muluhabt ERP modules
This commit is contained in:
@@ -5,22 +5,38 @@ networks:
|
||||
driver: bridge
|
||||
|
||||
volumes:
|
||||
postgres-freight-data:
|
||||
postgres-data:
|
||||
redis-data:
|
||||
|
||||
services:
|
||||
postgres-freight:
|
||||
# ONE database for the whole platform. Freight, passenger, IAM and payment are
|
||||
# schemas inside it, not separate databases — this mirrors production, where the
|
||||
# Smart Office database holds the `freight` schema alongside the rest.
|
||||
#
|
||||
# Migrated from the previous `postgres-freight` service (port 5433, db
|
||||
# `edr_freight`) plus a second server on 5544 for passenger. The volume is
|
||||
# renamed, so the first `up` runs initdb against an empty data directory and
|
||||
# applies initdb/01-schemas.sql. Existing 5433 data is NOT carried over
|
||||
# automatically — see the consolidation runbook in DEPLOYMENT.md.
|
||||
postgres:
|
||||
image: postgres:17-alpine
|
||||
container_name: edr-postgres-freight
|
||||
container_name: edr-postgres
|
||||
restart: unless-stopped
|
||||
environment:
|
||||
POSTGRES_USER: postgres
|
||||
POSTGRES_PASSWORD: postgres
|
||||
POSTGRES_DB: edr_freight
|
||||
POSTGRES_USER: edr
|
||||
POSTGRES_PASSWORD: edr_secret
|
||||
POSTGRES_DB: edr_database
|
||||
ports:
|
||||
- "5433:5432"
|
||||
- "5432:5432"
|
||||
volumes:
|
||||
- postgres-freight-data:/var/lib/postgresql/data
|
||||
- postgres-data:/var/lib/postgresql/data
|
||||
# Schema bootstrap. initdb only sources this on an empty volume.
|
||||
- ./initdb:/docker-entrypoint-initdb.d:ro
|
||||
healthcheck:
|
||||
test: ["CMD-SHELL", "pg_isready -U edr -d edr_database"]
|
||||
interval: 5s
|
||||
timeout: 5s
|
||||
retries: 20
|
||||
networks:
|
||||
- edr-network
|
||||
|
||||
@@ -33,4 +49,4 @@ services:
|
||||
volumes:
|
||||
- redis-data:/data
|
||||
networks:
|
||||
- edr-network
|
||||
- edr-network
|
||||
|
||||
22
infrastructure/docker/initdb/01-schemas.sql
Normal file
22
infrastructure/docker/initdb/01-schemas.sql
Normal file
@@ -0,0 +1,22 @@
|
||||
-- Bootstrap for the single, schema-separated platform database.
|
||||
--
|
||||
-- Runs once, on an empty data volume (postgres image initdb hook). Every app owns
|
||||
-- exactly one schema and applies its own migrations into it; nothing here creates
|
||||
-- tables. Ownership map:
|
||||
--
|
||||
-- iam edr-freight-api (`pnpm iam:migration:run`, ships with @tria-plc/iamapi-common)
|
||||
-- -> history in iam.typeorm_migrations
|
||||
-- freight edr-freight-api -> history in freight.migrations
|
||||
-- passenger edr-passenger-api (Prisma) -> history in passenger._prisma_migrations
|
||||
-- edr_payment edr-payment-api -> its own TypeORM history
|
||||
-- audit @tria-plc/auditlog consumer
|
||||
--
|
||||
-- Cross-schema references stay SOFT (plain UUID columns + denormalized display
|
||||
-- fields). Co-location makes hard FKs possible; the platform deliberately does not
|
||||
-- use them, so IAM stays independently deployable and the audit trail outlives a
|
||||
-- deleted user.
|
||||
CREATE SCHEMA IF NOT EXISTS iam;
|
||||
CREATE SCHEMA IF NOT EXISTS freight;
|
||||
CREATE SCHEMA IF NOT EXISTS passenger;
|
||||
CREATE SCHEMA IF NOT EXISTS edr_payment;
|
||||
CREATE SCHEMA IF NOT EXISTS audit;
|
||||
Reference in New Issue
Block a user