feat: add init sidecar for migrations and setup on compose up
Introduces a one-shot `init` service in docker-compose that runs Postgres migrations, Neo4j index setup, and library-type seeding on every `up`. Long-running services (`app`, `mcp`, `worker`) now depend on its successful completion via `service_completed_successfully`, blocking the stack on configuration errors (missing embedding model, dimension mismatch, unreachable DB) rather than serving silent zero-result searches. Also standardizes reranker test fixtures to use the `/v1` OpenAI-style base URL convention used across other service clients.
This commit is contained in:
@@ -55,6 +55,19 @@ case "$1" in
|
||||
python manage.py load_library_types
|
||||
;;
|
||||
|
||||
init)
|
||||
# Bundled one-shot init run by the `init` sidecar on every
|
||||
# `docker compose up`. Idempotent: re-runs are no-ops unless migrations
|
||||
# or indexes need to change. A non-zero exit here blocks `app`, `mcp`,
|
||||
# and `worker` from starting, which is the point — we'd rather fail
|
||||
# loudly than serve silent zero-result searches.
|
||||
set -e
|
||||
python manage.py migrate --noinput
|
||||
python manage.py setup_neo4j_indexes
|
||||
python manage.py load_library_types
|
||||
;;
|
||||
|
||||
|
||||
shell)
|
||||
# Drop into the management shell for ad-hoc work.
|
||||
exec python manage.py shell
|
||||
|
||||
Reference in New Issue
Block a user