---
version: "3.7"

volumes:
  traefik-certs: null
  ocis-store: null
  ocis-storage-system: null
  ocis-storage-users: null
  ocis-sharing: null
  ocis-thumbnails: null
  ocis-idm: null
  ocis-nats: null
  ocis-search: null

networks:
  ocis-net:

services:
  traefik:
    image: traefik:v2.6.6
    networks:
      ocis-net:
        aliases:
          - ${OCIS_DOMAIN}
    command:
      - "--log.level=${TRAEFIK_LOG_LEVEL:-ERROR}"
      # letsencrypt configuration
      - "--certificatesResolvers.http.acme.email=${TRAEFIK_ACME_MAIL:-example@example.org}"
      - "--certificatesResolvers.http.acme.storage=/certs/acme.json"
      - "--certificatesResolvers.http.acme.httpChallenge.entryPoint=http"
      # enable dashboard
      - "--api.dashboard=${TRAEFIK_DASHBOARD:-false}"
      # define entrypoints
      - "--entryPoints.http.address=:80"
      - "--entryPoints.http.http.redirections.entryPoint.to=https"
      - "--entryPoints.http.http.redirections.entryPoint.scheme=https"
      - "--entryPoints.https.address=:443"
      # docker provider (get configuration from container labels)
      - "--providers.docker.endpoint=unix:///var/run/docker.sock"
      - "--providers.docker.exposedByDefault=false"
    ports:
      - "80:80"
      - "443:443"
    volumes:
      - "/var/run/docker.sock:/var/run/docker.sock:ro"
      - "traefik-certs:/certs"
    labels:
      - "traefik.enable=${TRAEFIK_DASHBOARD:-false}"
      - "traefik.http.middlewares.traefik-auth.basicauth.users=${TRAEFIK_BASIC_AUTH_USERS:-admin:$$apr1$$4vqie50r$$YQAmQdtmz5n9rEALhxJ4l.}" # defaults to admin:admin
      - "traefik.http.routers.traefik.entrypoints=https"
      - "traefik.http.routers.traefik.rule=Host(`${TRAEFIK_DOMAIN:-traefik.owncloud.test}`)"
      - "traefik.http.routers.traefik.middlewares=traefik-auth"
      - "traefik.http.routers.traefik.tls.certresolver=http"
      - "traefik.http.routers.traefik.service=api@internal"
    logging:
      driver: "local"
    restart: always

  app-registry:
    image: owncloud/ocis:${OCIS_DOCKER_TAG:-latest}
    deploy:
      replicas: ${OCIS_SCALE:-1}
    networks:
      ocis-net:
    entrypoint:
      - ocis
      - app-registry
      - server
    environment:
      APP_REGISTRY_LOG_LEVEL: "${OCIS_LOG_LEVEL:-error}"
      APP_REGISTRY_LOG_COLOR: "${OCIS_LOG_COLOR:-false}"
      APP_REGISTRY_LOG_PRETTY: "${OCIS_LOG_PRETTY:-false}"

      APP_REGISTRY_JWT_SECRET: ${OCIS_JWT_SECRET}

      APP_REGISTRY_GRPC_ADDR: 0.0.0.0:9242
      REVA_GATEWAY: gateway:9142

    logging:
      driver: "local"
    restart: always

  app-provider:
    image: owncloud/ocis:${OCIS_DOCKER_TAG:-latest}
    deploy:
      replicas: ${OCIS_SCALE:-1}
    networks:
      ocis-net:
    entrypoint:
      - ocis
      - app-provider
      - server
    environment:
      APPPROVIDER_LOG_LEVEL: "${OCIS_LOG_LEVEL:-error}"
      APPPROVIDER_LOG_COLOR: "${OCIS_LOG_COLOR:-false}"
      APPPROVIDER_LOG_PRETTY: "${OCIS_LOG_PRETTY:-false}"

      APP_PROVIDER_GRPC_ADDR: 0.0.0.0:9164
      APP_PROVIDER_EXTERNAL_ADDR: app-provider:9164

      REVA_GATEWAY: gateway:9142
      APP_PROVIDER_JWT_SECRET: ${OCIS_JWT_SECRET}
    logging:
      driver: "local"
    restart: always

  notifications:
    image: owncloud/ocis:${OCIS_DOCKER_TAG:-latest}
    deploy:
      replicas: ${OCIS_SCALE:-1}
    networks:
      ocis-net:
    entrypoint:
      - ocis
      - notifications
      - server
    environment:
      NOTIFICATIONS_LOG_LEVEL: "${OCIS_LOG_LEVEL:-error}"
      NOTIFICATIONS_LOG_COLOR: "${OCIS_LOG_COLOR:-false}"
      NOTIFICATIONS_LOG_PRETTY: "${OCIS_LOG_PRETTY:-false}"

      REVA_GATEWAY: gateway:9142
      NOTIFICATIONS_EVENTS_ENDPOINT: nats:9233
      NOTIFICATIONS_MACHINE_AUTH_API_KEY: ${OCIS_MACHINE_AUTH_API_KEY}
    logging:
      driver: "local"
    restart: always

  idm:
    image: owncloud/ocis:${OCIS_DOCKER_TAG:-latest}
    deploy:
      replicas: 1
    networks:
      ocis-net:
    volumes:
      - ocis-idm:/var/lib/ocis
    entrypoint:
      - ocis
      - idm
      - server
    environment:
      IDM_LOG_LEVEL: "${OCIS_LOG_LEVEL:-error}"
      IDM_LOG_COLOR: "${OCIS_LOG_COLOR:-false}"
      IDM_LOG_PRETTY: "${OCIS_LOG_PRETTY:-false}"

      IDM_LDAPS_ADDR: 0.0.0.0:9235
      IDM_ADMIN_USER_ID: ${ADMIN_USER_ID}
      IDM_ADMIN_PASSWORD: ${ADMIN_USER_PASSWORD}
      IDM_SVC_PASSWORD: ${IDM_SVC_PASSWORD}
      IDM_REVASVC_PASSWORD:  ${IDM_REVASVC_PASSWORD}
      IDM_IDPSVC_PASSWORD:  ${IDM_IDPSVC_PASSWORD}


      IDM_CREATE_DEMO_USERS: ${DEMO_USERS:-false}

      IDM_JWT_SECRET: ${OCIS_JWT_SECRET}
    logging:
      driver: "local"
    restart: always

  ocdav:
    image: owncloud/ocis:${OCIS_DOCKER_TAG:-latest}
    deploy:
      replicas: ${OCIS_SCALE:-1}
    networks:
      ocis-net:
    entrypoint:
      - ocis
      - ocdav
      - server
    environment:
      OCDAV_LOG_LEVEL: "${OCIS_LOG_LEVEL:-error}"
      OCDAV_LOG_COLOR: "${OCIS_LOG_COLOR:-false}"
      OCDAV_LOG_PRETTY: "${OCIS_LOG_PRETTY:-false}"

      OCDAV_HTTP_ADDR: 0.0.0.0:8080

      OCDAV_PUBLIC_URL: https://${OCIS_DOMAIN}

      REVA_GATEWAY: gateway:9142
      OCDAV_JWT_SECRET: ${OCIS_JWT_SECRET}

      OCDAV_INSECURE: ${INSECURE:-true}
    logging:
      driver: "local"
    restart: always

  graph-explorer:
    image: owncloud/ocis:${OCIS_DOCKER_TAG:-latest}
    deploy:
      replicas: ${OCIS_SCALE:-1}
    networks:
      ocis-net:
    entrypoint:
      - ocis
      - graph-explorer
      - server
    environment:
      GRAPH_EXPLOER_LOG_LEVEL: "${OCIS_LOG_LEVEL:-error}"
      GRAPH_EXPLOER_LOG_COLOR: "${OCIS_LOG_COLOR:-false}"
      GRAPH_EXPLOER_LOG_PRETTY: "${OCIS_LOG_PRETTY:-false}"

      GRAPH_EXPLORER_HTTP_ADDR: 0.0.0.0:9135
      GRAPH_EXPLORER_ISSUER: https://${OCIS_DOMAIN}
      GRAPH_EXPLORER_GRAPH_URL_BASE: https://${OCIS_DOMAIN}
    logging:
      driver: "local"
    restart: always

  audit:
    image: owncloud/ocis:${OCIS_DOCKER_TAG:-latest}
    deploy:
      replicas: 1
    networks:
      ocis-net:
    entrypoint:
      - ocis
      - audit
      - server
    environment:
      AUDIT_LOG_LEVEL: "${OCIS_LOG_LEVEL:-error}"
      AUDIT_LOG_COLOR: "${OCIS_LOG_COLOR:-false}"
      AUDIT_LOG_PRETTY: "${OCIS_LOG_PRETTY:-false}"

      AUDIT_EVENTS_ENDPOINT: nats:9233
    logging:
      driver: "local"
    restart: always

  proxy:
    image: owncloud/ocis:${OCIS_DOCKER_TAG:-latest}
    deploy:
      replicas: ${OCIS_SCALE:-1}
    networks:
      ocis-net:
    entrypoint:
      - ocis
      - proxy
      - server
    environment:
      PROXY_LOG_LEVEL: "${OCIS_LOG_LEVEL:-error}"
      PROXY_LOG_COLOR: "${OCIS_LOG_COLOR:-false}"
      PROXY_LOG_PRETTY: "${OCIS_LOG_PRETTY:-false}"

      PROXY_TLS: "false" # do not use SSL between Traefik and oCIS

      REVA_GATEWAY: gateway:9142

      PROXY_JWT_SECRET: ${OCIS_JWT_SECRET}
      PROXY_MACHINE_AUTH_API_KEY: ${OCIS_MACHINE_AUTH_API_KEY}

      PROXY_OIDC_INSECURE: "${INSECURE:-true}"
      PROXY_OIDC_ISSUER: https://${OCIS_DOMAIN}

      PROXY_INSECURE_BACKENDS: true
      PROXY_HTTP_ADDR: 0.0.0.0:9200

      PROXY_ENABLE_BASIC_AUTH: ${PROXY_ENABLE_BASIC_AUTH:-true}

    volumes:
      - "./config/proxy/proxy.yaml:/etc/ocis/proxy.yaml"
    labels:
      - "traefik.enable=true"
      - "traefik.http.routers.ocis.entrypoints=https"
      - "traefik.http.routers.ocis.rule=Host(`${OCIS_DOMAIN}`)"
      - "traefik.http.routers.ocis.tls.certresolver=http"
      - "traefik.http.routers.ocis.service=ocis"
      - "traefik.http.services.ocis.loadbalancer.server.port=9200"
    logging:
      driver: "local"
    restart: always

  nats:
    image: owncloud/ocis:${OCIS_DOCKER_TAG:-latest}
    deploy:
      replicas: 1
    networks:
      ocis-net:
    volumes:
      - "ocis-nats:/var/lib/ocis"
    entrypoint:
      - ocis
      - nats
      - server
    environment:
      NATS_LOG_LEVEL: "${OCIS_LOG_LEVEL:-error}"
      NATS_LOG_COLOR: "${OCIS_LOG_COLOR:-false}"
      NATS_LOG_PRETTY: "${OCIS_LOG_PRETTY:-false}"

      NATS_NATS_HOST: 0.0.0.0

    logging:
      driver: "local"
    restart: always

  idp:
    image: owncloud/ocis:${OCIS_DOCKER_TAG:-latest}
    deploy:
      replicas: 1
    networks:
      ocis-net:
    entrypoint:
      - ocis
      - idp
      - server
    environment:
      IDP_LOG_LEVEL: "${OCIS_LOG_LEVEL:-error}"
      IDP_LOG_COLOR: "${OCIS_LOG_COLOR:-false}"
      IDP_LOG_PRETTY: "${OCIS_LOG_PRETTY:-false}"

      IDP_HTTP_ADDR: 0.0.0.0:9130

      IDP_LDAP_URI: ldaps://idm:9235
      IDP_LDAP_BIND_PASSWORD: ${IDM_IDPSVC_PASSWORD}

      IDP_ISS: https://${OCIS_DOMAIN}
      IDP_INSECURE: "${INSECURE:-true}"
    logging:
      driver: "local"
    restart: always

  ocs:
    image: owncloud/ocis:${OCIS_DOCKER_TAG:-latest}
    deploy:
      replicas: ${OCIS_SCALE:-1}
    networks:
      ocis-net:
    entrypoint:
      - ocis
      - ocs
      - server
    environment:
      OCS_LOG_LEVEL: "${OCIS_LOG_LEVEL:-error}"
      OCS_LOG_COLOR: "${OCIS_LOG_COLOR:-false}"
      OCS_LOG_PRETTY: "${OCIS_LOG_PRETTY:-false}"

      OCS_HTTP_ADDR: 0.0.0.0:9110

      OCS_IDM_ADDRESS: https://${OCIS_DOMAIN}

      OCS_JWT_SECRET: ${OCIS_JWT_SECRET}
      OCS_MACHINE_AUTH_API_KEY: ${OCIS_MACHINE_AUTH_API_KEY}

      REVA_GATEWAY: gateway:9142
    logging:
      driver: "local"
    restart: always

  search:
    image: owncloud/ocis:${OCIS_DOCKER_TAG:-latest}
    deploy:
      replicas: ${OCIS_SCALE:-1}
    networks:
      ocis-net:
    volumes:
      - "ocis-search:/var/lib/ocis"
    entrypoint:
      - ocis
      - search
      - server
    environment:
      SEARCH_LOG_LEVEL: "${OCIS_LOG_LEVEL:-error}"
      SEARCH_LOG_COLOR: "${OCIS_LOG_COLOR:-false}"
      SEARCH_LOG_PRETTY: "${OCIS_LOG_PRETTY:-false}"

      SEARCH_GRPC_ADDR: 0.0.0.0:9220

      REVA_GATEWAY: gateway:9142
      SEARCH_EVENTS_ENDPOINT: nats:9233

      SEARCH_MACHINE_AUTH_API_KEY: ${OCIS_MACHINE_AUTH_API_KEY}
    logging:
      driver: "local"
    restart: always

  settings:
    image: owncloud/ocis:${OCIS_DOCKER_TAG:-latest}
    deploy:
      replicas: ${OCIS_SCALE:-1}
    networks:
      ocis-net:
    entrypoint:
      - ocis
      - settings
      - server
    environment:
      SETTINGS_LOG_LEVEL: "${OCIS_LOG_LEVEL:-error}"
      SETTINGS_LOG_COLOR: "${OCIS_LOG_COLOR:-false}"
      SETTINGS_LOG_PRETTY: "${OCIS_LOG_PRETTY:-false}"

      SETTINGS_HTTP_ADDR: 0.0.0.0:9190
      SETTINGS_GRPC_ADDR: 0.0.0.0:9191

      SETTINGS_JWT_SECRET: ${OCIS_JWT_SECRET}

      OCIS_SYSTEM_USER_API_KEY: ${SYSTEM_USER_API_KEY}
      OCIS_SYSTEM_USER_ID: ${SYSTEM_USER_ID}

      SETTINGS_ADMIN_USER_ID: ${ADMIN_USER_ID}

      STORAGE_GATEWAY_GRPC_ADDR: storage-system:9215
      STORAGE_GRPC_ADDR: storage-system:9215

    logging:
      driver: "local"
    restart: always

  store:
    image: owncloud/ocis:${OCIS_DOCKER_TAG:-latest}
    deploy:
      replicas: 1
    networks:
      ocis-net:
    entrypoint:
      - ocis
      - store
      - server
    environment:
      STORE_LOG_LEVEL: "${OCIS_LOG_LEVEL:-error}"
      STORE_LOG_COLOR: "${OCIS_LOG_COLOR:-false}"
      STORE_LOG_PRETTY: "${OCIS_LOG_PRETTY:-false}"

      STORE_GRPC_ADDR: 0.0.0.0:9460

    volumes:
      - "ocis-store:/var/lib/ocis"
    logging:
      driver: "local"
    restart: always

  thumbnails:
    image: owncloud/ocis:${OCIS_DOCKER_TAG:-latest}
    deploy:
      replicas: ${OCIS_SCALE:-1}
    networks:
      ocis-net:
    entrypoint:
      - ocis
      - thumbnails
      - server
    environment:
      THUMBNAILS_LOG_LEVEL: "${OCIS_LOG_LEVEL:-error}"
      THUMBNAILS_LOG_COLOR: "${OCIS_LOG_COLOR:-false}"
      THUMBNAILS_LOG_PRETTY: "${OCIS_LOG_PRETTY:-false}"

      THUMBNAILS_GRPC_ADDR: 0.0.0.0:9185
      THUMBNAILS_HTTP_ADDR: 0.0.0.0:9186
      THUMBNAILS_DATA_ENDPOINT: http://thumbnails:9186/thumbnails/data
      THUMBNAILS_CS3SOURCE_INSECURE: "true"
      REVA_GATEWAY: gateway:9142

    volumes:
      # optional shared thumbnail cache between services
      - "ocis-thumbnails:/var/lib/ocis"
    logging:
      driver: "local"
    restart: always

  web:
    image: owncloud/ocis:${OCIS_DOCKER_TAG:-latest}
    deploy:
      replicas: ${OCIS_SCALE:-1}
    networks:
      ocis-net:
    entrypoint:
      - ocis
      - web
      - server
    environment:
      WEB_LOG_LEVEL: "${OCIS_LOG_LEVEL:-error}"
      WEB_LOG_COLOR: "${OCIS_LOG_COLOR:-false}"
      WEB_LOG_PRETTY: "${OCIS_LOG_PRETTY:-false}"

      WEB_HTTP_ADDR: 0.0.0.0:9100

      WEB_OIDC_AUTHORITY: https://${OCIS_DOMAIN}
      WEB_UI_THEME_SERVER: https://${OCIS_DOMAIN}
      WEB_UI_CONFIG_SERVER: https://${OCIS_DOMAIN}
      WEB_OIDC_METADATA_URL: https://${OCIS_DOMAIN}/.well-known/openid-configuration
    logging:
      driver: "local"
    restart: always

  webdav:
    image: owncloud/ocis:${OCIS_DOCKER_TAG:-latest}
    deploy:
      replicas: ${OCIS_SCALE:-1}
    networks:
      ocis-net:
    entrypoint:
      - ocis
      - webdav
      - server
    environment:
      WEBDAV_LOG_LEVEL: "${OCIS_LOG_LEVEL:-error}"
      WEBDAV_LOG_COLOR: "${OCIS_LOG_COLOR:-false}"
      WEBDAV_LOG_PRETTY: "${OCIS_LOG_PRETTY:-false}"

      WEBDAV_HTTP_ADDR: 0.0.0.0:9115

      OCIS_PUBLIC_URL: https://${OCIS_DOMAIN}
      REVA_GATEWAY: gateway:9142
    logging:
      driver: "local"
    restart: always

  graph:
    image: owncloud/ocis:${OCIS_DOCKER_TAG:-latest}
    deploy:
      replicas: ${OCIS_SCALE:-1}
    networks:
      ocis-net:
    entrypoint:
      - ocis
      - graph
      - server
    environment:
      GRAPH_LOG_LEVEL: "${OCIS_LOG_LEVEL:-error}"
      GRAPH_LOG_COLOR: "${OCIS_LOG_COLOR:-false}"
      GRAPH_LOG_PRETTY: "${OCIS_LOG_PRETTY:-false}"

      GRAPH_HTTP_ADDR: 0.0.0.0:9120
      GRAPH_SPACES_WEBDAV_BASE: https://${OCIS_DOMAIN}

      GRAPH_LDAP_URI: ldaps://idm:9235
      GRAPH_LDAP_BIND_PASSWORD: ${IDM_SVC_PASSWORD}
      GRAPH_LDAP_INSECURE: true # TODO: fix me https://github.com/owncloud/ocis/issues/3818
      REVA_GATEWAY: gateway:9142

      GRAPH_EVENTS_ENDPOINT: nats:9233

      GRAPH_JWT_SECRET: ${OCIS_JWT_SECRET}

    logging:
      driver: "local"
    restart: always

  storage-system:
    image: owncloud/ocis:${OCIS_DOCKER_TAG:-latest}
    deploy:
      replicas: ${OCIS_SCALE:-1}
    networks:
      ocis-net:
    entrypoint:
      - ocis
      - storage-system
      - server
    environment:
      STORAGE_SYSTEM_LOG_LEVEL: "${OCIS_LOG_LEVEL:-error}"
      STORAGE_SYSTEM_LOG_COLOR: "${OCIS_LOG_COLOR:-false}"
      STORAGE_SYSTEM_LOG_PRETTY: "${OCIS_LOG_PRETTY:-false}"

      STORAGE_SYSTEM_DATAPROVIDER_INSECURE: "${INSECURE:-false}"

      STORAGE_SYSTEM_GRPC_ADDR: 0.0.0.0:9215
      STORAGE_SYSTEM_HTTP_ADDR: 0.0.0.0:9216
      STORAGE_SYSTEM_DATA_SERVER_URL: http://storage-system:9216/data

      STORAGE_SYSTEM_JWT_SECRET: ${STORAGE_SYSTEM_JWT_SECRET}

      OCIS_SYSTEM_USER_ID: ${SYSTEM_USER_ID}
      STORAGE_SYSTEM_DRIVER: ocis

      OCIS_SYSTEM_USER_API_KEY: ${SYSTEM_USER_API_KEY}

      REVA_GATEWAY: gateway:9142
    volumes:
      - "ocis-storage-system:/var/lib/ocis"
    logging:
      driver: "local"
    restart: always

  auth-basic:
    image: owncloud/ocis:${OCIS_DOCKER_TAG:-latest}
    deploy:
      replicas: ${OCIS_SCALE:-1}
    networks:
      ocis-net:
    entrypoint:
      - ocis
      - auth-basic
      - server
    environment:
      AUTH_BASIC_LOG_LEVEL: "${OCIS_LOG_LEVEL:-error}"
      AUTH_BASIC_LOG_COLOR: "${OCIS_LOG_COLOR:-false}"
      AUTH_BASIC_LOG_PRETTY: "${OCIS_LOG_PRETTY:-false}"

      AUTH_BASIC_GRPC_ADDR: 0.0.0.0:9146
      REVA_GATEWAY: gateway:9142
      STORAGE_AUTH_BASIC_ENDPOINT: auth-basic:9146

      AUTH_BASIC_JWT_SECRET: ${OCIS_JWT_SECRET}

      AUTH_BASIC_LDAP_URI: ldaps://idm:9235
      AUTH_BASIC_LDAP_CACERT: ""
      AUTH_BASIC_LDAP_INSECURE: "true"
      AUTH_BASIC_LDAP_BIND_PASSWORD: ${IDM_REVASVC_PASSWORD}
      AUTH_BASIC_IDP_URL: https://${OCIS_DOMAIN}

    logging:
      driver: "local"
    restart: always

  auth-machine:
    image: owncloud/ocis:${OCIS_DOCKER_TAG:-latest}
    deploy:
      replicas: ${OCIS_SCALE:-1}
    networks:
      ocis-net:
    entrypoint:
      - ocis
      - auth-machine
      - server
    environment:
      AUTH_MACHINE_LOG_LEVEL: "${OCIS_LOG_LEVEL:-error}"
      AUTH_MACHINE_LOG_COLOR: "${OCIS_LOG_COLOR:-false}"
      AUTH_MACHINE_LOG_PRETTY: "${OCIS_LOG_PRETTY:-false}"

      AUTH_MACHINE_GRPC_ADDR: 0.0.0.0:9166

      AUTH_MACHINE_JWT_SECRET: ${OCIS_JWT_SECRET}
      AUTH_MACHINE_API_KEY: ${OCIS_MACHINE_AUTH_API_KEY}
      REVA_GATEWAY: gateway:9142
    logging:
      driver: "local"
    restart: always

  auth-bearer:
    image: owncloud/ocis:${OCIS_DOCKER_TAG:-latest}
    deploy:
      replicas: ${OCIS_SCALE:-1}
    networks:
      ocis-net:
    entrypoint:
      - ocis
      - auth-bearer
      - server
    environment:
      AUTH_BEARER_LOG_LEVEL: "${OCIS_LOG_LEVEL:-error}"
      AUTH_BEARER_LOG_COLOR: "${OCIS_LOG_COLOR:-false}"
      AUTH_BEARER_LOG_PRETTY: "${OCIS_LOG_PRETTY:-false}"

      AUTH_BEARER_GRPC_ADDR: 0.0.0.0:9148

      AUTH_BEARER_JWT_SECRET: ${OCIS_JWT_SECRET}
      REVA_GATEWAY: gateway:9142
      AUTH_BEARER_OIDC_ISSUER: https://${OCIS_DOMAIN}

    logging:
      driver: "local"
    restart: always

  storage-shares:
    image: owncloud/ocis:${OCIS_DOCKER_TAG:-latest}
    deploy:
      replicas: ${OCIS_SCALE:-1}
    networks:
      ocis-net:
    entrypoint:
      - ocis
      - storage-shares
      - server
    environment:
      STORAGE_SHARES_LOG_LEVEL: "${OCIS_LOG_LEVEL:-error}"
      STORAGE_SHARES_LOG_COLOR: "${OCIS_LOG_COLOR:-false}"
      STORAGE_SHARES_LOG_PRETTY: "${OCIS_LOG_PRETTY:-false}"

      STORAGE_SHARES_GRPC_ADDR: 0.0.0.0:9154

      STORAGE_SHARES_USER_SHARE_PROVIDER_ENDPOINT: sharing:9150

      STORAGE_SHARES_JWT_SECRET: ${OCIS_JWT_SECRET}
      REVA_GATEWAY: gateway:9142
    logging:
      driver: "local"
    restart: always

  storage-users:
    image: owncloud/ocis:${OCIS_DOCKER_TAG:-latest}
    deploy:
      replicas: ${OCIS_SCALE:-1}
    networks:
      ocis-net:
    entrypoint:
      - ocis
      - storage-users
      - server
    environment:
      STORAGE_USERS_LOG_LEVEL: "${OCIS_LOG_LEVEL:-error}"
      STORAGE_USERS_LOG_COLOR: "${OCIS_LOG_COLOR:-false}"
      STORAGE_USERS_LOG_PRETTY: "${OCIS_LOG_PRETTY:-false}"

      STORAGE_USERS_DATAPROVIDER_INSECURE: "${INSECURE:-false}"

      STORAGE_USERS_DRIVER: ocis

      STORAGE_USERS_GRPC_ADDR: 0.0.0.0:9157
      STORAGE_USERS_HTTP_ADDR: 0.0.0.0:9158

      STORAGE_USERS_DATA_SERVER_URL: http://storage-users:9158/data

      STORAGE_USERS_PERMISSION_ENDPOINT: settings:9191
      STORAGE_USERS_EVENTS_ENDPOINT: nats:9233

      REVA_GATEWAY: gateway:9142

      STORAGE_USERS_JWT_SECRET: ${OCIS_JWT_SECRET}

    volumes:
      - "ocis-storage-users:/var/lib/ocis"
    logging:
      driver: "local"
    restart: always

  storage-publiclink:
    image: owncloud/ocis:${OCIS_DOCKER_TAG:-latest}
    deploy:
      replicas: ${OCIS_SCALE:-1}
    networks:
      ocis-net:
    entrypoint:
      - ocis
      - storage-publiclink
      - server
    environment:
      STORAGE_PUBLICLINK_LOG_LEVEL: "${OCIS_LOG_LEVEL:-error}"
      STORAGE_PUBLICLINK_LOG_COLOR: "${OCIS_LOG_COLOR:-false}"
      STORAGE_PUBLICLINK_LOG_PRETTY: "${OCIS_LOG_PRETTY:-false}"

      STORAGE_PUBLICLINK_GRPC_ADDR: 0.0.0.0:9178

      STORAGE_PUBLICLINK_JWT_SECRET: ${OCIS_JWT_SECRET}
      REVA_GATEWAY: gateway:9142
    logging:
      driver: "local"
    restart: always

  sharing:
    image: owncloud/ocis:${OCIS_DOCKER_TAG:-latest}
    deploy:
      replicas: 1
    networks:
      ocis-net:
    entrypoint:
      - ocis
      - sharing
      - server
    environment:
      SHARING_LOG_LEVEL: "${OCIS_LOG_LEVEL:-error}"
      SHARING_LOG_COLOR: "${OCIS_LOG_COLOR:-false}"
      SHARING_LOG_PRETTY: "${OCIS_LOG_PRETTY:-false}"

      SHARING_GRPC_ADDR: 0.0.0.0:9150

      SHARING_EVENTS_ENDPOINT: nats:9233

      SHARING_JWT_SECRET: ${OCIS_JWT_SECRET}
      REVA_GATEWAY: gateway:9142

      SHARING_USER_DRIVER: json
      SHARING_PUBLIC_DRIVER: json
    volumes:
      - "ocis-sharing:/var/lib/ocis"
    logging:
      driver: "local"
    restart: always

  users:
    image: owncloud/ocis:${OCIS_DOCKER_TAG:-latest}
    deploy:
      replicas: ${OCIS_SCALE:-1}
    networks:
      ocis-net:
    entrypoint:
      - ocis
      - users
      - server
    environment:
      USERS_LOG_LEVEL: "${OCIS_LOG_LEVEL:-error}"
      USERS_LOG_COLOR: "${OCIS_LOG_COLOR:-false}"
      USERS_LOG_PRETTY: "${OCIS_LOG_PRETTY:-false}"

      USERS_GRPC_ADDR: 0.0.0.0:9144
      USERS_LDAP_URI: ldaps://idm:9235
      USERS_LDAP_CACERT: ""
      USERS_LDAP_INSECURE: ${INSECURE:-true}
      USERS_LDAP_BIND_PASSWORD: ${IDM_REVASVC_PASSWORD}
      USERS_IDP_URL: https://${OCIS_DOMAIN}

      REVA_GATEWAY: gateway:9142

      USERS_JWT_SECRET: ${OCIS_JWT_SECRET}
    logging:
      driver: "local"
    restart: always

  groups:
    image: owncloud/ocis:${OCIS_DOCKER_TAG:-latest}
    deploy:
      replicas: ${OCIS_SCALE:-1}
    networks:
      ocis-net:
    entrypoint:
      - ocis
      - groups
      - server
    environment:
      GROUPS_LOG_LEVEL: "${OCIS_LOG_LEVEL:-error}"
      GROUPS_LOG_COLOR: "${OCIS_LOG_COLOR:-false}"
      GROUPS_LOG_PRETTY: "${OCIS_LOG_PRETTY:-false}"

      GROUPS_GRPC_ADDR: 0.0.0.0:9160

      GROUPS_LDAP_URI: ldaps://idm:9235
      GROUPS_LDAP_CACERT: ""
      GROUPS_LDAP_INSECURE: ${INSECURE:-true}
      GROUPS_LDAP_BIND_PASSWORD: ${IDM_REVASVC_PASSWORD}
      GROUPS_IDP_URL: https://${OCIS_DOMAIN}

      REVA_GATEWAY: gateway:9142

      GROUPS_JWT_SECRET: ${OCIS_JWT_SECRET}
    logging:
      driver: "local"
    restart: always

  frontend:
    image: owncloud/ocis:${OCIS_DOCKER_TAG:-latest}
    deploy:
      replicas: ${OCIS_SCALE:-1}
    networks:
      ocis-net:
    entrypoint:
      - ocis
      - frontend
      - server
    environment:
      FRONTEND_LOG_LEVEL: "${OCIS_LOG_LEVEL:-error}"
      FRONTEND_LOG_COLOR: "${OCIS_LOG_COLOR:-false}"
      FRONTEND_LOG_PRETTY: "${OCIS_LOG_PRETTY:-false}"

      FRONTEND_HTTP_ADDR: 0.0.0.0:9140
      FRONTEND_PUBLIC_URL: https://${OCIS_DOMAIN}

      FRONTEND_JWT_SECRET: ${OCIS_JWT_SECRET}
      REVA_GATEWAY: gateway:9142
      FRONTEND_MACHINE_AUTH_API_KEY: ${OCIS_MACHINE_AUTH_API_KEY}
      STORAGE_TRANSFER_SECRET: ${STORAGE_TRANSFER_SECRET}

    logging:
      driver: "local"
    restart: always

  gateway:
    image: owncloud/ocis:${OCIS_DOCKER_TAG:-latest}
    deploy:
      replicas: ${OCIS_SCALE:-1}
    networks:
      ocis-net:
    entrypoint:
      - ocis
      - gateway
      - server
    environment:
      GATEWAY_LOG_LEVEL: "${OCIS_LOG_LEVEL:-error}"
      GATEWAY_LOG_COLOR: "${OCIS_LOG_COLOR:-false}"
      GATEWAY_LOG_PRETTY: "${OCIS_LOG_PRETTY:-false}"

      GATEWAY_GRPC_ADDR: 0.0.0.0:9142

      GATEWAY_FRONTEND_PUBLIC_URL: https://${OCIS_DOMAIN}

      GATEWAY_USERS_ENDPOINT: users:9144
      GATEWAY_GROUPS_ENDPOINT: groups:9160
      GATEWAY_AUTH_BASIC_ENDPOINT: auth-basic:9146
      GATEWAY_AUTH_BEARER_ENDPOINT: auth-bearer:9148
      GATEWAY_AUTH_MACHINE_ENDPOINT: auth-machine:9166
      GATEWAY_PERMISSIONS_ENDPOINT: settings:9191
      GATEWAY_SHARING_ENDPOINT: sharing:9150
      GATEWAY_STORAGE_PUBLIC_LINK_ENDPOINT: storage-publiclink:9178
      GATEWAY_STORAGE_USERS_ENDPOINT: storage-users:9157
      GATEWAY_STORAGE_SHARES_ENDPOINT: storage-shares:9154
      GATEWAY_APP_REGISTRY_ENDPOINT: app-registry:9242

      GATEWAY_JWT_SECRET: ${OCIS_JWT_SECRET}
      STORAGE_TRANSFER_SECRET: ${STORAGE_TRANSFER_SECRET}
    logging:
      driver: "local"
    restart: always
