wemake-services / caddy-gen

Automated Caddy reverse proxy for docker containers
https://hub.docker.com/r/wemakeservices/caddy-gen
MIT License
250 stars 24 forks source link

Use pathprefix as URL for containers #14

Closed mattiaspalm closed 3 years ago

mattiaspalm commented 6 years ago

I don’t seem able to use /api or /blog etc instead of mysite.com as URL for my docker containers

ro31337 commented 6 years ago

Please provide more details and steps to reproduce. It's hard to understand issue from one sentence. Screenshots would be also helpful. Thank you! @mattiaspalm

mattiaspalm commented 6 years ago

yes, I have a docker-compose.yml like this:

version: "3"
services:
  caddy-gen:
    container_name: caddy-gen
    #command: -ca=https://acme-staging.api.letsencrypt.org/directory
    build: .
    restart: always
    volumes:
      - /var/run/docker.sock:/tmp/docker.sock:ro
      #- /var/run/docker.sock:/var/run/docker.sock:ro
      - /docker/caddy-gen/acme:/etc/caddy/acme
      - /docker/caddy-gen/ocsp:/etc/caddy/ocsp
      - /docker/caddy-gen/Caddyfile:/etc/Caddyfile
      - /docker/caddy-gen:/root/.caddy
    ports:
      - "80:80"
      - "443:443"
    depends_on:
      - ghost
      - db
  ghost:
    image: ghost:latest
    labels:
      - "virtual.host=mysite.duckdns.org"  # your domains separated with a space
      - "virtual.port=2368"  # exposed port of this container
      - "virtual.tls-email=mymail@gmail.com" # set to valid email to activate SSL
    restart: always
    ports:
      - 2368:2368
    environment:
      # see https://docs.ghost.org/docs/config#section-running-ghost-with-config-env-variables
      database__client: mysql
      database__connection__host: db
      database__connection__user: root
      database__connection__password: example
      database__connection__database: ghost
      NODE_ENV: production
      url: https://mysite.duckdns.org
  db:
    image: mysql:5.7
    restart: always
    environment:
      MYSQL_ROOT_PASSWORD: example
  sonarr:
    image: binhex/arch-sonarr:latest
    labels:
      - "virtual.host=mysite.duckdns.org/sonarr"
      - "virtual.port=8989"  # exposed port of this container
      - "virtual.tls-email=mymail@gmail.com" # set to valid email to activate SSL     
    restart: always
    volumes: 
      - /d/tv:/media
      - /docker/sonarr/data:/data
      #- /docker/sonarr/config:/config
      - /etc/localtime:/etc/localtime:ro
    ports: 
      - 8989:8989
    #privileged: true
    environment:
      UMASK: 0000
      PUID: 197608
      PGID: 197121

And I want to use mysite.duckdns.org/sonarr but this is the result:

image