version: '2.1'

services:
  agent-kea-premium-one:
    restart: always
    build:
      context: .
      dockerfile: docker/images/stork.Dockerfile
      target: kea
      args:
        KEA_REPO: ${CS_REPO_ACCESS_TOKEN}/isc/kea-dev-prv
        KEA_PREMIUM: "premium"
    extra_hosts:
      - "agent-kea-premium-one:172.24.0.103"
    image: registry.gitlab.isc.org/isc-private/stork/agent-kea-premium-one:latest
    hostname: agent-kea-premium-one
    networks:
      storknet:
        ipv4_address: 172.24.0.103
        priority: 1000
      subnet-03:
        ipv4_address: 172.103.0.100
        priority: 500
    expose:
      - "8881" # stork server to agent
    ports:
      - "8881:8881" # publish ports for development purposes
    environment:
      DB_TYPE: mysql
      DB_HOST: mariadb
      DB_USER: agent_kea_premium_one
      DB_PASSWORD: agent_kea_premium_one
      DB_ROOT_USER: root
      DB_ROOT_PASSWORD: root
      DB_NAME: agent_kea_premium_one
      STORK_AGENT_SERVER_URL: ${STORK_SERVER_URL-http://server:8080}
      STORK_AGENT_HOST: agent-kea-premium-one
      STORK_AGENT_PORT: "8881"
    volumes:
      - ./docker/config/agent-kea/kea-ctrl-agent.conf:/etc/kea/kea-ctrl-agent.conf
      - ./docker/config/agent-kea-premium-one/kea-dhcp4.conf:/etc/kea/kea-dhcp4.conf
      - ./docker/config/agent-kea-premium-one/kea-dhcp6.conf:/etc/kea/kea-dhcp6.conf
      - ./docker/config/agent-kea-premium-one/init_mysql_query.sql:/var/lib/db/init_mysql_query.sql
      - ./docker/config/supervisor/supervisord.conf:/etc/supervisor/supervisord.conf
      - ./docker/config/supervisor/kea-agent.conf:/etc/supervisor/conf.d/kea-agent.conf
      - ./docker/config/supervisor/kea-dhcp4.conf:/etc/supervisor/conf.d/kea-dhcp4.conf
      - ./docker/config/supervisor/kea-dhcp6.conf:/etc/supervisor/conf.d/kea-dhcp6.conf
      - ./docker/config/supervisor/stork-agent.conf:/etc/supervisor/conf.d/stork-agent.conf
      - ./docker/config/supervisor/prometheus.conf:/etc/supervisor/conf.d/prometheus.conf
      - ./docker/config/supervisor/supervisor_monitor.conf:/etc/supervisor/conf.d/supervisor_monitor.conf
      - ./docker/tools/supervisor_monitor.py:/usr/lib/supervisor_monitor.py
    depends_on:
      - mariadb

  agent-kea-premium-two:
    restart: always
    build:
      context: .
      dockerfile: docker/images/stork.Dockerfile
      target: kea
      args:
        KEA_REPO: ${CS_REPO_ACCESS_TOKEN}/isc/kea-dev-prv
        KEA_PREMIUM: "premium"
    image: registry.gitlab.isc.org/isc-private/stork/agent-kea-premium-two:latest
    hostname: agent-kea-premium-two
    networks:
      storknet:
        ipv4_address: 172.24.0.104
    expose:
      - "8889" # stork server to agent
    ports:
      - "8889:8889" # publish ports for development purposes
    environment:
      DB_TYPE: mysql
      DB_HOST: mariadb
      DB_USER: agent_kea_premium_two
      DB_PASSWORD: agent_kea_premium_two
      DB_ROOT_USER: root
      DB_ROOT_PASSWORD: root
      DB_NAME: agent_kea_premium_two
      STORK_AGENT_SERVER_URL: ${STORK_SERVER_URL-http://server:8080}
      STORK_AGENT_HOST: agent-kea-premium-two
      STORK_AGENT_PORT: "8889"
    volumes:
      - ./docker/config/agent-kea/kea-ctrl-agent.conf:/etc/kea/kea-ctrl-agent.conf
      - ./docker/config/agent-kea-premium-two/kea-dhcp4.conf:/etc/kea/kea-dhcp4.conf
      - ./docker/config/agent-kea-premium-two/kea-dhcp6.conf:/etc/kea/kea-dhcp6.conf
      - ./docker/config/agent-kea-premium-two/init_mysql_query.sql:/var/lib/db/init_mysql_query.sql
      - ./docker/config/supervisor/supervisord.conf:/etc/supervisor/supervisord.conf
      - ./docker/config/supervisor/kea-agent.conf:/etc/supervisor/conf.d/kea-agent.conf
      - ./docker/config/supervisor/kea-dhcp4.conf:/etc/supervisor/conf.d/kea-dhcp4.conf
      - ./docker/config/supervisor/kea-dhcp6.conf:/etc/supervisor/conf.d/kea-dhcp6.conf
      - ./docker/config/supervisor/stork-agent.conf:/etc/supervisor/conf.d/stork-agent.conf
      - ./docker/config/supervisor/prometheus.conf:/etc/supervisor/conf.d/prometheus.conf
      - ./docker/config/supervisor/supervisor_monitor.conf:/etc/supervisor/conf.d/supervisor_monitor.conf
      - ./docker/tools/supervisor_monitor.py:/usr/lib/supervisor_monitor.py
    depends_on:
      - mariadb
