diff --git a/extra/traefik-host-based-routing/.env.example b/extra/traefik-host-based-routing/.env.example index 7badb17..bc7ea4d 100644 --- a/extra/traefik-host-based-routing/.env.example +++ b/extra/traefik-host-based-routing/.env.example @@ -1,6 +1,10 @@ -# Optional environment variables +# Environment variables for JupyterHub deployment # Copy to .env and customize +# Domain for Traefik routing (required) +# Example: lab.example.com +HOSTNAME=localhost + # Enable CIFS mount for shared storage (0=disabled, 1=enabled) # Requires compose_cifs.yml to be configured with NAS credentials ENABLE_CIFS=0 diff --git a/extra/traefik-host-based-routing/README.md b/extra/traefik-host-based-routing/README.md index d5ddad2..80fae05 100644 --- a/extra/traefik-host-based-routing/README.md +++ b/extra/traefik-host-based-routing/README.md @@ -15,7 +15,11 @@ Template for deploying stellars-jupyterhub-ds with local Traefik reverse proxy a ./generate-certs.sh yourdomain.example.com ``` -3. Edit `compose_override.yml` - replace `YOURDOMAIN` with your domain +3. Create `.env` and set your hostname: + ```bash + cp .env.example .env + # Edit .env: HOSTNAME=yourdomain.example.com + ``` 4. Start: ```bash @@ -44,8 +48,7 @@ Template for deploying stellars-jupyterhub-ds with local Traefik reverse proxy a ## Configuration -Edit `compose_override.yml` to customize: -- Domain name (replace `YOURDOMAIN` placeholder) +Set `HOSTNAME` in `.env` for your domain. Edit `compose_override.yml` to customize: - Ports (default: 80/443) - Environment variables (idle culler, signup) - Network name diff --git a/extra/traefik-host-based-routing/compose_override.yml b/extra/traefik-host-based-routing/compose_override.yml index 6aa7a36..b247d02 100644 --- a/extra/traefik-host-based-routing/compose_override.yml +++ b/extra/traefik-host-based-routing/compose_override.yml @@ -3,11 +3,10 @@ # ============================================================================= # # 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 +# CERT: Self-signed cert in ./certs/ +# ACCESS: https://jupyterhub.${HOSTNAME}/ or https://jupyterhub.localhost/ # -# Replace YOURDOMAIN with your actual domain (e.g., lab.example.com) +# Set HOSTNAME in .env (e.g., HOSTNAME=lab.example.com) # # ============================================================================= @@ -57,8 +56,8 @@ services: - "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`)" + # Dashboard: traefik.${HOSTNAME} + - "traefik.http.routers.dashboard.rule=Host(`traefik.${HOSTNAME}`) || Host(`traefik.localhost`)" - "traefik.http.routers.dashboard.entrypoints=websecure" - "traefik.http.routers.dashboard.tls=true" - "traefik.http.routers.dashboard.service=api@internal" @@ -76,7 +75,7 @@ services: - "traefik.enable=true" # JupyterHub router (root path) - - "traefik.http.routers.jupyterhub-rtr.rule=Host(`jupyterhub.YOURDOMAIN`) || Host(`jupyterhub.localhost`)" + - "traefik.http.routers.jupyterhub-rtr.rule=Host(`jupyterhub.${HOSTNAME}`) || 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" diff --git a/extra/traefik-host-based-routing/start.sh b/extra/traefik-host-based-routing/start.sh index 1845689..56ba0e0 100755 --- a/extra/traefik-host-based-routing/start.sh +++ b/extra/traefik-host-based-routing/start.sh @@ -58,4 +58,4 @@ docker compose ${COMPOSE_FILES} pull docker pull stellars/stellars-jupyterlab-ds:latest docker compose ${COMPOSE_FILES} up -d --no-build -echo "Done. Access: https://jupyterhub.YOURDOMAIN/" +echo "Done. Access: https://jupyterhub.${HOSTNAME:-localhost}/"