@@ -13,6 +13,8 @@ There are several primary ways you can connect an IDE to your Coder workspace:
13
13
JetBrains Projector
14
14
1 . [ JetBrains' Code With Me] ( editors.md#code-with-me )
15
15
1 . [ Multiple JetBrains IDEs] ( editors.md#multiple-jetbrains-ides )
16
+ 1 . [ Jupyter Notebook] ( editors.md#jupyter-notebook )
17
+ 1 . [ JupyterLab] ( editors.md#jupyterlab )
16
18
1 . [ RStudio] ( editors.md#rstudio )
17
19
1 . _ Any_ local editor with
18
20
[ 1-way file synchronization] ( ../cli/file-sync.md#one-way-file-sync ) or
@@ -313,6 +315,130 @@ We have provided
313
315
[ detailed configuration steps] ( ../guides/customization/multiple-jetbrains-ides.md )
314
316
for setting up your custom image and configure script.
315
317
318
+ ## Jupyter Notebook
319
+
320
+ Jupyter Notebook is the original web IDE for creating Notebooks used in data
321
+ science, machine learning and analytics projects. By default, any Coder
322
+ workspace with the Jupyter project installed (in ` /usr/local/bin/jupyter ` )
323
+ will render the icon to launch Jupyter Notebook.
324
+
325
+ ![ Jupyter Notework] ( ../assets/workspaces/jupyter-notebook-icon.png )
326
+
327
+ To use Jupyter Notebook in a Coder workspace, build a Dockerfile with Jupyter
328
+ project installed as shown below:
329
+
330
+ ``` Dockerfile
331
+ # Dockerfile to install Jupyter Notebook
332
+ FROM codercom/enterprise-base:ubuntu
333
+
334
+ USER root
335
+
336
+ RUN pip3 install jupyter notebook
337
+
338
+ USER coder
339
+ ```
340
+
341
+ ## JupyterLab
342
+
343
+ JupyterLab is the next-generation web-based IDE for data science and Python
344
+ using documents called Notebooks.
345
+
346
+ ![ JupyterLab] ( ../assets/workspaces/jupyterlab-opened.png )
347
+
348
+ There are three methods to install and access JupyterLab in Coder. All require
349
+ JupyterLab to be installed in the Dockerfile via ` pip3 install jupyterlab ` .
350
+
351
+ The first method renames the ` jupyter ` binary and copies a new ` jupyter ` that
352
+ adjusts the arguments passed to the ` jupyter ` binary to tell Coder to launch
353
+ JupyterLab instead of Notebook.
354
+
355
+ ``` Dockerfile
356
+ FROM codercom/enterprise-base:ubuntu
357
+
358
+ USER root
359
+
360
+ RUN pip3 install jupyterlab
361
+ RUN pip3 install jupyter notebook
362
+
363
+ RUN mv /usr/local/bin/jupyter /usr/local/bin/jupyter.py
364
+
365
+ COPY jupyter /usr/local/bin/jupyter
366
+
367
+ USER coder
368
+ ```
369
+
370
+ Below is an example ` jupyter ` script with the lab arguments. This file must
371
+ be located in the same directory as the Dockerfile to be copied during ` docker build `
372
+
373
+ ``` sh
374
+ #! /bin/bash
375
+ # Replace all "NotebookApp" settings with ServerApp settings.
376
+ args=${@// LabApp/ " ServerApp" }
377
+ # Replace 'notebook' with 'lab' to launch juypter lab
378
+ args=${args/ notebook/ " lab" }
379
+
380
+ jupyter.py ${args}
381
+ ```
382
+
383
+ The second method to run JupyterLab is with a dev URL and launching
384
+ JupyterLab via ` supervisord ` in the ` configure ` script. The benefit of this
385
+ approach is it is completely independent of Coder's IDE launching mechanism
386
+ and relies only on a generic dev URL.
387
+
388
+ ![ JupyterLab as a dev URL] ( ../assets/workspaces/jupyterlab-as-devurl.png )
389
+
390
+ ``` Dockerfile
391
+ FROM codercom/enterprise-base:ubuntu
392
+
393
+ USER root
394
+
395
+ RUN pip3 install jupyterlab
396
+ RUN pip3 install jupyter notebook
397
+
398
+ # configure script to create a dev URL and launch JupyterLab
399
+ COPY ["configure" , "/coder/configure" ]
400
+ RUN chmod +x /coder/configure
401
+
402
+ # install supervisord
403
+ RUN apt-get update && apt-get install -y supervisor
404
+ RUN mkdir -p /var/log/supervisor
405
+ COPY supervisord.conf /etc/supervisor/conf.d/supervisord.conf
406
+
407
+ # change back to the coder user
408
+ USER coder
409
+ ```
410
+
411
+ The ` configure ` script installs ` supervisord `
412
+
413
+ ``` sh
414
+ #! /bin/bash
415
+
416
+ echo ' create dev URL for JupyterLab'
417
+ coder urls create $CODER_WORKSPACE_NAME 8888 --name jupyterlab
418
+
419
+ echo ' start supervisord and JupyterLab'
420
+ sudo /usr/bin/supervisord
421
+ ```
422
+
423
+ The ` supervisord.conf ` launches JupyterLab. This file must be located in the
424
+ same directory as the Dockerfile to be copied during ` docker build `
425
+
426
+ ``` sh
427
+ [supervisord]
428
+ nodaemon=false
429
+ environment=HOME=/home/coder
430
+
431
+ [program:jupyterlab]
432
+ command=/usr/local/bin/jupyter lab --ip=' *' --NotebookApp.token=' ' --NotebookApp.password=' '
433
+ user=coder
434
+ directory=/home/coder
435
+ ```
436
+
437
+ The third method to access JupyterLab is locally using the SSH port forward
438
+ command: ` ssh -L 8888:localhost:8888 coder.jupyterlab ` . Alternatively, you can
439
+ use the Coder CLI to port forward using: ` coder tunnel jupyterlab 8888 8888 ` .
440
+ Now, open a local browser and navigate to ` https://localhost:8888 ` .
441
+
316
442
## RStudio
317
443
318
444
Coder supports [ RStudio] ( rstudio.com ) . To create a workspace that lets you use
0 commit comments