This is an automated email from the ASF dual-hosted git repository.
lahirujayathilake pushed a commit to branch agent-framewok-refactoring
in repository https://gitbox.apache.org/repos/asf/airavata.git
The following commit(s) were added to refs/heads/agent-framewok-refactoring by
this push:
new 68774548c0 JupyterHub docker deployment configuration
68774548c0 is described below
commit 68774548c0fa3f48ffb40c3281db46d193c0d1a2
Author: lahiruj <[email protected]>
AuthorDate: Mon Dec 2 00:28:29 2024 -0500
JupyterHub docker deployment configuration
---
dev-tools/deployment/jupyterhub/Dockerfile | 15 ++++++++
.../deployment/jupyterhub/docker-compose.yaml | 23 ++++++++++++
.../deployment/jupyterhub/jupyterhub_config.py | 41 ++++++++++++++++++++++
3 files changed, 79 insertions(+)
diff --git a/dev-tools/deployment/jupyterhub/Dockerfile
b/dev-tools/deployment/jupyterhub/Dockerfile
new file mode 100644
index 0000000000..8b517dca34
--- /dev/null
+++ b/dev-tools/deployment/jupyterhub/Dockerfile
@@ -0,0 +1,15 @@
+FROM jupyterhub/jupyterhub:3.0
+
+RUN pip install oauthenticator requests pyjwt dockerspawner
+
+COPY jupyterhub_config.py /srv/jupyterhub/jupyterhub_config.py
+
+RUN mkdir -p /home/jovyan/notebooks && \
+ chown -R 1000:100 /home/jovyan/notebooks
+
+ENV JUPYTERHUB_CONFIG=/srv/jupyterhub/jupyterhub_config.py
+ENV PYTHONPATH=/srv/jupyterhub
+
+EXPOSE 8000
+
+CMD ["jupyterhub"]
\ No newline at end of file
diff --git a/dev-tools/deployment/jupyterhub/docker-compose.yaml
b/dev-tools/deployment/jupyterhub/docker-compose.yaml
new file mode 100644
index 0000000000..977c8a4447
--- /dev/null
+++ b/dev-tools/deployment/jupyterhub/docker-compose.yaml
@@ -0,0 +1,23 @@
+version: "3.8"
+services:
+ jupyterhub:
+ build: .
+ container_name: jupyterhub-sample
+ ports:
+ - "8000:8000"
+ environment:
+ OAUTH_CLIENT_ID: "cs-jupyterlab"
+ OAUTH_CLIENT_SECRET: "xxxxxxxxx"
+ JUPYTERHUB_CRYPT_KEY:
"a99323294a5d6f9b1d0e7e33450dff44db664264231b985e069c6eba8f9a3e09"
+ DOCKER_NETWORK_NAME: jupyterhub_network
+ volumes:
+ - ./jupyterlab:/home/jovyan
+ - ./jupyterhub_config.py:/srv/jupyterhub/jupyterhub_config.py
+ - /var/run/docker.sock:/var/run/docker.sock
+ restart: always
+ networks:
+ - jupyterhub_network
+
+networks:
+ jupyterhub_network:
+ driver: bridge
\ No newline at end of file
diff --git a/dev-tools/deployment/jupyterhub/jupyterhub_config.py
b/dev-tools/deployment/jupyterhub/jupyterhub_config.py
new file mode 100644
index 0000000000..f7e8e127c3
--- /dev/null
+++ b/dev-tools/deployment/jupyterhub/jupyterhub_config.py
@@ -0,0 +1,41 @@
+from oauthenticator.generic import GenericOAuthenticator
+import os
+
+# Authenticator Configuration
+c.JupyterHub.authenticator_class = GenericOAuthenticator
+c.GenericOAuthenticator.client_id = os.getenv('OAUTH_CLIENT_ID')
+c.GenericOAuthenticator.client_secret = os.getenv('OAUTH_CLIENT_SECRET')
+c.GenericOAuthenticator.oauth_callback_url =
'http://3.147.153.73:8000/hub/oauth_callback'
+c.GenericOAuthenticator.authorize_url =
'https://auth.cybershuttle.org/realms/10000000/protocol/openid-connect/auth'
+c.GenericOAuthenticator.token_url =
'https://auth.cybershuttle.org/realms/10000000/protocol/openid-connect/token'
+c.GenericOAuthenticator.userdata_url =
'https://auth.cybershuttle.org/realms/10000000/protocol/openid-connect/userinfo'
+c.GenericOAuthenticator.scope = ['openid', 'profile', 'email']
+c.GenericOAuthenticator.username_claim = 'email'
+
+# User Permissions
+c.Authenticator.enable_auth_state = True
+c.Authenticator.allowed_users = set()
+# c.Authenticator.admin_users = {'user@airavata'} TODO Add admin users
+
+# Spawner Configuration
+c.JupyterHub.spawner_class = 'dockerspawner.DockerSpawner'
+c.DockerSpawner.container_image = 'jupyter/base-notebook:latest'
+c.DockerSpawner.notebook_dir = '/home/jovyan/work'
+c.DockerSpawner.volumes = {
+ 'jupyterhub-user-{username}': '/home/jovyan/work',
+}
+c.DockerSpawner.environment = {
+ 'CHOWN_HOME': 'yes',
+ 'CHOWN_HOME_OPTS': '-R',
+}
+c.DockerSpawner.extra_create_kwargs = {'user': 'root'}
+c.DockerSpawner.use_internal_ip = True
+c.DockerSpawner.network_name = os.getenv('DOCKER_NETWORK_NAME',
'jupyterhub_network')
+
+# Hub Configuration
+c.JupyterHub.hub_ip = '0.0.0.0'
+c.JupyterHub.hub_port = 8081
+c.JupyterHub.hub_connect_ip = 'jupyterhub'
+
+# Logging
+c.JupyterHub.log_level = 'DEBUG'