services:
    nginx:
        # FIXME Docker Hub image name with or without slash? FIXME
        image: "nginx:${NGINX_VERSION}"
        container_name: "nginx-nginx-${CONTEXT}"
        networks:
            nginx-default:
        profiles: ["full", "nginx"]
        depends_on:
            ping:
                condition: service_healthy
        ulimits:
            nproc: ${ULIMIT_NPROC-65535}
            nofile:
                soft: ${ULIMIT_NPROC-65535}
                hard: ${ULIMIT_NPROC-65535}
        extends:
            file: common-settings.yml
            service: common-settings
        ports:
            # - "8080:80"
        volumes:
            # When changing bind mount locations to real ones remember to
            # also update "Initial setup" section in README.md.
            # - /opt/docker-data/nginx-${CONTEXT}/nginx/data/db:/usr/lib/nginx
            # - /opt/docker-data/nginx-${CONTEXT}/nginx/data/logs:/var/log/nginx
            # - /opt/docker-data/nginx-${CONTEXT}/nginx/config:/etc/nginx
        environment:
            # NGINX_USER: ${NGINX_USER}
            # NGINX_PASSWORD: ${NGINX_PASSWORD}
    ping:
        # FIXME Docker Hub image name with or without slash? FIXME
        image: "ping:${PING_VERSION}"
        container_name: "nginx-ping-${CONTEXT}"
        networks:
            nginx-default:
        profiles: ["full", "ping"]
        healthcheck:
            test: ["CMD", "fping", "--count=1", "${NGINX_VIP}", "--period=500", "--quiet"]
            interval: 3s
            timeout: 1s
            retries: 60
            start_period: 2s
        ulimits:
            nproc: ${ULIMIT_NPROC-65535}
            nofile:
                soft: ${ULIMIT_NPROC-65535}
                hard: ${ULIMIT_NPROC-65535}
        extends:
            file: common-settings.yml
            service: common-settings
        ports:
            # - "8080:80"
        volumes:
            # When changing bind mount locations to real ones remember to
            # also update "Initial setup" section in README.md.
            # - /opt/docker-data/nginx-${CONTEXT}/ping/data/db:/usr/lib/ping
            # - /opt/docker-data/nginx-${CONTEXT}/ping/data/logs:/var/log/ping
            # - /opt/docker-data/nginx-${CONTEXT}/ping/config:/etc/ping
        environment:
            # PING_USER: ${PING_USER}
            # PING_PASSWORD: ${PING_PASSWORD}
networks:
    nginx-default:
        name: nginx-${CONTEXT}
        driver: bridge
        driver_opts:
            com.docker.network.enable_ipv6: "false"
        ipam:
            driver: default
            config:
                - subnet: ${SUBNET}