Decouple per-service Alembic migrations and fix cross-DB queries
Each service (blog, market, cart, events, federation, account) now owns its own database schema with independent Alembic migrations. Removes the monolithic shared/alembic/ that ran all migrations against a single DB. - Add per-service alembic.ini, env.py, and 0001_initial.py migrations - Add shared/db/alembic_env.py helper with table-name filtering - Fix cross-DB FK in blog/models/snippet.py (users lives in db_account) - Fix cart_impl.py cross-DB queries: fetch products and market_places via internal data endpoints instead of direct SQL joins - Fix blog ghost_sync to fetch page_configs from cart via data endpoint - Add products-by-ids and page-config-ensure data endpoints - Update all entrypoint.sh to create own DB and run own migrations - Cart now uses db_cart instead of db_market - Add docker-compose.dev.yml, dev.sh for local development - CI deploys both rose-ash swarm stack and rose-ash-dev compose stack - Fix Quart namespace package crash (root_path in factory.py) Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -76,9 +76,11 @@ services:
|
||||
environment:
|
||||
<<: *app-env
|
||||
DATABASE_URL: postgresql+asyncpg://postgres:change-me@pgbouncer:5432/db_market
|
||||
ALEMBIC_DATABASE_URL: postgresql+psycopg://postgres:change-me@db:5432/db_market
|
||||
REDIS_URL: redis://redis:6379/1
|
||||
DATABASE_HOST: db
|
||||
DATABASE_PORT: "5432"
|
||||
RUN_MIGRATIONS: "true"
|
||||
WORKERS: "1"
|
||||
|
||||
cart:
|
||||
@@ -89,10 +91,12 @@ services:
|
||||
dockerfile: cart/Dockerfile
|
||||
environment:
|
||||
<<: *app-env
|
||||
DATABASE_URL: postgresql+asyncpg://postgres:change-me@pgbouncer:5432/db_market
|
||||
DATABASE_URL: postgresql+asyncpg://postgres:change-me@pgbouncer:5432/db_cart
|
||||
ALEMBIC_DATABASE_URL: postgresql+psycopg://postgres:change-me@db:5432/db_cart
|
||||
REDIS_URL: redis://redis:6379/2
|
||||
DATABASE_HOST: db
|
||||
DATABASE_PORT: "5432"
|
||||
RUN_MIGRATIONS: "true"
|
||||
WORKERS: "1"
|
||||
|
||||
events:
|
||||
@@ -104,9 +108,11 @@ services:
|
||||
environment:
|
||||
<<: *app-env
|
||||
DATABASE_URL: postgresql+asyncpg://postgres:change-me@pgbouncer:5432/db_events
|
||||
ALEMBIC_DATABASE_URL: postgresql+psycopg://postgres:change-me@db:5432/db_events
|
||||
REDIS_URL: redis://redis:6379/3
|
||||
DATABASE_HOST: db
|
||||
DATABASE_PORT: "5432"
|
||||
RUN_MIGRATIONS: "true"
|
||||
WORKERS: "1"
|
||||
|
||||
federation:
|
||||
@@ -118,9 +124,11 @@ services:
|
||||
environment:
|
||||
<<: *app-env
|
||||
DATABASE_URL: postgresql+asyncpg://postgres:change-me@pgbouncer:5432/db_federation
|
||||
ALEMBIC_DATABASE_URL: postgresql+psycopg://postgres:change-me@db:5432/db_federation
|
||||
REDIS_URL: redis://redis:6379/4
|
||||
DATABASE_HOST: db
|
||||
DATABASE_PORT: "5432"
|
||||
RUN_MIGRATIONS: "true"
|
||||
WORKERS: "1"
|
||||
|
||||
account:
|
||||
@@ -132,9 +140,11 @@ services:
|
||||
environment:
|
||||
<<: *app-env
|
||||
DATABASE_URL: postgresql+asyncpg://postgres:change-me@pgbouncer:5432/db_account
|
||||
ALEMBIC_DATABASE_URL: postgresql+psycopg://postgres:change-me@db:5432/db_account
|
||||
REDIS_URL: redis://redis:6379/5
|
||||
DATABASE_HOST: db
|
||||
DATABASE_PORT: "5432"
|
||||
RUN_MIGRATIONS: "true"
|
||||
WORKERS: "1"
|
||||
|
||||
db:
|
||||
@@ -147,10 +157,6 @@ services:
|
||||
- db_data_1:/var/lib/postgresql/data
|
||||
networks:
|
||||
appnet:
|
||||
configs:
|
||||
- source: schema_sql
|
||||
target: /run/configs/schema_sql
|
||||
mode: 0444
|
||||
deploy:
|
||||
placement:
|
||||
constraints:
|
||||
@@ -226,6 +232,3 @@ networks:
|
||||
externalnet:
|
||||
driver: overlay
|
||||
external: true
|
||||
configs:
|
||||
schema_sql:
|
||||
file: ./schema.sql
|
||||
|
||||
Reference in New Issue
Block a user