services:
    postgres:
        container_name: reactiveresume_postgres
        env_file:
            - .db.env
        healthcheck:
            test: [ "CMD-SHELL", "pg_isready -U postgres" ]
            start_period: 15s
            interval: 30s
            timeout: 30s
            retries: 3
        image: postgres:alpine
        logging:
            driver: json-file
            options:
                max-size: 50m
                max-file: "3"
        networks:
            traefik: null
        restart: always
        volumes:
            - pgdata:/var/lib/postgresql/data

    server:
        container_name: reactiveresume_server
        depends_on:
            - postgres
        env_file:
            - .env
        image: amruthpillai/reactive-resume:server-latest
        labels:
            traefik.docker.network: traefik
            traefik.enable: true
            traefik.http.routers.reactiveresume_server.entrypoints: websecure
            traefik.http.routers.reactiveresume_server.rule: Host(`reactiveresumesr.alexlebens.net`)
            traefik.http.routers.reactiveresume_server.service: reactiveresume_server
            traefik.http.services.reactiveresume_server.loadbalancer.server.port: 3100
        logging:
            driver: json-file
            options:
                max-size: 50m
                max-file: "3"
        networks:
            traefik: null
        restart: always

    client:
        container_name: reactiveresume_client
        depends_on:
            - server
        env_file:
            - .env
        image: amruthpillai/reactive-resume:client-latest
        labels:
            traefik.docker.network: traefik
            traefik.enable: true
            traefik.http.routers.reactiveresume_client.entrypoints: websecure
            traefik.http.routers.reactiveresume_client.rule: Host(`reactiveresume.alexlebens.net`)
            traefik.http.routers.reactiveresume_client.service: reactiveresume_client
            traefik.http.services.reactiveresume_client.loadbalancer.server.port: 3000
        logging:
            driver: json-file
            options:
                max-size: 50m
                max-file: "3"
        networks:
            traefik: null
        restart: always

networks:
    traefik:
        name: traefik
        external: true

volumes:
    pgdata:
        driver: local
        driver_opts:
            type: none
            o: bind
            device: /var/lib/docker/volumes/partition/reactiveresume_pgdata
