networks:
  vpn:
    external: true

services:
    pipedfrontend:
        container_name: piped-frontend
        image: 1337kavin/piped-frontend:latest
        restart: unless-stopped
        depends_on:
            - piped
        entrypoint: ash -c 'sed -i s/pipedapi.kavin.rocks/BACKEND_HOSTNAME/g /usr/share/nginx/html/assets/* && /docker-entrypoint.sh && piped-nginx -g "daemon off;"'
        networks:
            vpn:
                ipv4_address: 10.100.0.126

    piped-proxy:
        container_name: piped-proxy
        image: 1337kavin/piped-proxy:latest
        restart: unless-stopped
        environment:
            - UDS=1
        volumes:
            - ./piped-proxy:/app/socket
        networks:
            vpn:
                ipv4_address: 10.100.0.127

    piped:
        container_name: piped-backend
        image: 1337kavin/piped:latest
        restart: unless-stopped
        volumes:
            - ./config/config.properties:/app/config.properties:ro
        depends_on:
            - piped-postgres
        networks:
            vpn:
                ipv4_address: 10.100.0.128

    piped-nginx:
        container_name: piped-nginx
        image: nginx:mainline-alpine
        restart: unless-stopped
        ports:
            - "PORT1:80"
        volumes:
            - ./config/nginx.conf:/etc/nginx/nginx.conf:ro
            - ./config/pipedapi.conf:/etc/nginx/conf.d/pipedapi.conf:ro
            - ./config/pipedproxy.conf:/etc/nginx/conf.d/pipedproxy.conf:ro
            - ./config/pipedfrontend.conf:/etc/nginx/conf.d/pipedfrontend.conf:ro
            - ./config/ytproxy.conf:/etc/nginx/snippets/ytproxy.conf:ro
            - ./piped-proxy:/var/run/ytproxy
        depends_on:
            - piped
            - piped-proxy
            - pipedfrontend
        #labels:
            #traefik.enable: true
            #traefik.http.routers.piped.entrypoints: web,websecure
            #traefik.http.routers.piped.rule: Host(`FRONTEND_HOSTNAME`, `BACKEND_HOSTNAME`, `PROXY_HOSTNAME`)"
            #traefik.http.routers.piped.service: piped
            #traefik.http.routers.piped.tls: true
            #traefik.http.routers.piped.tls.certresolver: production
            #traefik.http.services.piped.loadbalancer.server.port: PORT1
            #traefik.http.routers.piped.middlewares:
        healthcheck:
            disable: false #HEALTHCHECKHERE
        networks:
            vpn:
                ipv4_address: IPADDRESSHERE

    piped-postgres:
        container_name: piped-postgres
        image: postgres:15
        restart: unless-stopped
        volumes:
            - ./data/db:/var/lib/piped-postgresql/data
        environment:
            - postgres_DB=piped
            - postgres_USER=piped
            - postgres_PASSWORD=RANDOMIZEDPASSWORD1
        networks:
            vpn:
                ipv4_address: 10.100.0.129
