Stack rehearsal fixes: interpolation, network ownership, plain-CMD images (#10)
This commit is contained in:
parent
9cd24387f2
commit
f2270100bb
3 changed files with 18 additions and 8 deletions
|
|
@ -119,8 +119,9 @@ done
|
|||
# deploy: the network doesn't exist yet — create it exactly as the stack will
|
||||
# (attachable overlay) so the name is adopted, then migrate, then deploy.
|
||||
NET="${STACK_NAME}_internal"
|
||||
docker network inspect "$NET" >/dev/null 2>&1 \
|
||||
|| docker network create --driver overlay --attachable --scope swarm "$NET" >/dev/null
|
||||
# Never pre-create $NET: docker stack deploy must own it (a pre-existing
|
||||
# unlabeled network makes it fail with "already exists"). On first deploy the
|
||||
# migrate runs AFTER stack deploy instead (FIRST_DEPLOY_MIGRATE below).
|
||||
if [ "$SERVICE" = "backend" ] || [ "$SERVICE" = "all" ]; then
|
||||
if docker service inspect "${STACK_NAME}_db" >/dev/null 2>&1; then
|
||||
echo "==> One-shot migrate ($BACKEND_IMAGE)"
|
||||
|
|
|
|||
|
|
@ -34,4 +34,13 @@ if [ -f "$ENV_FILE" ]; then
|
|||
done < "$ENV_FILE"
|
||||
fi
|
||||
|
||||
# Hand off: the backend image has a real entrypoint script; the frontend
|
||||
# image is plain-CMD (docker passes that CMD to us as $@ when the stack
|
||||
# overrides the entrypoint) -- exec whichever this image actually is.
|
||||
if [ -x /app/deploy/entrypoint.sh ]; then
|
||||
exec /app/deploy/entrypoint.sh "$@"
|
||||
elif [ "$#" -gt 0 ]; then
|
||||
exec "$@"
|
||||
else
|
||||
exec uvicorn app:app --host 0.0.0.0 --port "${PORT:-8080}"
|
||||
fi
|
||||
|
|
|
|||
|
|
@ -36,10 +36,10 @@
|
|||
|
||||
services:
|
||||
db:
|
||||
image: ${TIMESCALEDB_IMAGE:?set TIMESCALEDB_IMAGE to the exact (digest-pinned) image the volume was created with}
|
||||
image: ${TIMESCALEDB_IMAGE:?required}
|
||||
environment:
|
||||
POSTGRES_USER: thermograph
|
||||
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:?set POSTGRES_PASSWORD}
|
||||
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:?required}
|
||||
POSTGRES_DB: thermograph
|
||||
DB_MEMORY: ${DB_MEMORY:-16g}
|
||||
volumes:
|
||||
|
|
@ -64,7 +64,7 @@ services:
|
|||
condition: on-failure
|
||||
|
||||
web:
|
||||
image: ${REGISTRY_HOST:-git.thermograph.org}/${BACKEND_IMAGE_PATH:-emi/thermograph-backend/app}:${BACKEND_IMAGE_TAG:?set BACKEND_IMAGE_TAG}
|
||||
image: ${REGISTRY_HOST:-git.thermograph.org}/${BACKEND_IMAGE_PATH:-emi/thermograph-backend/app}:${BACKEND_IMAGE_TAG:?required}
|
||||
entrypoint: ["/host/env-entrypoint.sh"]
|
||||
environment:
|
||||
THERMOGRAPH_DATABASE_URL: postgresql+asyncpg://thermograph:${POSTGRES_PASSWORD}@db:5432/thermograph
|
||||
|
|
@ -105,7 +105,7 @@ services:
|
|||
failure_action: rollback
|
||||
|
||||
worker:
|
||||
image: ${REGISTRY_HOST:-git.thermograph.org}/${BACKEND_IMAGE_PATH:-emi/thermograph-backend/app}:${BACKEND_IMAGE_TAG:?set BACKEND_IMAGE_TAG}
|
||||
image: ${REGISTRY_HOST:-git.thermograph.org}/${BACKEND_IMAGE_PATH:-emi/thermograph-backend/app}:${BACKEND_IMAGE_TAG:?required}
|
||||
entrypoint: ["/host/env-entrypoint.sh"]
|
||||
environment:
|
||||
THERMOGRAPH_DATABASE_URL: postgresql+asyncpg://thermograph:${POSTGRES_PASSWORD}@db:5432/thermograph
|
||||
|
|
@ -139,7 +139,7 @@ services:
|
|||
condition: on-failure
|
||||
|
||||
frontend:
|
||||
image: ${REGISTRY_HOST:-git.thermograph.org}/${FRONTEND_IMAGE_PATH:-emi/thermograph-frontend/app}:${FRONTEND_IMAGE_TAG:?set FRONTEND_IMAGE_TAG}
|
||||
image: ${REGISTRY_HOST:-git.thermograph.org}/${FRONTEND_IMAGE_PATH:-emi/thermograph-frontend/app}:${FRONTEND_IMAGE_TAG:?required}
|
||||
entrypoint: ["/host/env-entrypoint.sh"]
|
||||
environment:
|
||||
THERMOGRAPH_BASE: /
|
||||
|
|
|
|||
Loading…
Reference in a new issue