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 2019/05/07 08:39:49 UTC

[incubator-dlab] 01/02: [DLAB-623] Bugfixing

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

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

commit a6937f6deb8ff45ad2336030d2ef4246bd691a7d
Author: Dyoma33 <de...@gmail.com>
AuthorDate: Thu May 2 19:18:48 2019 +0300

    [DLAB-623] Bugfixing
---
 .../src/general/files/aws/jupyter-docker_Dockerfile      |  2 +-
 infrastructure-provisioning/src/general/lib/os/fab.py    | 16 ++++++++++------
 .../src/jupyter-docker/Dockerfile_jupyter                |  7 +------
 .../scripts/configure_jupyter-docker_node.py             |  4 ++--
 4 files changed, 14 insertions(+), 15 deletions(-)

diff --git a/infrastructure-provisioning/src/general/files/aws/jupyter-docker_Dockerfile b/infrastructure-provisioning/src/general/files/aws/jupyter-docker_Dockerfile
index 36afed3..170ae23 100644
--- a/infrastructure-provisioning/src/general/files/aws/jupyter-docker_Dockerfile
+++ b/infrastructure-provisioning/src/general/files/aws/jupyter-docker_Dockerfile
@@ -26,7 +26,7 @@ ARG OS
 
 COPY jupyter-docker/ /root/
 COPY general/scripts/os/* /root/scripts/
-COPY general/scripts/aws/jupyter_* /root/scripts/
+COPY general/scripts/aws/jupyter* /root/scripts/
 COPY general/lib/os/${OS}/notebook_lib.py /usr/lib/python2.7/dlab/notebook_lib.py
 COPY general/templates/os/${OS}/ungit.service /root/templates/
 COPY general/templates/os/notebook_spark-defaults_local.conf /root/templates/
diff --git a/infrastructure-provisioning/src/general/lib/os/fab.py b/infrastructure-provisioning/src/general/lib/os/fab.py
index 7ee7819..670f2a9 100644
--- a/infrastructure-provisioning/src/general/lib/os/fab.py
+++ b/infrastructure-provisioning/src/general/lib/os/fab.py
@@ -193,7 +193,7 @@ def configure_jupyter(os_user, jupyter_conf_file, templates_dir, jupyter_version
             print('Error:', str(err))
             sys.exit(1)
 
-def configure_docker(os_user, docker_version, docker_conf_file):
+def configure_docker(os_user, http_file, https_file):
     try:
         if not exists('/home/' + os_user + '/.ensure_dir/docker_ensured'):
             sudo('curl -fsSL https://download.docker.com/linux/ubuntu/gpg | apt-key add -')
@@ -201,7 +201,7 @@ def configure_docker(os_user, docker_version, docker_conf_file):
                   stable"')
             sudo('apt-get update')
             sudo('apt-cache policy docker-ce')
-            sudo('apt-get install -y docker-ce={}~ce-0~ubuntu'.format(docker_version))
+            sudo('apt-get install -y docker-ce')
             sudo('mkdir -p /etc/systemd/system/docker.service.d')
             sudo('touch {}'.format(http_file))
             sudo('echo -e \'[Service] \nEnvironment=\"\'$http_proxy\'\"\' > {}'.format(http_file))
@@ -223,13 +223,17 @@ def configure_docker(os_user, docker_version, docker_conf_file):
         print('Failed to configure Docker:', str(err))
         sys.exit(1)
 
-def ensure_jupyter_docker_files(os_user, jupyter_dir, jupyter_conf_file, templates_dir, jupyter_version, exploratory_name):
+def ensure_jupyter_docker_files(jupyter_dir, jupyter_conf_file, jupyter_version, docker_jupyter_conf, exploratory_name):
     if not exists(jupyter_dir):
         try:
            sudo('mkdir {}'.format(jupyter_dir))
-           put('/root/Dockerfile_jupyter {}/Dockerfile_jupyter'.format(jupyter_dir))
-           put('/root/jupyter_run.sh {}/jupyter_run.sh'.format(jupyter_dir))
-           sudo('sed -i \'s/jup_version/{}/\' Dockerfile_jupyter'.format(jupyter_version))
+           put('/root/Dockerfile_jupyter', '/tmp/Dockerfile_jupyter')
+           put('/root/jupyter_run.sh', '/tmp/jupyter_run.sh')
+           put('/root/jupyter_notebook_config.py', '/tmp/jupyter_notebook_config.py')
+           sudo('mv /tmp/jupyter_run.sh {}jupyter_run.sh'.format(jupyter_dir))
+           sudo('mv /tmp/Dockerfile_jupyter {}Dockerfile_jupyter'.format(jupyter_dir))
+           sudo('mv /tmp/jupyter_notebook_config.py {}jupyter_notebook_config.py'.format(jupyter_dir))
+           sudo('sed -i \'s/jup_version/{}/\' {}Dockerfile_jupyter'.format(jupyter_version, jupyter_dir))
            sudo('sed -i \'s/CONF_PATH/{}/\' {}jupyter'.format(docker_jupyter_conf, jupyter_dir))
            sudo('echo "c.NotebookApp.ip = \'0.0.0.0\'" >> {}'.format(jupyter_conf_file))
            sudo('echo "c.NotebookApp.base_url = \'/{0}/\'" >> {1}'.format(exploratory_name, jupyter_conf_file))
diff --git a/infrastructure-provisioning/src/jupyter-docker/Dockerfile_jupyter b/infrastructure-provisioning/src/jupyter-docker/Dockerfile_jupyter
index 102d8f4..e4cbeb9 100644
--- a/infrastructure-provisioning/src/jupyter-docker/Dockerfile_jupyter
+++ b/infrastructure-provisioning/src/jupyter-docker/Dockerfile_jupyter
@@ -74,17 +74,12 @@ RUN pip install notebook==jup_version --no-cache-dir \
   && jupyter notebook --generate-config --config $CONF_FILE \
   && mkdir -p /home/$NB_USER/.jupyter/custom/ \
   && echo "#notebook-container { width: auto; }" > /home/$NB_USER/.jupyter/custom/custom.css \
-  && echo "c.NotebookApp.ip = \'0.0.0.0\'" >> $CONF_FILE \
-  && echo "c.NotebookApp.base_url = \'/jup/\'" >> $CONF_FILE \
-  && echo c.NotebookApp.open_browser = False >> $CONF_FILE \
-  && echo "c.NotebookApp.cookie_secret = NzMwZTI5MW" >> $CONF_FILE \
-  && ''echo "c.NotebookApp.token = u''" >> $CONF_FILE'' \
-  && echo 'c.KernelSpecManager.ensure_native_kernel = False' >> $CONF_FILE \
   && chown -R $NB_USER:$NB_USER /home/$NB_USER/.local \
   && mkdir -p /mnt/var \
   && chown $NB_USER:$NB_USER /mnt/var \
   && jupyter-kernelspec remove -f python3 || echo "Such kernel doesnt exists" \
   && jupyter-kernelspec remove -f python2 || echo "Such kernel doesnt exists"
+COPY jupyter_notebook_config.py /home/$NB_USER/.local/share/jupyter/jupyter_notebook_config.py
 
 #Installing local kernel
 RUN mkdir -p /home/$NB_USER/.local/share/jupyter/kernels/py3spark_local/ \
diff --git a/infrastructure-provisioning/src/jupyter-docker/scripts/configure_jupyter-docker_node.py b/infrastructure-provisioning/src/jupyter-docker/scripts/configure_jupyter-docker_node.py
index eecdb22..09c959b 100644
--- a/infrastructure-provisioning/src/jupyter-docker/scripts/configure_jupyter-docker_node.py
+++ b/infrastructure-provisioning/src/jupyter-docker/scripts/configure_jupyter-docker_node.py
@@ -96,11 +96,11 @@ if __name__ == "__main__":
 
     # INSTALL DOCKER
     print ("Install Docker")
-    configure_docker(args.os_user, docker_version)
+    configure_docker(args.os_user, http_file, https_file)
 
     # CONFIGURE JUPYTER FILES
     print("Configure jupyter files")
-    ensure_jupyter_docker_files(os_user, jupyter_conf_file, templates_dir, jupyter_version, exploratory_name)
+    ensure_jupyter_docker_files(jupyter_conf_file, jupyter_version, docker_jupyter_conf, args.exploratory_name)
 
     # INSTALL SPARK AND CLOUD STORAGE JARS FOR SPARK
     print("Install local Spark")


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