Skip to content
Snippets Groups Projects
Verified Commit bfa7fc59 authored by Olivier Benz's avatar Olivier Benz
Browse files

Add option for custom subdomain

- Pass environment variables to jupyterhub
parent 8874dc7e
No related branches found
No related tags found
No related merge requests found
......@@ -30,7 +30,8 @@ in docker containers using docker compose.
easy-to-maintain LaTeX distribution based on TeX Live.
* **Zsh**: A shell designed for interactive use, although it is also a
powerful scripting language.
* Pre-configured to run at a **subdomain** (jupyter) of your **own domain**.
* Pre-configured to run at a **subdomain** (default: jupyter) of your
**own domain**.
* Use of environment files for variable substitution in the Compose file.
The following extensions are pre-installed for **code-server**:
......@@ -95,7 +96,7 @@ The following extensions are pre-installed for **code-server**:
The following is required:
* A DNS record for **subdomain** jupyter pointing to this host.
* A DNS record for **subdomain** (default: jupyter) pointing to this host.
## Install
......@@ -134,7 +135,7 @@ This project depends on the following
Redirect URL: https://jupyter.mydomain.com/hub/oauth_callback
```
→ Replace `mydomain.com` with your **own domain** that serves the
**subdomains**.
**subdomain**.
* Tick "Trusted"
* Scopes:
* Tick "api"
......
......@@ -12,6 +12,9 @@ JH_VERSION=3.1
## Domain
JH_DOMAIN=mydomain.com
## Subdomain (default: jupyter)
JH_SUBDOMAIN=
## Traefik certificates resolver name
JH_CERTRESOLVER_NAME=mydomain-com
......
......@@ -64,8 +64,9 @@ import sys
# Default: 'jupyterhub.auth.PAMAuthenticator'
from oauthenticator.gitlab import GitLabOAuthenticator
c.JupyterHub.authenticator_class = GitLabOAuthenticator
c.GitLabOAuthenticator.oauth_callback_url = 'https://jupyter.{domain}/hub/oauth_callback'.format(
domain = os.environ['JH_DOMAIN']
c.GitLabOAuthenticator.oauth_callback_url = 'https://{subdomain}.{domain}/hub/oauth_callback'.format(
subdomain = os.environ['JUPYTERHUB_SUBDOMAIN'],
domain = os.environ['JUPYTERHUB_DOMAIN']
)
## url for the database. e.g. `sqlite:///jupyterhub.sqlite`
......
......@@ -17,6 +17,8 @@ services:
- GITLAB_CLIENT_ID=${JH_GITLAB_APPLICATION_ID}
- GITLAB_CLIENT_SECRET=${JH_GITLAB_SECRET}
- JPY_COOKIE_SECRET=${JH_COOKIE_SECRET}
- JUPYTERHUB_DOMAIN=${JH_DOMAIN}
- JUPYTERHUB_SUBDOMAIN=${JH_SUBDOMAIN:-jupyter}
- POSTGRES_HOST=jupyterhub-postgres
env_file:
- db.env
......@@ -27,10 +29,10 @@ services:
- traefik.docker.network=webproxy
- traefik.http.services.jupyterhub.loadbalancer.server.port=8000
- traefik.http.routers.jupyterhub.entrypoints=web
- traefik.http.routers.jupyterhub.rule=Host(`jupyter.${JH_DOMAIN}`)
- traefik.http.routers.jupyterhub.rule=Host(`${JH_SUBDOMAIN}.${JH_DOMAIN}`)
- traefik.http.routers.jupyterhub.middlewares=http2https@file
- traefik.http.routers.jupyterhub-sec.entrypoints=websecure
- traefik.http.routers.jupyterhub-sec.rule=Host(`jupyter.${JH_DOMAIN}`)
- traefik.http.routers.jupyterhub-sec.rule=Host(`${JH_SUBDOMAIN}.${JH_DOMAIN}`)
- traefik.http.routers.jupyterhub-sec.tls.certresolver=${JH_CERTRESOLVER_NAME}
- traefik.http.routers.jupyterhub-sec.middlewares=sts@file
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment