version: '2'

services:
    postgresql:
        build: ./postgresql
        container_name: pdns-postgresql
#        restart: unless-stopped
        networks:
            pdns.internal.docker:
                aliases:
                    - postgresql.pdns.internal.docker
        volumes:
            - ./data/postgresql/data:/var/lib/postgresql/data
            - ./data/postgresql/backup:/var/lib/postgresql/backup
        ports:
            - "127.0.0.1:34020:5432"
        env_file:
            - env

    poweradmin:
        build: ./poweradmin
        container_name: pdns-poweradmin
#        restart: unless-stopped
        networks:
            pdns.internal.docker:
                aliases:
                    - poweradmin.pdns.internal.docker
        ports:
            - "127.0.0.1:34021:80"
        env_file:
            - env

    pdns:
        build: ./pdns
        container_name: pdns-pdns
#        restart: unless-stopped
        networks:
            pdns.internal.docker:
                aliases:
                    - pdns.pdns.internal.docker
        ports:
            - "0.0.0.0:53:53/udp"
            - "0.0.0.0:53:53/tcp"
            - "127.0.0.1:34022:80"
        env_file:
            - env

    pdns-recursor:
        build: ./pdns-recursor
        container_name: pdns-pdns-recursor
#        restart: unless-stopped
        networks:
            pdns.internal.docker:
                aliases:
                    - pdns-recursor.pdns.internal.docker
        env_file:
            - env

    postgresql-slave1:
        build: ./postgresql
        container_name: pdns-postgresql-slave1
#        restart: unless-stopped
        networks:
            pdns.internal.docker:
                aliases:
                    - postgresql-slave1.pdns.internal.docker
        volumes:
            - ./data/postgresql-slave1/data:/var/lib/postgresql/data
            - ./data/postgresql-slave1/backup:/var/lib/postgresql/backup
        ports:
            - "127.0.0.1:34023:5432"
        env_file:
            - env
        environment:
            - POSTGRES_INDEX=SLAVE1

    postgresql-slave2:
        build: ./postgresql
        container_name: pdns-postgresql-slave2
#        restart: unless-stopped
        networks:
            pdns.internal.docker:
                aliases:
                    - postgresql-slave2.pdns.internal.docker
        volumes:
            - ./data/postgresql-slave2/data:/var/lib/postgresql/data
            - ./data/postgresql-slave2/backup:/var/lib/postgresql/backup
        ports:
            - "127.0.0.1:34024:5432"
        env_file:
            - env
        environment:
            - POSTGRES_INDEX=SLAVE2


networks:
    pdns.internal.docker:
