mirror of
https://github.com/stellarshenson/stellars-jupyterhub-ds.git
synced 2026-03-07 21:50:28 +00:00
90 lines
3.4 KiB
YAML
90 lines
3.4 KiB
YAML
# Copyright (c) Jupyter Development Team.
|
|
# Distributed under the terms of the Modified BSD License.
|
|
|
|
services:
|
|
|
|
# Proxy for smart trafic routing to make it possible to host multiple similar containers
|
|
# exposing ports 80, 413 & 8080 to force docker to keep only one traefik service
|
|
# traefik dashboard is available under http://localhost:8080/dashboard
|
|
traefik:
|
|
image: traefik:latest
|
|
container_name: ${COMPOSE_PROJECT_NAME:-stellars-jupyterhub-ds}-traefik
|
|
command:
|
|
- "--entrypoints.web.address=:80"
|
|
- "--entrypoints.websecure.address=:443"
|
|
- "--providers.docker=true"
|
|
- "--providers.docker.exposedbydefault=false"
|
|
- "--api.dashboard=true"
|
|
- "--api.insecure=true"
|
|
- "--providers.file.filename=/mnt/certs/certs.yml" # certificates generated by jupyterlab container
|
|
- "--serverstransport.insecureskipverify=true" # required for https passthrough
|
|
ports:
|
|
- "80:80"
|
|
- "443:443"
|
|
- "8080:8080"
|
|
volumes:
|
|
- /var/run/docker.sock:/var/run/docker.sock:ro
|
|
- ./certs:/mnt/certs # named volume to hold certificates
|
|
networks:
|
|
- jupyterhub-network
|
|
restart: unless-stopped
|
|
|
|
jupyterhub:
|
|
build:
|
|
context: build
|
|
dockerfile: Dockerfile.jupyterhub
|
|
image: stellars/stellars-jupyterhub-ds:latest
|
|
container_name: ${COMPOSE_PROJECT_NAME:-stellars-jupyterhub-ds}-jupyterhub
|
|
volumes:
|
|
# The JupyterHub configuration file
|
|
- "./conf/jupyterhub_config.py:/srv/jupyterhub/jupyterhub_config.py:ro"
|
|
# Bind Docker socket on the host so we can connect to the daemon from
|
|
# within the container
|
|
- "/var/run/docker.sock:/var/run/docker.sock:rw"
|
|
# Bind Docker volume on host for JupyterHub database and cookie secrets
|
|
- "vol_hub_data:/data"
|
|
# this is where certificates will be generated
|
|
- "vol_certs:/mnt/certs"
|
|
ports:
|
|
- "8000:8000"
|
|
environment:
|
|
# This username will be a JupyterHub admin
|
|
JUPYTERHUB_ADMIN: admin
|
|
# All containers will join this network
|
|
DOCKER_NETWORK_NAME: jupyterhub-network
|
|
# JupyterHub will spawn this Notebook image for users
|
|
DOCKER_NOTEBOOK_IMAGE: stellars/stellars-jupyterlab-ds:latest
|
|
# Notebook directory inside user image
|
|
DOCKER_NOTEBOOK_DIR: /home/lab/workspace
|
|
labels:
|
|
# Enable proxy support from Traefik
|
|
- "traefik.enable=true"
|
|
|
|
# ⚙ Jupyterhub Service (8000)
|
|
- "traefik.http.routers.jupyterhub-rtr.rule=Path(`/hub`) || PathPrefix(`/hub/`)"
|
|
- "traefik.http.routers.jupyterhub-rtr.entrypoints=websecure"
|
|
- "traefik.http.routers.jupyterhub-rtr.service=jupyterhub-svc"
|
|
- "traefik.http.routers.jupyterhub-rtr.tls=true"
|
|
- "traefik.http.services.jupyterhub-svc.loadbalancer.server.scheme=http"
|
|
- "traefik.http.services.jupyterhub-svc.loadbalancer.server.port=8000"
|
|
|
|
# ⚙ Jupyterlab Service (8000)
|
|
- "traefik.http.routers.jupyterlab-rtr.rule=Path(`/user`) || PathPrefix(`/user/`)"
|
|
- "traefik.http.routers.jupyterlab-rtr.entrypoints=websecure"
|
|
- "traefik.http.routers.jupyterlab-rtr.service=jupyterlab-svc"
|
|
- "traefik.http.routers.jupyterlab-rtr.tls=true"
|
|
- "traefik.http.services.jupyterlab-svc.loadbalancer.server.scheme=http"
|
|
- "traefik.http.services.jupyterlab-svc.loadbalancer.server.port=8000"
|
|
networks:
|
|
- jupyterhub-network
|
|
restart: unless-stopped
|
|
|
|
volumes:
|
|
vol_hub_data:
|
|
vol_certs:
|
|
|
|
networks:
|
|
jupyterhub-network:
|
|
name: jupyterhub-network
|
|
|