You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@dlab.apache.org by dm...@apache.org on 2020/02/26 16:38:55 UTC

[incubator-dlab] branch DLAB-625 updated: [DLAB-625] Bugfix

This is an automated email from the ASF dual-hosted git repository.

dmysakovets pushed a commit to branch DLAB-625
in repository https://gitbox.apache.org/repos/asf/incubator-dlab.git


The following commit(s) were added to refs/heads/DLAB-625 by this push:
     new acd8932  [DLAB-625] Bugfix
acd8932 is described below

commit acd8932cf6ccc85b1bf8138624a08250feab9c09
Author: Demyan Mysakovets <de...@gmail.com>
AuthorDate: Wed Feb 26 18:38:36 2020 +0200

    [DLAB-625] Bugfix
---
 .../general/scripts/azure/jupyterlab_configure.py  | 44 +++++++++++++++++++++-
 .../src/jupyterlab/Dockerfile_jupyterlab           |  8 ++--
 2 files changed, 48 insertions(+), 4 deletions(-)

diff --git a/infrastructure-provisioning/src/general/scripts/azure/jupyterlab_configure.py b/infrastructure-provisioning/src/general/scripts/azure/jupyterlab_configure.py
index d87e640..4456eff 100644
--- a/infrastructure-provisioning/src/general/scripts/azure/jupyterlab_configure.py
+++ b/infrastructure-provisioning/src/general/scripts/azure/jupyterlab_configure.py
@@ -53,8 +53,9 @@ if __name__ == "__main__":
         notebook_config['project_tag'] = os.environ['project_name'].lower().replace('_', '-')
         notebook_config['endpoint_tag'] = os.environ['endpoint_name'].lower().replace('_', '-')
         notebook_config['user_keyname'] = os.environ['project_name']
-        notebook_config['instance_name'] = '{}-{}-nb-{}'.format(notebook_config['service_base_name'],
+        notebook_config['instance_name'] = '{}-{}-{}-nb-{}'.format(notebook_config['service_base_name'],
                                                                 notebook_config['project_name'],
+                                                                os.environ['endpoint_name'],
                                                                 notebook_config['exploratory_name'])
         notebook_config['image_enabled'] = os.environ['conf_image_enabled']
         notebook_config['shared_image_enabled'] = os.environ['conf_shared_image_enabled']
@@ -309,6 +310,47 @@ if __name__ == "__main__":
         AzureActions().remove_instance(notebook_config['resource_group_name'], notebook_config['instance_name'])
         sys.exit(1)
 
+    try:
+        print('[CONFIGURING PROXY FOR DOCKER]')
+        logging.info('[CONFIGURING PROXY FOR DOCKER]')
+        params = "--hostname {} " \
+                 "--keyfile {} " \
+                 "--os_user {} ". \
+            format(instance_hostname,
+                   notebook_config['ssh_key_path'],
+                   notebook_config['dlab_ssh_user'])
+        try:
+            local("~/scripts/configure_proxy_for_docker.py {}".format(params))
+        except:
+            traceback.print_exc()
+            raise Exception
+    except Exception as err:
+        print('Error: {0}'.format(err))
+        append_result("Failed to configure proxy for docker.", str(err))
+        GCPActions().remove_instance(notebook_config['instance_name'], notebook_config['zone'])
+        sys.exit(1)
+
+
+    try:
+        print('[STARTING JUPYTER CONTAINER]')
+        logging.info('[STARTING JUPYTER CONTAINER]')
+        params = "--hostname {} " \
+                 "--keyfile {} " \
+                 "--os_user {} ". \
+            format(instance_hostname,
+                   notebook_config['ssh_key_path'],
+                   notebook_config['dlab_ssh_user'])
+        try:
+           local("~/scripts/jupyterlab_container_start.py {}".format(params))
+        except:
+             traceback.print_exc()
+             raise Exception
+    except Exception as err:
+        print('Error: {0}'.format(err))
+        append_result("Failed to start Jupyter container.", str(err))
+        GCPActions().remove_instance(notebook_config['instance_name'], notebook_config['zone'])
+        sys.exit(1)
+
     # generating output information
     try:
         ip_address = AzureMeta().get_private_ip_address(notebook_config['resource_group_name'],
diff --git a/infrastructure-provisioning/src/jupyterlab/Dockerfile_jupyterlab b/infrastructure-provisioning/src/jupyterlab/Dockerfile_jupyterlab
index 673ef8c..4ebc51b 100644
--- a/infrastructure-provisioning/src/jupyterlab/Dockerfile_jupyterlab
+++ b/infrastructure-provisioning/src/jupyterlab/Dockerfile_jupyterlab
@@ -25,14 +25,16 @@ ARG NB_USER="jovyan"
 
 EXPOSE 8888
 
+USER root
+
+RUN usermod -aG sudo $NB_USER
+
 COPY jupyter_notebook_config.py /etc/jupyter/jupyter_notebook_config.py
 
 #Prepearing Start script
 COPY jupyterlab_run.sh /jupyterlab_run.sh
 RUN  sed -i 's|CONF_PATH|/etc/jupyter/jupyter_notebook_config.py|' /jupyterlab_run.sh \
-  && chmod +x /jupyterlab_run.sh \
-  && chown -R 1001:1001 /etc/jupyter \
-  && chown -R 1001:1001 /opt/odahu-flow
+  && chmod +x /jupyterlab_run.sh
 
 RUN apt update && apt install -y vim netcat-openbsd
 


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@dlab.apache.org
For additional commands, e-mail: commits-help@dlab.apache.org