Skip to content

Configuration examples for deploying on sub‐paths

Axel Leroy edited this page Dec 20, 2023 · 2 revisions

Some users might want to deploy multiple applications in addition to Self Host Planning Poker on the same domain, but on different paths.

Say for example that you want to deploy Self Host Planning Poker and FreshRSS on https://example.tld/poker/ and https://example.tld/freshrss/ respectively. You'll need to instruct your reverse-proxy to redirect requests made to https://example.tld/poker/ to your Self Host Planning Poker container, while rewriting the request so that it matches the container's root (http://poker/). Finally, you'll need to set the environment variable APP_ROOT to /poker/.

Nginx

# docker-compose.yml
version: '3'
services:
  poker:
    image: axeleroy/self-host-planning-poker:latest
    expose:
      - 8000:8000
    volumes:
      - planning-poker-data:/data
    environment:
      - APP_ROOT=/poker/
      - VIRTUAL_HOST=example.tld
      - VIRTUAL_PORT=8000
      - VIRTUAL_PATH=/poker/
      - VIRTUAL_DEST=/
    networks:
      - nginx-net   

volumes:
  planning-poker-data: {}

networks:
  nginx-net:
    external: true

Vanilla Nginx

# docker-compose.yml
version: '3'
services:
  nginx:
    image: nginx:1-alpine
    ports:
      - 80:80
      - 443:443
    volumes:
      - ./nginx.conf:/etc/nginx/conf.d/default.conf:ro
  poker:
    image: axeleroy/self-host-planning-poker:latest
    expose:
      - 8000:8000
    volumes:
      - planning-poker-data:/data
    environment:
      - APP_ROOT=/poker/

volumes:
  planning-poker-data: {}
# /etc/nginx/conf.d/poker.conf
location /poker/ {
    proxy_pass http://poker:8000/;
    # cf. https://socket.io/docs/v4/reverse-proxy/#nginx
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    proxy_set_header Host $host;
    proxy_http_version 1.1;
    proxy_set_header Upgrade $http_upgrade;
    proxy_set_header Connection "upgrade";
}

Caddy

# docker-compose.yml
version: '3'
services:
  poker:
    image: axeleroy/self-host-planning-poker:latest
    expose:
      - 8000:8000
    volumes:
      - planning-poker-data:/data
    environment:
      - APP_ROOT=/poker/
    networks:
      - caddy
    labels:
      caddy: example.tld
      caddy.handle_path: /poker/*
      caddy.handle_path.0_reverse_proxy: "{{upstreams 8000}}"

networks:
  caddy:
    external: true

Vanilla Caddy

# docker-compose.yml
version: '3'
services:
  poker:
    image: axeleroy/self-host-planning-poker:latest
    expose:
      - 8000:8000
    volumes:
      - planning-poker-data:/data
    environment:
      - APP_ROOT=/poker/
    networks:
      - caddy

networks:
  caddy:
    external: true
# Caddyfile
example.tld {
  handle_path /poker/* {
    reverse_proxy http://poker:8000
  }
}

Traefik

# docker-compose.yml
version: '3'
services:
  poker:
    image: axeleroy/self-host-planning-poker:latest
    expose:
      - 8000:8000
    volumes:
      - planning-poker-data:/data
    environment:
      - APP_ROOT=/poker/
    networks:
      - traefik-net
    labels:
      traefik.http.routers.planning-poker.rule: PathPrefix(`/poker`)
      traefik.http.routers.planning-poker.middlewares: poker-stripprefix
      traefik.http.middlewares.poker-stripprefix.stripprefix.prefixes: /poker

networks:
  traefik-net:
    external: true