services:
    haproxy:
        image: "haproxy:${HAPROXY_VERSION}"
        container_name: "haproxy-${CONTEXT}"
        networks:
            haproxy-default:
        ulimits:
            nproc: ${ULIMIT_NPROC-65535}
            nofile:
                soft: ${ULIMIT_NPROC-65535}
                hard: ${ULIMIT_NPROC-65535}
        extends:
            file: common-settings.yml
            service: common-settings
        ports:
            - 80:80
            - 443:443
            - ${STATS_PORT}:${STATS_PORT}
            - ${GPS_PORT}:${GPS_PORT}
        volumes:
            - /opt/docker-data/haproxy-${CONTEXT}/haproxy/config/haproxy.cfg:/usr/local/etc/haproxy/haproxy.cfg
            - /opt/docker-data/haproxy-${CONTEXT}/haproxy/config/hosts.map:/usr/local/etc/haproxy/hosts.map
            - /opt/docker-data/haproxy-${CONTEXT}/haproxy/config/certs:/usr/local/etc/haproxy/certs
        environment:
            STATS_PORT: ${STATS_PORT}
            HEALTH_CHECK_USER_AGENT: "haproxy-${CONTEXT}"
networks:
    haproxy-default:
        name: haproxy-${CONTEXT}
        driver: bridge
        driver_opts:
            com.docker.network.enable_ipv6: "false"
        ipam:
            driver: default
            config:
                - subnet: ${SUBNET}