From 4eb6822736a8d4e65d77dd9a79cf78c61162487f Mon Sep 17 00:00:00 2001 From: Vadim Malanov Date: Sat, 11 Jul 2026 18:13:21 +0300 Subject: [PATCH] fix(deploy): apply alembic migrations before uvicorn in the server overlay --- docker-compose.server.yml | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/docker-compose.server.yml b/docker-compose.server.yml index 2392c4f..81a8df2 100644 --- a/docker-compose.server.yml +++ b/docker-compose.server.yml @@ -16,7 +16,13 @@ # dispatch bus (alias legacyhub-api) — teamhub_net is a regular bridge, so # it also provides the egress needed for first-run HuggingFace downloads; # - identity enforcement is env-driven: AUTH_REQUIRE_IDENTITY (set true on -# the server; machine paths keep X-API-Key auth). +# the server; machine paths keep X-API-Key auth); +# - applies alembic migrations before uvicorn starts. The base compose api +# command is a bare `uvicorn` (no migrate step, unlike ToolsHUB/SalesHUB), +# so a fresh server DB stayed empty and every DB-backed request 500'd on +# `relation does not exist` while /health (liveness) still returned 200. +# The worker (restart: always) tolerates the brief startup race until the +# schema exists. # # The shared network must exist first: docker network create teamhub_net @@ -52,6 +58,7 @@ services: restart: always api: + command: ["sh", "-c", "alembic upgrade head && exec uvicorn app.main:app --host 0.0.0.0 --port 8000"] ports: !override - "${LEGACYHUB_API_BIND:-127.0.0.1}:${API_HOST_PORT:-8050}:8000" networks: !override