From dcfe71e7f0cea90c76e46ad0255576ffd6874c58 Mon Sep 17 00:00:00 2001 From: Min RK Date: Fri, 6 Jan 2017 11:24:11 +0100 Subject: [PATCH] add managed notebook service example --- examples/service-notebook/README.md | 10 +++++ .../managed/jupyterhub_config.py | 38 +++++++++++++++++++ 2 files changed, 48 insertions(+) create mode 100644 examples/service-notebook/README.md create mode 100644 examples/service-notebook/managed/jupyterhub_config.py diff --git a/examples/service-notebook/README.md b/examples/service-notebook/README.md new file mode 100644 index 00000000..72aed307 --- /dev/null +++ b/examples/service-notebook/README.md @@ -0,0 +1,10 @@ +# Running a shared notebook as a service + +This directory contains two examples of running a shared notebook server as a service, +one as a 'managed' service, and one as an external service with supervisor. + +A single-user notebook server is run as a service, +and uses groups to authenticate a collection of users with the Hub. + +These examples require jupyterhub >= 0.7.2. + diff --git a/examples/service-notebook/managed/jupyterhub_config.py b/examples/service-notebook/managed/jupyterhub_config.py new file mode 100644 index 00000000..00d05114 --- /dev/null +++ b/examples/service-notebook/managed/jupyterhub_config.py @@ -0,0 +1,38 @@ +# our user list +c.Authenticator.whitelist = [ + 'minrk', + 'ellisonbg', + 'willingc', +] + +# ellisonbg and willingc have access to a shared server: + +c.JupyterHub.load_groups = { + 'shared': [ + 'ellisonbg', + 'willingc', + ] +} + +hub_ip = '127.0.0.1' +hub_api_port = 8081 +service_name = 'shared-notebook' +group_name = 'shared' +service_port = 9999 + +# start the notebook server as a service +c.JupyterHub.services = [ + { + 'name': service_name, + 'url': 'http://127.0.0.1:{}'.format(service_port), + 'command': [ + 'jupyterhub-singleuser', + '--cookie-name=jupyterhub-services', + '--port={}'.format(service_port), + '--group={}'.format(group_name), + '--base-url=/services/{}'.format(service_name), + '--hub-prefix=/hub/', + '--hub-api-url=http://{}:{}/hub/api'.format(hub_ip, hub_api_port), + ] + } +] \ No newline at end of file