## Common flags:
# demo-users
# email-verification
# log-emails
# log-invitation-tokens
# login-with-github
# login-with-gitlab
# login-with-google
# login-with-ldap
# login-with-oidc
# login-with-password
# prepl-server
# registration
# secure-session-cookies
# smtp
# smtp-debug
# telemetry
# webhooks
##
## You can read more about all available flags and other
## environment variables here:
## https://help.penpot.app/technical-guide/configuration/#penpot-configuration
#
# WARNING: if you're exposing Penpot to the internet, you should remove the flags
# 'disable-secure-session-cookies' and 'disable-email-verification'
x-flags: &a1
  PENPOT_FLAGS: enable-smtp enable-prepl-server enable-login-with-github
x-uri: &a3
  PENPOT_PUBLIC_URI: https://penpot.pcdhebrail.ovh
x-body-size:
  # Max body size (30MiB); Used for plain requests, should never be
  # greater than multi-part size
  &a2
  PENPOT_HTTP_SERVER_MAX_BODY_SIZE: 31457280
  # Max multipart body size (350MiB)
  PENPOT_HTTP_SERVER_MAX_MULTIPART_BODY_SIZE: 367001600
## Penpot SECRET KEY. It serves as a master key from which other keys for subsystems
## (eg http sessions, or invitations) are derived.
##
## We recommend to use a trully randomly generated
## 512 bits base64 encoded string here. You can generate one with:
##
## python3 -c "import secrets; print(secrets.token_urlsafe(64))"
x-secret-key: &a4
  PENPOT_SECRET_KEY: bFihQkNNH_szTifwfxlAuXfMZMDXHstPj13yoqZ19Sz3TZuTA-RuLsvOt2L3Y7ugXq7T6yDJXtHq8kqilHYP-w
networks:
  penpot: null
volumes:
  penpot_postgres_v15: null
  penpot_assets: null
    # penpot_minio:

services:
  penpot-frontend:
    image: penpotapp/frontend:${PENPOT_VERSION:-latest}
    restart: always
    ports:
      - 9001:8080
    volumes:
      - penpot_assets:/opt/data/assets
    depends_on:
      - penpot-backend
      - penpot-exporter
    networks:
      - penpot
    environment:
      <<:
        - *a1
        - *a2
  penpot-backend:
    image: penpotapp/backend:${PENPOT_VERSION:-latest}
    restart: always
    dns:
      - 8.8.8.8
      - 1.1.1.1
    volumes:
      - penpot_assets:/opt/data/assets
    depends_on:
      penpot-postgres:
        condition: service_healthy
      penpot-valkey:
        condition: service_healthy
    networks:
      - penpot
    environment:
      <<:
        - *a1
        - *a3
        - *a2
        - *a4
      PENPOT_DATABASE_URI: postgresql://penpot-postgres/penpot
      PENPOT_DATABASE_USERNAME: penpot
      PENPOT_DATABASE_PASSWORD: penpot
      PENPOT_REDIS_URI: redis://penpot-valkey/0
      PENPOT_ASSETS_STORAGE_BACKEND: assets-fs
      PENPOT_STORAGE_ASSETS_FS_DIRECTORY: /opt/data/assets
      PENPOT_TELEMETRY_ENABLED: true
      PENPOT_TELEMETRY_REFERER: compose
      PENPOT_SMTP_DEFAULT_FROM: no-reply@pcdhebrail.ovh
      PENPOT_SMTP_DEFAULT_REPLY_TO: no-reply@pcdhebrail.ovh
      PENPOT_SMTP_HOST: smtp.resend.com
      PENPOT_SMTP_PORT: 2465
      PENPOT_SMTP_USERNAME: resend
      PENPOT_SMTP_PASSWORD: re_JtAChXWi_2pSQrNwKF2YjatyeoQEbkeHH
      PENPOT_SMTP_TLS: true
      PENPOT_SMTP_SSL: true
      PENPOT_GITHUB_CLIENT_ID: Ov23lisAqSskBDYJie2b
      PENPOT_GITHUB_CLIENT_SECRET: 1cd4cc4bd14730f9ede75785494f719a82edf12b
  penpot-exporter:
    image: penpotapp/exporter:${PENPOT_VERSION:-latest}
    restart: always
    depends_on:
      penpot-valkey:
        condition: service_healthy
    networks:
      - penpot
    environment:
      <<:
        - *a4
      PENPOT_PUBLIC_URI: http://penpot-frontend:8080
      PENPOT_REDIS_URI: redis://penpot-valkey/0
  penpot-postgres:
    image: postgres:15
    restart: always
    stop_signal: SIGINT
    healthcheck:
      test:
        - CMD-SHELL
        - pg_isready -U penpot
      interval: 2s
      timeout: 10s
      retries: 5
      start_period: 2s
    volumes:
      - penpot_postgres_v15:/var/lib/postgresql/data
    networks:
      - penpot
    environment:
      - POSTGRES_INITDB_ARGS=--data-checksums
      - POSTGRES_DB=penpot
      - POSTGRES_USER=penpot
      - POSTGRES_PASSWORD=penpot
  penpot-valkey:
    image: valkey/valkey:8.1
    restart: always
    healthcheck:
      test:
        - CMD-SHELL
        - valkey-cli ping | grep PONG
      interval: 1s
      timeout: 3s
      retries: 5
      start_period: 3s
    networks:
      - penpot
    environment:
      - VALKEY_EXTRA_FLAGS=--maxmemory 128mb --maxmemory-policy volatile-lfu
