Skip to content

Instantly share code, notes, and snippets.

@mew1033
Last active January 22, 2021 16:21
Show Gist options
  • Save mew1033/dafd4e47f1429555476e3496b6477c28 to your computer and use it in GitHub Desktop.
Save mew1033/dafd4e47f1429555476e3496b6477c28 to your computer and use it in GitHub Desktop.
traefik and plex
version: '3.7'
services:
traefik:
image: traefik:2.4
restart: always
ports:
- 80:80
- 443:443
networks:
- t2_proxy
- default
volumes:
- "/var/run/docker.sock:/var/run/docker.sock:ro"
- "./letsencrypt:/letsencrypt"
- "/var/log/traefik:/var/log"
command:
- "--entrypoints.web.address=:80"
# Uncomment these if you want to redirect all HTTP to HTTPS.
# - "--entrypoints.web.http.redirections.entrypoint.to=websecure"
# - "--entrypoints.web.http.redirections.entrypoint.scheme=https"
- "--entrypoints.websecure.address=:443"
- "--certificatesresolvers.myresolver.acme.tlschallenge=true"
- "--certificatesresolvers.myresolver.acme.email=youremail@example.com"
- "--certificatesresolvers.myresolver.acme.storage=/letsencrypt/acme.json"
# Uncomment this to test HTTPS before going live.
# - "--certificatesresolvers.myresolver.acme.caserver=https://acme-staging-v02.api.letsencrypt.org/directory"
- "--providers.docker=true"
- "--providers.docker.exposedbydefault=true"
- "--providers.docker.network=t2_proxy"
- "--api=true"
- "--api.dashboard=true"
- "--log.level=INFO"
# "--log.level=DEBUG"
- "--accesslog=true"
- "--accessLog.filePath=/var/log/access.log"
- "--accessLog.filters.statusCodes=400-499"
- "--global.sendAnonymousUsage"
plex:
container_name: plex
image: plexinc/pms-docker
restart: unless-stopped
ports:
- 32400:32400/tcp
- 3005:3005/tcp
- 8324:8324/tcp
- 32469:32469/tcp
- 1900:1900/udp
- 32410:32410/udp
- 32412:32412/udp
- 32413:32413/udp
- 32414:32414/udp
environment:
- PLEX_CLAIM=claimyclaim
- ADVERTISE_IP=https://plexy.my.domain/
hostname: plexy
volumes:
- ./plex:/config
- ./media:/data
labels:
- "traefik.enable=true"
- "traefik.http.routers.plex.rule=Host(`plexy.my.domain`)"
- "traefik.http.routers.plex.entrypoints=websecure"
- "traefik.http.routers.plex.tls=true"
- "traefik.http.routers.plex.tls.certresolver=myresolver"
- "traefik.http.routers.plexhttp.rule=Host(`plexy.my.domain`)"
- "traefik.http.routers.plexhttp.entrypoints=web"
- "traefik.http.services.plex.loadbalancer.server.port=32400"
networks:
- t2_proxy
# This is just for testing. You can disable it when not needed.
whoami:
# A container that exposes an API to show its IP address
image: containous/whoami
labels:
- "traefik.enable=true"
- "traefik.http.routers.whoami.rule=Host(`whoami.my.domain`)"
- "traefik.http.routers.whoami.entrypoints=websecure"
- "traefik.http.routers.whoami.tls=true"
- "traefik.http.routers.whoami.tls.certresolver=myresolver"
- "traefik.http.routers.whoamihttp.rule=Host(`whoami.my.domain`)"
- "traefik.http.routers.whoamihttp.entrypoints=web"
networks:
- t2_proxy
networks:
t2_proxy:
external: true
@rnaff
Copy link

rnaff commented Jan 22, 2021

Thanks for all of your help buddy!!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment