version: '3.4'


services:
  managing.api:
    environment:
      - ASPNETCORE_ENVIRONMENT=Oda-docker
      - ASPNETCORE_URLS=https://+:443;http://+:80
      - ASPNETCORE_Kestrel__Certificates__Default__Password=!Managing94
      - ASPNETCORE_Kestrel__Certificates__Default__Path=/app/managing_cert.pfx
      - RUN_ORLEANS_GRAINS=true
    ports:
      - "80:80"
      - "443:443"
      - "11111:11111"  # Orleans silo port
      - "30000:30000"  # Orleans gateway port
    volumes:
      - ${APPDATA}/Microsoft/UserSecrets:/root/.microsoft/usersecrets:ro
      - ${APPDATA}/ASP.NET/Https:/root/.aspnet/https:ro
      - /Users/oda/ASP.NET/Https:/root/.aspnet/https:ro
      - /Users/oda/Microsoft/UserSecrets:/root/.microsoft/usersecrets/$USER_SECRETS_ID
    depends_on:
      - postgres
      - influxdb

  postgres:
    image: postgres:17.5
    volumes:
      - postgresdata:/var/lib/postgresql/data
    ports:
      - "5432:5432"
    restart: always
    networks:
      - managing-network
    environment:
      - POSTGRES_USER=postgres
      - POSTGRES_PASSWORD=postgres
      - POSTGRES_DB=managing
       
  influxdb:
    image: influxdb:latest
    volumes:
      - influxdata:/var/lib/influxdb2
    ports:
      - 8086:8086
    restart: always

  redis:
    image: redis:8.0.3
    ports:
      - "6379:6379"
    volumes:
      - redis_data:/data
    networks:
      - managing-network
    restart: unless-stopped
    environment:
      - REDIS_PASSWORD=
    command: >
      sh -c "
        if [ -n \"$$REDIS_PASSWORD\" ]; then
          redis-server --appendonly yes --requirepass $$REDIS_PASSWORD
          redis-cli -a $$REDIS_PASSWORD
        else
          redis-server --appendonly yes
          redis-cli
        fi
      "SuperSecretPassword