version: "3.7"

services:
  mtba:
    image: docker.verbis.dkfz.de/cache/samply/mtba:develop
    container_name: bridgehead-mtba
    environment:
      BLAZE_STORE_URL: http://blaze:8080
      # NOTE: Aktuell Berechtigungen wie MagicPL!!!
      # TODO: Add separate ApiKey to MagicPL only for MTBA!
      ID_MANAGER_API_KEY: ${IDMANAGER_UPLOAD_APIKEY}
      ID_MANAGER_PSEUDONYM_ID_TYPE: BK_${IDMANAGEMENT_FRIENDLY_ID}_L-ID
      ID_MANAGER_URL: http://id-manager:8080/id-manager
      PATIENT_CSV_FIRST_NAME_HEADER: ${MTBA_PATIENT_CSV_FIRST_NAME_HEADER:-FIRST_NAME}
      PATIENT_CSV_LAST_NAME_HEADER: ${MTBA_PATIENT_CSV_LAST_NAME_HEADER:-LAST_NAME}
      PATIENT_CSV_GENDER_HEADER: ${MTBA_PATIENT_CSV_GENDER_HEADER:-GENDER}
      PATIENT_CSV_BIRTHDAY_HEADER: ${MTBA_PATIENT_CSV_BIRTHDAY_HEADER:-BIRTHDAY}
      CBIOPORTAL_URL:  http://cbioportal:8080
      FILE_CHARSET: ${MTBA_FILE_CHARSET:-UTF-8}
      FILE_END_OF_LINE: ${MTBA_FILE_END_OF_LINE:-LF}
      CSV_DELIMITER: ${MTBA_CSV_DELIMITER:-TAB}
      HTTP_RELATIVE_PATH: "/mtba"
      OIDC_ADMIN_GROUP: "${OIDC_ADMIN_GROUP}"
      OIDC_CLIENT_ID: "${OIDC_PRIVATE_CLIENT_ID}"
      OIDC_CLIENT_SECRET: "${OIDC_CLIENT_SECRET}"
      OIDC_REALM: "${OIDC_REALM}"
      OIDC_URL: "${OIDC_URL}"

    labels:
      - "traefik.enable=true"
      - "traefik.http.routers.mtba_ccp.rule=PathPrefix(`/mtba`)"
      - "traefik.http.services.mtba_ccp.loadbalancer.server.port=8480"
      - "traefik.http.routers.mtba_ccp.tls=true"

    volumes:
      - /var/cache/bridgehead/ccp/mtba/input:/app/input
      - /var/cache/bridgehead/ccp/mtba/persist:/app/persist

  # TODO: Include CBioPortal in Deployment ...
  # NOTE: CBioPortal can't load data while the system is running. So after import of data bridgehead needs to be restarted!
  # TODO: Find a trigger to let mtba signal a restart for CBioPortal

volumes:
  mtba-data:
