From fb253157977cc2e6f592a8a18167f9533f0d9ca4 Mon Sep 17 00:00:00 2001 From: Vincent Emonet Date: Wed, 22 Apr 2020 11:31:43 +0200 Subject: [PATCH] Now deploy JupyterLab to enable access to the terminal through the Jupyter web UI and improve the user experience when running Docket. Documentation to define a secure password for the jupyter notebook has been added to the README also --- README.md | 99 ++++++++++++++++++++++++++++++++-------------- docker-compose.yml | 3 ++ requirements.txt | 3 +- 3 files changed, 75 insertions(+), 30 deletions(-) diff --git a/README.md b/README.md index 95a828c..159d23c 100644 --- a/README.md +++ b/README.md @@ -8,50 +8,57 @@ Run these commands from the root DOCKET directory that contains the docker-compo To build the DOCKET docker image: +```bash docker-compose build +``` -This docker container is built off the jupyter/scipy-notebook -base image and installs java 8, nextflow and specific perl -and python libraries used by DOCKET +This docker container is built off the jupyter/scipy-notebook base image and installs java 8, nextflow and specific perl and python libraries used by DOCKET https://jupyter-docker-stacks.readthedocs.io/en/latest/using/selecting.html#jupyter-scipy-notebook -jupyter/scipy-notebook comes installed with gcc - pandas, matplotlib, scipy, seaborn, scikit-learn, cython, Click - uses apt-get to install system packages - uses conda to install python libraries +jupyter/scipy-notebook comes installed with gcc, pandas, matplotlib, scipy, seaborn, scikit-learn, cython, Click, uses apt-get to install system packages, uses conda to install python libraries ## Run To run the DOCKET docker container: +```bash docker-compose up +``` ## Connect To connect to the DOCKET docker container: - docker-compose exec docket bash +```bash +docker-compose exec docket bash +``` ## Nextflow Connect to the container and run: - nextflow run docket_study --infile test/dataset1.txt --docket test/ds1_test +```bash +nextflow run docket_study --infile test/dataset1.txt --docket test/ds1_test +``` ## Python sample Connect to the container and run: - python scripts/hello_docket.py --files test/hello_docket.txt +```bash +python scripts/hello_docket.py --files test/hello_docket.txt +``` ## Tests Connect to the container and run: - pip install -r common/tests/requirements.txt - python -m pytest common/tests +```bash +pip install -r common/tests/requirements.txt +python -m pytest common/tests +``` ## Jupyter notebook @@ -59,7 +66,9 @@ Jupyter notebook runs on port 8888. To see the token, either start the container without the detached flag or check the logs using: - docker-compose logs -f docket +```bash +docker-compose logs -f docket +``` ## Data @@ -84,19 +93,51 @@ If this is the configuration you wanted, you would add this line to the docker-c /Data/datasets:/datasets -An example docker-compose.yml - - version: "2.1" - services: - docket: - build: "." - image: "docket-dev" - environment: - DEBUG: 1 - PYTHONUNBUFFERED: 1 - PYTHONPATH: '/app' - ports: - - 8888:8888 - volumes: - - ./:/app - - /Data/datasets:/datasets \ No newline at end of file +An example `docker-compose.yml` + +```yaml +version: "2.1" +services: + docket: + build: "." + image: "docket-dev" + environment: + DEBUG: 1 + PYTHONUNBUFFERED: 1 + PYTHONPATH: '/app' + JUPYTER_ENABLE_LAB: 'yes' + ports: + - 8888:8888 + volumes: + - ./:/app + - /Data/datasets:/datasets +``` +## Password + +Generate a hash to safely define your password by executing the following 2 lines in a Jupyter Notebook: + +```python +from notebook.auth import passwd +passwd() +``` + +Use this hash to define the password in the command run when the container is started: + +```yaml +version: "2.1" +services: + docket: + build: "." + image: "docket-dev" + command: start-notebook.sh --NotebookApp.password='sha1:9316432938f9:93985dffbb854d31308dfe0602a51db947fb7d80' + environment: + DEBUG: 1 + PYTHONUNBUFFERED: 1 + PYTHONPATH: '/app' + JUPYTER_ENABLE_LAB: 'yes' + ports: + - 8888:8888 + volumes: + - ./:/app +``` + diff --git a/docker-compose.yml b/docker-compose.yml index 8d43862..975128d 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -3,10 +3,13 @@ services: docket: build: "." image: "docket-dev" + # sha1 hash used to define password ("test" here) + command: start-notebook.sh --NotebookApp.password='sha1:9316432938f9:93985dffbb854d31308dfe0602a51db947fb7d80' environment: DEBUG: 1 PYTHONUNBUFFERED: 1 PYTHONPATH: '/app' + JUPYTER_ENABLE_LAB: 'yes' ports: - 8888:8888 volumes: diff --git a/requirements.txt b/requirements.txt index 9258a76..d6fcfd6 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,4 +1,5 @@ annoy==1.16.3 cyjupyter==0.2.0 plotly==4.5.2 -git+git://github.com/gglusman/data-fingerprints#egg=datafingerprint \ No newline at end of file +git+git://github.com/gglusman/data-fingerprints#egg=datafingerprint +jupyterlab