version: "3"
services:
  bot:
    image: pluralkit # This image is reused in the other containers due to the
    build: .         # build instruction right here
    command: ["PluralKit.Bot.dll"]
    environment:
      - "PluralKit:Database=Host=db;Username=postgres;Password=postgres;Database=postgres;Maximum Pool Size=1000"
      - "PluralKit:InfluxUrl=http://influx:8086"
      - "PluralKit:InfluxDb=pluralkit"
      - "PluralKit:LogDir=/var/log/pluralkit"
    volumes:
      - "./pluralkit.conf:/app/pluralkit.conf:ro"
      - "/var/log/pluralkit:/var/log/pluralkit"
    links:
      - db
      - influx
    restart: always
  api:
    image: pluralkit
    command: ["PluralKit.API.dll"]
    environment:
      - "PluralKit:Database=Host=db;Username=postgres;Password=postgres;Database=postgres;Maximum Pool Size=1000"
    links:
      - db
    ports:
      - "127.0.0.1:2838:5000"
    restart: always
  db:
    image: postgres:11-alpine
    volumes:
      - "db_data:/var/lib/postgresql/data"
    restart: always
    command: ["postgres", "-c", "max-connections=1000"]
    environment:
      - "POSTGRES_PASSWORD=postgres"
  influx:
    image: influxdb:alpine
    volumes:
      - "influx_data:/var/lib/influxdb"
    ports:
      - 2839:8086
    restart: always

volumes:
  db_data:
  influx_data:
