Files
stellars-jupyterhub-ds/extra/traefik-host-based-routing/compose_override.yml
stellarshenson 45cb18da4d feat: enhance traefik-host-based-routing with CIFS and cert installers
- Add optional CIFS mount support via compose_cifs.yml and .env
- Create install_cert.sh for Linux (multi-distro support)
- Enhance install_cert.bat with folder argument and help flags
- Fix compose_override.yml stray quote, add idle culler defaults
- Enhance generate-certs.sh with generic CN and verification
- Update start.sh/stop.sh to support ENABLE_CIFS from .env
- Update README with CIFS and certificate installation docs
2026-01-16 16:27:45 +01:00

95 lines
3.1 KiB
YAML

# =============================================================================
# Compose Override - Local Traefik with Self-Signed Certificates
# =============================================================================
#
# PORTS: 80 (HTTP -> redirects to 443) | 443 (HTTPS)
# CERT: Self-signed cert for *.YOURDOMAIN in ./certs/
# ACCESS: https://jupyterhub.YOURDOMAIN/ or https://jupyterhub.localhost/
# TRUST: Import certs/_.YOURDOMAIN/cert.pem to browser
#
# Replace YOURDOMAIN with your actual domain (e.g., lab.example.com)
#
# =============================================================================
services:
traefik:
image: traefik:latest
command:
# Entrypoints
- "--entrypoints.web.address=:80"
- "--entrypoints.websecure.address=:443"
- "--entrypoints.websecure.http.tls=true"
# Docker provider
- "--providers.docker=true"
- "--providers.docker.exposedbydefault=false"
# File provider for TLS certificates
- "--providers.file.directory=/certs"
- "--providers.file.watch=true"
# API and Dashboard
- "--api.dashboard=true"
- "--api.insecure=false"
# TLS configuration
- "--serverstransport.insecureskipverify=true"
# Logging
- "--log.level=INFO"
ports:
- "80:80"
- "443:443"
volumes:
- /var/run/docker.sock:/var/run/docker.sock:ro
- ./certs:/certs:ro
networks:
- jupyterhub_network
labels:
- "traefik.enable=true"
# Global HTTP->HTTPS redirect
- "traefik.http.routers.http-catchall.rule=HostRegexp(`.+`)"
- "traefik.http.routers.http-catchall.entrypoints=web"
- "traefik.http.routers.http-catchall.middlewares=redirect-to-https"
- "traefik.http.routers.http-catchall.priority=1"
- "traefik.http.middlewares.redirect-to-https.redirectscheme.scheme=https"
- "traefik.http.middlewares.redirect-to-https.redirectscheme.permanent=true"
# Dashboard: traefik.YOURDOMAIN
- "traefik.http.routers.dashboard.rule=Host(`traefik.YOURDOMAIN`) || Host(`traefik.localhost`)"
- "traefik.http.routers.dashboard.entrypoints=websecure"
- "traefik.http.routers.dashboard.tls=true"
- "traefik.http.routers.dashboard.service=api@internal"
restart: unless-stopped
jupyterhub:
ports: []
environment:
- JUPYTERHUB_BASE_URL=/
- JUPYTERHUB_IDLE_CULLER_ENABLED=1
- JUPYTERHUB_SIGNUP_ENABLED=0
networks:
- jupyterhub_network
labels:
- "traefik.enable=true"
# JupyterHub router (root path)
- "traefik.http.routers.jupyterhub-rtr.rule=Host(`jupyterhub.YOURDOMAIN`) || Host(`jupyterhub.localhost`)"
- "traefik.http.routers.jupyterhub-rtr.entrypoints=websecure"
- "traefik.http.routers.jupyterhub-rtr.tls=true"
- "traefik.http.routers.jupyterhub-rtr.service=jupyterhub-svc"
- "traefik.http.services.jupyterhub-svc.loadbalancer.server.scheme=http"
- "traefik.http.services.jupyterhub-svc.loadbalancer.server.port=8000"
watchtower:
networks:
- jupyterhub_network
networks:
jupyterhub_network:
name: jupyterhub_network
# EOF