services:
  mattermost:
    container_name: mattermost
    image: mattermost/mattermost-team-edition:11.3
    restart: unless-stopped
    ports:
      - "8065:8065"
    volumes:
      - ./config:/mattermost/config
      - ./data:/mattermost/data
      - ./logs:/mattermost/logs
      - ./plugins:/mattermost/plugins
      - ./client/plugins:/mattermost/client/plugins
      - ./bleve-indexes:/mattermost/bleve-indexes
    environment:
      - TZ=UTC
      - MM_SQLSETTINGS_DRIVERNAME=postgres
      - MM_SQLSETTINGS_DATASOURCE=postgres://mmuser:${MM_DB_PASSWORD}@172.17.0.1:5432/mattermost?sslmode=disable
      - MM_SERVICESETTINGS_SITEURL=https://mm.crista.love
      # Authentik OpenID Connect SSO - keeps local login working
      - MM_OPENIDSETTINGS_ENABLE=true
      - MM_OPENIDSETTINGS_BUTTONTEXT=Sign in with Authentik
      - MM_OPENIDSETTINGS_BUTTONCOLOR=#fd4b2d
      - MM_OPENIDSETTINGS_DISCOVERYSETTINGS_DISCOVERURL=https://sso.vish.gg/application/o/mattermost/.well-known/openid-configuration
      - MM_OPENIDSETTINGS_ID=OGxIdZLKqYKgf9Sf9zAFAyhKzBdDvonL7HHSBu1w
      - MM_OPENIDSETTINGS_SECRET=Dzi2iOFXMyzXrvbT2ZDSdqYYg6c6bX39mFihX4h20WKEV0lHBnKfF5bb6KWDH2P9HhlTpl1KPB5LbE9GYuJqGoTXO6aXWiNJJhqrCgJX2eaFRtne2J72mz4TfTxxKBCM
      - MM_OPENIDSETTINGS_SCOPE=openid profile email
