Skip to content

An open-source, self-hostable PaaS alternative to Vercel, Heroku & Netlify that lets you easily deploy static sites, databases, full-stack applications and 360+ one-click services on your own servers.

1.6 KB
Raw Blame
# 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
# port: 3001

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