services:

##########################################
##
## hosting / networking
##
##########################################

    hosting-proxy:

        container_name: hosting-proxy

        image: softwareshinobi/docker-container-proxy

        restart: unless-stopped

        volumes:

            - /var/run/docker.sock:/tmp/docker.sock:ro

            - /var/docker/nginx/html:/usr/share/nginx/html

            - /var/docker/nginx/certs:/etc/nginx/certs

            - /var/docker/nginx/vhost:/etc/nginx/vhost.d

        ports:

            - 33080:80

            - 33443:443

        logging:

            options:

                max-size: "10m"

                max-file: "3"

    hosting-letsencrypt:

        container_name: hosting-letsencrypt

        image: jrcs/letsencrypt-nginx-proxy-companion

        restart: unless-stopped

        volumes_from:

            - hosting-proxy

        volumes:

            - /var/run/docker.sock:/var/run/docker.sock

            - /var/docker/nginx/acme:/etc/acme.sh

        environment:

            DEFAULT_EMAIL: troy@softwareshinobi.com

##########################################
##
## hosting / relational data
##
##########################################

    card-players-unite-postgres:

        container_name: card-players-unite-postgres

        image: postgres:14.1-alpine

        restart: unless-stopped

        ports:

            - 5432:5432

        environment:

            - POSTGRES_DB=maverickdb

            - POSTGRES_USER=maverickdb

            - POSTGRES_PASSWORD=maverickdb

        volumes:

            - /tmp/volume-data-postgres:/var/lib/postgresql/data

        healthcheck:

            test: ["CMD-SHELL", "pg_isready -U maverickdb -d maverickdb"]
            interval: 5s
            timeout: 5s
            retries: 5

    card-players-unite-pgadmin:
        user: root  # Or your specific UID:GID
        container_name: card-players-unite-pgadmin

        image: dpage/pgadmin4

        depends_on:
            card-players-unite-postgres:
                condition: service_healthy # THIS TELLS DOCKER TO WAIT FOR THE HEALTHCHECK

        ports:

            - 5480:80

        volumes:

            - /tmp/volumes/pgadmin4444:/var/lib/pgadmin

        environment:

            PGADMIN_DEFAULT_EMAIL: lorem@loremipsum.com

            PGADMIN_DEFAULT_PASSWORD: maverickdb

##########################################
##
## hosting / relational data
##
##########################################

    apis.cardplayersunited.com:

        container_name: apis.cardplayersunited.com

        image: apis.cardplayersunited.com

        build:

            context: .

            dockerfile: Dockerfile

        restart: unless-stopped

        depends_on:
            card-players-unite-postgres:
                condition: service_healthy # THIS TELLS DOCKER TO WAIT FOR THE HEALTHCHECK

        ports:

            - 8888:8000

        volumes:

            - .:/home/app/webapp

        environment:

            - POSTGRES_DB=maverickdb

            - POSTGRES_USER=maverickdb

            - POSTGRES_PASSWORD=maverickdb

            - POSTGRES_HOST=card-players-unite-postgres

## documentation

    docs.cardplayersunited.com:

        container_name: docs.cardplayersunited.com

        image: docs.cardplayersunited.com

        build:

            context: docs

            dockerfile: Dockerfile

        restart: unless-stopped

        ports:

            - 8000:80
