services:
  tms:
    image: cherrydh/tms:latest
    ports:
      - "5000:8080"
      - "5001:8081"
      - "4742:4742/udp"
    volumes:
      - ./cert:/root/.aspnet/https
      - app:/app
    networks:
      - network1
    environment:
      - ASPNETCORE_URLS=https://+:8081;http://+:8080
      - ASPNETCORE_HTTPS_PORT=5001
      - ASPNETCORE_Kestrel__Certificates__Default__Path=/root/.aspnet/https/certificate.pfx
      - ASPNETCORE_Kestrel__Certificates__Default__Password=Cherry2025!
      - TMS_DB_CONNECTION=Server=sql_server2022;Database=TMS.Konnektor;User Id=sa;Password=Cherry2025!;MultipleActiveResultSets=true;trustServerCertificate=true;
      # Postgres-DB lediglich auskommentieren und sql_server2022 einkommentieren
      #- TMS_DB_CONNECTION=Host=postgres;Port=5432;Database=TMS.Konnektor;Username=TMS.Konnektor;Password=Cherry2025!;
      - SERILOG_LOG_FILE_PATH=/usr/tms.konnektor/logs/TMSService.log
      #- EmailSender.FromName=TMS
      #- EmailSender.FromEmail=yourmail@address.de
      #- EmailSender.Host=smtp-mail.outlook.com      
      #- EmailSender.Port=587
      #- EmailSender.UserName=yourmail@address.de
      #- EmailSender.EnableSSL=3 
      #- EmailSender.Password=yourPassword
      - Installation=Demo Testcenter
      - Kundenkennung=Cherry
      - Kundenschluessel=MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA7iZZezzNyDzykuSt5S8O20oBZDu0iBwQUWFQlFPwAPGP1PLp7MUC3PIcCPBB9PcED4MZV+gy2R1Z5TWYSxv/QGlErd8YgoIrPo2RXd/kfLXGlp2cOufX/k2GPcS1nQYkAY8OjKMGvLu7pG8RpJdSHNP1szzT5xCYYWEXVby+MljoFqTsezrMlEjBPnHIsg3mjVgXDgqI2RJ5nc5N7fZX3hjQOxFhbn/F6jzGdrKqKmj6ayeMUhwCMG42IcBKj32FIMsmyxOuiEHpBXfiQQpPoCxfiejWd1VEtKKEu7wxmEsGNLYJUGCdw57i+Je4d+vBMePabx9nct8l7odFTpkMvQIDAQAB 
      - Migrations_Aktiv=Ja 
      - Migrations_Dateien=1.8.6-V1_DatenbankErzeugen.sql;1.8.6-V2_TabellenErzeugen.sql;1.8.6-V3-ErzeugeBenutzer.sql;2.4.7-V4-AddActive.sql;2.4.30-V5-AddNewColumnsKonnektorKarte.sql;2.4.30-V6-AddNewColumnEreignisaktion.sql
    depends_on: 
      postgres:
        condition: service_healthy
      sql:
        condition: service_healthy
      
  postgres:
   image: postgres:15
   container_name: postgres_db
   environment:
     POSTGRES_USER: TMS.Konnektor
     POSTGRES_PASSWORD: _Cherry2025!
     POSTGRES_DB: TMS.Konnektor
     POSTGRES_HOST_AUTH_METHOD: trust
   expose:
     - "5432"
   ports:
     - 5432:5432
   volumes:
     - postgres_data:/var/lib/postgresql/data
   hostname: postgres
   healthcheck:
      test: ["CMD-SHELL", "pg_isready"]
      interval: 5s
      timeout: 5s
      retries: 5
   networks:
     - network1

  pgadmin:
   image: dpage/pgadmin4
   container_name: pgadmin4
   ports:
     - 5454:5454/tcp
   hostname: pgadmin
   environment:
     - POSTGRES_HOST_AUTH_METHOD=trust
     - PGADMIN_DEFAULT_EMAIL=kms@cherry.de
     - PGADMIN_DEFAULT_PASSWORD=_Cherry2025!
     - PGADMIN_LISTEN_PORT=5454
   networks:
     - network1

  sql:
    image: "mcr.microsoft.com/mssql/server:2022-latest"
    container_name: sql_server2022
    ports:
      - "1433:1433"
    environment:
      - ACCEPT_EULA=y
      - MSSQL_SA_PASSWORD=Cherry2025!
    healthcheck:
      test: ["CMD-SHELL", "/opt/mssql-tools18/bin/sqlcmd -U sa -P Cherry2025! -Q 'SELECT 1' -C || exit 1"]
      interval: 10s
      timeout: 5s
      retries: 5
    volumes:
      - sqlserver:/var/opt/mssql
    networks:
      - network1

networks:
    network1:

volumes:
  sqlserver:
    driver: local
  app:
    driver: local
  postgres_data:
    driver: local