# DO NOT USE THIS!
# This is only intended for testing OIDC functionality when developing Linkding.
# Follow the linkding and Authelia documentation to set up a proper production deployment.

networks:
  net:
    driver: 'bridge'

services:
  linkding:
    image: 'sissbruecker/linkding:local'
    environment:
      LD_SUPERUSER_NAME: 'admin'
      LD_SUPERUSER_PASSWORD: 'admin'
      LD_ENABLE_OIDC: 'True'
      OIDC_RP_CLIENT_ID: 'linkding'
      OIDC_RP_CLIENT_SECRET: 'insecure_secret'
      OIDC_OP_AUTHORIZATION_ENDPOINT: 'https://authelia.example.com/api/oidc/authorization'
      OIDC_OP_TOKEN_ENDPOINT: 'http://authelia:9091/api/oidc/token'
      OIDC_OP_USER_ENDPOINT: 'http://authelia:9091/api/oidc/userinfo'
      OIDC_OP_JWKS_ENDPOINT: 'http://authelia:9091/jwks.json'
    networks:
      net: {}
    labels:
      traefik.enable: 'true'
      traefik.http.routers.public.rule: 'Host(`linkding.example.com`)'
      traefik.http.routers.public.entrypoints: 'https'
      traefik.http.routers.public.tls: 'true'
      traefik.http.routers.public.tls.options: 'default'
  authelia:
    image: 'authelia/authelia:latest'
    volumes:
      - './authelia:/config'
    networks:
      net: {}
    labels:
      traefik.enable: 'true'
      traefik.http.routers.authelia.rule: 'Host(`authelia.example.com`)'
      traefik.http.routers.authelia.entrypoints: 'https'
      traefik.http.routers.authelia.tls: 'true'
      traefik.http.routers.authelia.tls.options: 'default'
  traefik:
    image: 'traefik:v3.5.0'
    volumes:
      - './traefik:/etc/traefik'
      - '/var/run/docker.sock:/var/run/docker.sock'
    networks:
      net: {}
    labels:
      traefik.enable: 'true'
      traefik.http.routers.api.rule: 'Host(`traefik.example.com`)'
      traefik.http.routers.api.entrypoints: 'https'
      traefik.http.routers.api.service: 'api@internal'
      traefik.http.routers.api.tls: 'true'
      traefik.http.routers.api.tls.options: 'default'
    ports:
      - '80:80/tcp'
      - '443:443/tcp'
      - '443:443/udp'
    command:
      - '--api'
      - '--providers.docker=true'
      - '--providers.docker.exposedByDefault=false'
      - '--providers.file.filename=/etc/traefik/certificates.yml'
      - '--entrypoints.http=true'
      - '--entrypoints.http.address=:80'
      - '--entrypoints.http.http.redirections.entrypoint.to=https'
      - '--entrypoints.http.http.redirections.entrypoint.scheme=https'
      - '--entrypoints.https=true'
      - '--entrypoints.https.address=:443'
      - '--log=true'
      - '--log.level=DEBUG'
