When upgrading to the latest image version, the database alteration command was missing, causing the application to fail due to schema mismatch. This change ensures the database is properly migrated to the latest version during startup.
40 lines
1.5 KiB
YAML
40 lines
1.5 KiB
YAML
# documentation: https://docs.logto.io/docs/tutorials/get-started/#logto-oss-self-hosted
|
|
# slogan: A comprehensive identity solution covering both the front and backend, complete with pre-built infrastructure and enterprise-grade solutions.
|
|
# category: auth
|
|
# tags: logto,identity,login,authentication,oauth,oidc,openid
|
|
# logo: svgs/logto_dark.svg
|
|
|
|
services:
|
|
logto:
|
|
image: svhd/logto:${TAG-latest}
|
|
depends_on:
|
|
postgres:
|
|
condition: service_healthy
|
|
entrypoint: ["sh", "-c", "npm run cli db seed -- --swe && npm run alteration deploy latest && npm start"]
|
|
environment:
|
|
- SERVICE_URL_LOGTO
|
|
- TRUST_PROXY_HEADER=1
|
|
- DB_URL=postgres://${SERVICE_USER_POSTGRES}:${SERVICE_PASSWORD_POSTGRES}@postgres:5432/${POSTGRES_DB:-logto}
|
|
# Mandatory for GitPod to map host env to the container, thus GitPod can dynamically configure the public URL of Logto;
|
|
# Or, you can leverage it for local testing.
|
|
- ENDPOINT=$LOGTO_ENDPOINT
|
|
- ADMIN_ENDPOINT=$LOGTO_ADMIN_ENDPOINT
|
|
healthcheck:
|
|
test: ["CMD-SHELL", "exit 0"]
|
|
interval: 5s
|
|
timeout: 20s
|
|
retries: 10
|
|
postgres:
|
|
image: postgres:14-alpine
|
|
user: postgres
|
|
environment:
|
|
POSTGRES_USER: ${SERVICE_USER_POSTGRES}
|
|
POSTGRES_PASSWORD: ${SERVICE_PASSWORD_POSTGRES}
|
|
POSTGRES_DB: ${POSTGRES_DB:-logto}
|
|
volumes:
|
|
- logto-postgres-data:/var/lib/postgresql/data
|
|
healthcheck:
|
|
test: ["CMD", "pg_isready", "-U", "$SERVICE_USER_POSTGRES", "-d", "$POSTGRES_DB"]
|
|
interval: 5s
|
|
timeout: 20s
|
|
retries: 10
|