version: '3.9'
networks:
  maps-service-network:
    driver: bridge

services:
  nats:
    image: docker.io/nats:latest
    container_name: nats
    command: ["-js"] #"-DVV"
    networks:
      - maps-service-network

  submissions:
    image:
      maps-service-submissions
    container_name: submissions
    command: [
      # debug
      "--debug","serve",
      # http service port
      "--port","8082",
      # internal http endpoints
      "--port-internal","8083",
      # postgres
      "--pg-host","10.0.0.29",
      "--pg-port","5432",
      "--pg-db","maps",
      "--pg-user","quat",
      "--pg-password","happypostgresuser",
      # other hosts
      "--nats-host","nats:4222",
      "--auth-rpc-host","authrpc:8081",
      "--data-rpc-host","dataservice:9000",
    ]
    depends_on:
      - authrpc
      - nats
    networks:
      - maps-service-network
    ports:
      - "8082:8082"

  web:
    image:
      maps-service-web
    networks:
      - maps-service-network
    ports:
      - "3000:3000"

  validation:
    image:
      maps-service-validation
    container_name: validation
    env_file:
      - ../auth-compose/strafesnet_staging.env
    environment:
      - ROBLOX_GROUP_ID=17032139 # "None" is special case string value
      - API_HOST_INTERNAL=http://submissions:8083
      - NATS_HOST=nats:4222
    depends_on:
      - nats
      # note: this races the submissions which creates a nats stream
      # the validation will panic if the nats stream is not created
      - submissions
      - dataservice
    networks:
      - maps-service-network

  dataservice:
    image: registry.itzana.me/strafesnet/data-service:master
    container_name: dataservice
    environment:
      - DEBUG=true
      - PG_HOST=10.0.0.29
      - PG_PORT=5432
      - PG_USER=quat
      - PG_DB=data
      - PG_PASS=happypostgresuser
    networks:
      - maps-service-network

  authredis:
    image: docker.io/redis:latest
    container_name: authredis
    volumes:
      - redis-data:/data
    command: ["redis-server", "--appendonly", "yes"]
    networks:
      - maps-service-network

  authrpc:
    image: registry.itzana.me/strafesnet/auth-service:master
    container_name: authrpc
    command: ["serve", "rpc"]
    environment:
      - REDIS_ADDR=authredis:6379
    env_file:
      - ../auth-compose/auth-service.env
    depends_on:
      - authredis
    networks:
      - maps-service-network
    logging:
      driver: "none"

  auth-web:
    image: registry.itzana.me/strafesnet/auth-service:master
    command: ["serve", "web"]
    environment:
      - REDIS_ADDR=authredis:6379
    env_file:
      - ../auth-compose/auth-service.env
    depends_on:
      - authredis
    networks:
      - maps-service-network
    ports:
      - "8080:8080"

volumes:
  redis-data: