From 6f1d29c9dd40d4a6bfbe26111e90d32b273ad461 Mon Sep 17 00:00:00 2001 From: Rupesh Parab Date: Tue, 29 Mar 2022 23:04:42 +0530 Subject: [PATCH 1/2] lti changes --- grader-notebook/Dockerfile | 11 ++----- illumidesk-notebook/Dockerfile | 29 +++++++++++++++++++ illumidesk-notebook/global_nbgrader_config.py | 12 +++++++- illumidesk-notebook/requirements.txt | 2 +- 4 files changed, 44 insertions(+), 10 deletions(-) diff --git a/grader-notebook/Dockerfile b/grader-notebook/Dockerfile index 1ed1137..c8e722e 100644 --- a/grader-notebook/Dockerfile +++ b/grader-notebook/Dockerfile @@ -17,14 +17,9 @@ RUN jupyter nbextension enable --sys-prefix create_assignment/main \ RUN jupyter nbextension disable --sys-prefix assignment_list/main --section=tree # install and activate the async-nbgrader extensions -RUN jupyter nbextension install --sys-prefix --py async_nbgrader --overwrite \ - && jupyter nbextension enable --sys-prefix --py async_nbgrader \ - && jupyter serverextension enable --sys-prefix --py async_nbgrader - -# install and activate the formgrader extensions -RUN jupyter nbextension install --symlink --sys-prefix --py formgradernext --overwrite \ - && jupyter nbextension enable --sys-prefix --py formgradernext \ - && jupyter serverextension enable --sys-prefix --py formgradernext +RUN jupyter nbextension install --sys-prefix --py nbgrader --overwrite \ + && jupyter nbextension enable --sys-prefix --py nbgrader \ + && jupyter serverextension enable --sys-prefix --py nbgrader # fix permissions as root USER root diff --git a/illumidesk-notebook/Dockerfile b/illumidesk-notebook/Dockerfile index 9466486..b5563b8 100644 --- a/illumidesk-notebook/Dockerfile +++ b/illumidesk-notebook/Dockerfile @@ -3,8 +3,35 @@ ARG BASE_IMAGE=jupyter/datascience-notebook FROM $BASE_IMAGE:$TAG +USER root + +RUN apt-get update && \ + apt-get install -y \ + git \ + openssh-server \ + libmysqlclient-dev + +# Authorize SSH Host +RUN mkdir -p "/home/${NB_USER}/.ssh" && \ + chmod 0700 "/home/${NB_USER}/.ssh" + +COPY ./id_illumidesk_ssh "/home/${NB_USER}/.ssh/id_rsa" +COPY ./id_illumidesk_ssh.pub "/home/${NB_USER}/.ssh/id_rsa.pub" + +# Add the keys and set permissions +RUN chmod 600 "/home/${NB_USER}/.ssh/id_rsa" && \ + chmod 600 "/home/${NB_USER}/.ssh/id_rsa.pub" && \ + touch "/home/${NB_USER}/.ssh"/known_hosts + +RUN chown -R "${NB_USER}" "/home/${NB_USER}/.ssh" + USER "${NB_USER}" +RUN ssh-keyscan github.com >> "/home/${NB_USER}/.ssh"/known_hosts + +RUN echo "Host github.com\n\tStrictHostKeyChecking no\n" >> "/home/${NB_USER}/.ssh/config" + + # install packages with mamba to improve build times WORKDIR /tmp COPY environment.yml /tmp/environment.yml @@ -18,6 +45,8 @@ RUN mamba env update --prefix ./env --file /tmp/environment.yml # pip + conda RUN python3 -m pip install -r /tmp/requirements.txt +RUN rm -rf "/home/${NB_USER}/.ssh/" + # install nbgrader and then disable all extensions by default RUN jupyter nbextension install --symlink --sys-prefix --py nbgrader --overwrite \ && jupyter nbextension disable --sys-prefix --py nbgrader \ diff --git a/illumidesk-notebook/global_nbgrader_config.py b/illumidesk-notebook/global_nbgrader_config.py index 9d4340e..5c920ca 100644 --- a/illumidesk-notebook/global_nbgrader_config.py +++ b/illumidesk-notebook/global_nbgrader_config.py @@ -1,5 +1,13 @@ +import os + from nbgrader.auth import JupyterHubAuthPlugin +nbgrader_db_host = os.environ.get("POSTGRES_JUPYTERHUB_HOST") +nbgrader_db_password = os.environ.get("POSTGRES_JUPYTERHUB_PASSWORD") +nbgrader_db_user = os.environ.get("POSTGRES_JUPYTERHUB_USER") +nbgrader_db_port = os.environ.get("POSTGRES_JUPYTERHUB_PORT") or "5432" +nbgrader_db_name = os.environ.get("POSTGRES_NBGRADER_DB_NAME") or "illumidesk_next_20220201" + c = get_config() @@ -9,12 +17,14 @@ # Use the JupyterHub for authentication and group membership c.Authenticator.plugin_class = JupyterHubAuthPlugin +c.CourseDirectory.db_url = f"postgresql://{nbgrader_db_user}:{nbgrader_db_password}@{nbgrader_db_host}:{nbgrader_db_port}/{nbgrader_db_name}" + # Used when managing more than one course c.Exchange.path_includes_course = True # Exchange root path. If using a container, mount this folder # for persistence. -c.Exchange.root = "/srv/nbgrader/exchange" +# c.Exchange.root = "/srv/nbgrader/exchange" # Increase timeouts to avoid unnecessary exits when autograding c.ExecutePreprocessor.iopub_timeout = 180 diff --git a/illumidesk-notebook/requirements.txt b/illumidesk-notebook/requirements.txt index 66181b5..925c98a 100644 --- a/illumidesk-notebook/requirements.txt +++ b/illumidesk-notebook/requirements.txt @@ -1,4 +1,4 @@ -https://github.com/IllumiDesk/async-nbgrader/archive/refs/tags/v0.4.0.zip +git+ssh://git@github.com/IllumiDesk/illumidesk-next.git@feature/refactor-modals-lti#subdirectory=packages/nbgrader https://github.com/IllumiDesk/formgradernext/archive/refs/tags/v0.3.3.zip jupyter-resource-usage>=0.6.0 jupyter-server-proxy>=3.1.0 From 9a3d127ddff3dce7c99b81f68753a8dc7e84dc99 Mon Sep 17 00:00:00 2001 From: Rupesh Parab Date: Thu, 5 May 2022 21:49:18 +0530 Subject: [PATCH 2/2] update db name --- illumidesk-notebook/global_nbgrader_config.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/illumidesk-notebook/global_nbgrader_config.py b/illumidesk-notebook/global_nbgrader_config.py index 5c920ca..a7df4fb 100644 --- a/illumidesk-notebook/global_nbgrader_config.py +++ b/illumidesk-notebook/global_nbgrader_config.py @@ -6,7 +6,7 @@ nbgrader_db_password = os.environ.get("POSTGRES_JUPYTERHUB_PASSWORD") nbgrader_db_user = os.environ.get("POSTGRES_JUPYTERHUB_USER") nbgrader_db_port = os.environ.get("POSTGRES_JUPYTERHUB_PORT") or "5432" -nbgrader_db_name = os.environ.get("POSTGRES_NBGRADER_DB_NAME") or "illumidesk_next_20220201" +nbgrader_db_name = os.environ.get("POSTGRES_NBGRADER_DB_NAME") or "illumidesk" c = get_config()