Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions molecule/playbook-jupyterhub/molecule.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,4 @@ provisioner:
jupyter_auth: noauth
jupyter_activate_remote_user_auth: true # mock SRAM auth by enabling remote user auth in JupyterHub config, despite setting auth to noauth.
jupyter_proxy_config: "{ proxy_set_header: { REMOTE_USER: '$$http_user'} }"
jupyterhub_debug: true
2 changes: 2 additions & 0 deletions playbooks/roles/jupyterhub/defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ jupyterhub_http_password: ""
jupyterhub_create_default_group: true
jupyterhub_remote_user_header: REMOTE_USER
jupyterhub_activate_remote_user_auth: false
jupyterhub_enable_unix_socket: true
jupyterhub_config_env_keep:
- JUPYTERHUB_ACTIVITY_URL
- JUPYTERHUB_SERVER_NAME
Expand All @@ -27,3 +28,4 @@ jupyterhub_config_env_keep:
- PATH
- CONDA_ROOT
- CONDA_DEFAULT_ENV
jupyterhub_debug: false
1 change: 1 addition & 0 deletions playbooks/roles/jupyterhub/molecule/default/converge.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,6 @@
jupyterhub_proxy_config:
proxy_set_header:
REMOTE_USER: '$http_user' # allows us to set the 'user' header in tests to mock login
jupyterhub_debug: true
roles:
- role: jupyterhub
16 changes: 15 additions & 1 deletion playbooks/roles/jupyterhub/templates/jupyterhub_config.py.j2
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,12 @@ c.AccessTokenAuthenticator.header_name = "{{ jupyterhub_remote_user_header }}"
c.AccessTokenAuthenticator.logout_endpoint = "/logout"
{% endif %}

{% if jupyterhub_debug %}
# Debug settings
c.JupyterHub.log_level = logging.DEBUG
c.ConfigurableHTTPProxy.debug = True
{% endif %}

# Spawner config

c.JupyterHub.spawner_class = 'sudospawner.SudoSpawner'
Expand All @@ -51,10 +57,18 @@ c.Spawner.args = [
c.Spawner.env_keep = {{ jupyterhub_config_env_keep | string }}

# Server config

{% if jupyterhub_enable_unix_socket %}
c.JupyterHub.hub_bind_url = "unix+http://{{ jupyterhub_user_home | replace("/", "%2F") }}%2Fjupyterhub.sock"
c.JupyterHub.hub_connect_url = c.JupyterHub.hub_bind_url
c.Spawner.environment.update({
'JUPYTERHUB_API_URL': "http://localhost:8000/hub/api",
'JUPYTERHUB_ACTIVITY_URL': lambda spawner : f"http://localhost:8000/hub/api/users/{spawner.user.name}/activity"
})
{% else %}
c.JupyterHub.ip = "{{ jupyterhub_bind_addr }}"
c.JypyterHub.port = {{ jupyterhub_port | int }}
c.JupyterHub.base_url = "{{ jupyterhub_uri }}"
{% endif %}

# Configure paths for essential server files
c.JupyterHub.cookie_secret_file = "{{ jupyterhub_user_home }}/jupyterhub_cookie_secret"
Expand Down
Loading