fix(compose): merge upstream improvements and fix silent alembic skip

fix(compose): merge upstream improvements and fix silent alembic skip

- Fix critical Docker behavior bug where the separate `command` block on
  `api_server` was being passed as an argument to the custom `entrypoint`
  and silently ignored. `alembic upgrade head` is now executed inside
  the entrypoint before Uvicorn starts, ensuring DB migrations run.

- Add missing upstream logging blocks (json-file, 50m/6 rotation) to
  `web_server`, `relational_db`, and `code-interpreter`.

- Add upstream `healthcheck` to `code-interpreter` for accurate status.

- Include optional upstream `mcp_server` service block (commented out).
This commit is contained in:
Jannic Debus 2026-10-01 23:26:34 +02:00
parent e6ab01f6e2
commit 3e7309f588

View file

@ -28,7 +28,9 @@ services:
sed -i '/json={/a\\ \"language\": os.environ.get(\"WHISPER_LANGUAGE\", \"de\"),' /app/onyx/voice/providers/openai.py
fi
fi
exec uvicorn onyx.main:app --host 0.0.0.0 --port 8080
# Run DB migrations and start the API server
alembic upgrade head && echo \"Starting Onyx Api Server\" && exec uvicorn onyx.main:app --host 0.0.0.0 --port 8080
"
command: >
/bin/sh -c "alembic upgrade head && echo \"Starting Onyx Api Server\" &&
@ -103,6 +105,7 @@ services:
- ./api_server_logs:/var/log/onyx
# Shared volume for persistent document storage (Craft file-system mode)
- ./file-system:/app/file-system
background:
image: ${ONYX_BACKEND_IMAGE:-onyxdotapp/onyx-backend:${IMAGE_TAG:-latest}}
command: |
@ -197,6 +200,11 @@ services:
restart: unless-stopped
environment:
- INTERNAL_URL=${INTERNAL_URL:-http://api_server:8080}
logging:
driver: json-file
options:
max-size: 50m
max-file: "6"
healthcheck:
test:
- CMD
@ -210,6 +218,43 @@ services:
retries: 5
start_period: 30s
# Uncomment the block below to enable the MCP server for Onyx.
# mcp_server:
# image: ${ONYX_BACKEND_IMAGE:-onyxdotapp/onyx-backend:${IMAGE_TAG:-latest}}
# command: >
# /bin/sh -c "if [ \"${MCP_SERVER_ENABLED:-}\" != \"True\" ] && [ \"${MCP_SERVER_ENABLED:-}\" != \"true\" ]; then
# echo 'MCP server is disabled (MCP_SERVER_ENABLED=false), skipping...';
# exit 0;
# else
# exec python -m onyx.mcp_server_main;
# fi"
# env_file:
# - path: .env
# required: false
# depends_on:
# - relational_db
# - cache
# restart: "no"
# environment:
# - POSTGRES_HOST=${POSTGRES_HOST:-relational_db}
# - REDIS_HOST=${REDIS_HOST:-cache}
# # MCP Server Configuration
# - MCP_SERVER_ENABLED=${MCP_SERVER_ENABLED:-false}
# - MCP_SERVER_PORT=${MCP_SERVER_PORT:-8090}
# - MCP_SERVER_CORS_ORIGINS=${MCP_SERVER_CORS_ORIGINS:-}
# - API_SERVER_PROTOCOL=${API_SERVER_PROTOCOL:-http}
# - API_SERVER_HOST=${API_SERVER_HOST:-api_server}
# extra_hosts:
# - "host.docker.internal:host-gateway"
# logging:
# driver: json-file
# options:
# max-size: "50m"
# max-file: "6"
# # Optional, only for debugging purposes
# volumes:
# - ./mcp_server_logs:/var/log/onyx
inference_model_server:
image: ${ONYX_MODEL_SERVER_IMAGE:-onyxdotapp/onyx-model-server:${IMAGE_TAG:-latest}}
networks:
@ -241,6 +286,7 @@ services:
# Generous start_period to absorb HuggingFace model downloads on first
# boot. Healthy is reported as soon as /api/health responds.
start_period: 600s
indexing_model_server:
image: ${ONYX_MODEL_SERVER_IMAGE:-onyxdotapp/onyx-model-server:${IMAGE_TAG:-latest}}
networks:
@ -274,6 +320,7 @@ services:
# Generous start_period to absorb HuggingFace model downloads on first
# boot. Healthy is reported as soon as /api/health responds.
start_period: 600s
relational_db:
image: ${BASE_IMAGE_REGISTRY:-docker.io}/library/postgres:15.2-alpine
shm_size: 1g
@ -302,6 +349,12 @@ services:
retries: 5
volumes:
- ./db_volume:/var/lib/postgresql/data
logging:
driver: json-file
options:
max-size: 50m
max-file: "6"
opensearch:
image: ${BASE_IMAGE_REGISTRY:-docker.io}/opensearchproject/opensearch:3.6.0
restart: unless-stopped
@ -342,6 +395,7 @@ services:
options:
max-size: 50m
max-file: "6"
nginx:
image: ${BASE_IMAGE_REGISTRY:-docker.io}/library/nginx:1.25.5-alpine
restart: unless-stopped
@ -408,6 +462,7 @@ services:
timeout: 10s
retries: 5
start_period: 30s
cache:
image: ${BASE_IMAGE_REGISTRY:-docker.io}/library/redis:7.4-alpine
restart: unless-stopped
@ -420,6 +475,7 @@ services:
# Use tmpfs to prevent creation of anonymous volumes for /data
tmpfs:
- /data
code-interpreter:
image: onyxdotapp/code-interpreter:${CODE_INTERPRETER_IMAGE_TAG:-latest}
command:
@ -437,11 +493,28 @@ services:
user: root
volumes:
- ${DOCKER_SOCK_PATH:-/var/run/docker.sock}:/var/run/docker.sock
logging:
driver: json-file
options:
max-size: 50m
max-file: "6"
healthcheck:
test:
- CMD
- python
- -c
- "import urllib.request; urllib.request.urlopen('http://localhost:8000/health')"
interval: 30s
timeout: 10s
retries: 3
start_period: 60s
volumes:
# Persistent data for OpenSearch.
opensearch-data: null
# Persistent data for the MinIO (S3) file store.
#minio_data: null
networks:
onyx-network:
driver: bridge