Skip to content

Commit

Permalink
update documentation
Browse files Browse the repository at this point in the history
Update Dockerfile version
  • Loading branch information
eeholmes authored Feb 19, 2025
2 parents 91ba942 + 847193b commit b1925d4
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 2 deletions.
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ LABEL org.opencontainers.image.author="eli.holmes@noaa.gov"
LABEL org.opencontainers.image.source=https://github.com/nmfs-opensci/py-rocket-base
LABEL org.opencontainers.image.description="Python (3.12), R (4.4.1), Desktop and Publishing tools"
LABEL org.opencontainers.image.licenses=Apache2.0
LABEL org.opencontainers.image.version=2025.02.12
LABEL org.opencontainers.image.version=2025.02.19

USER root

Expand Down
20 changes: 19 additions & 1 deletion book/developers.qmd
Original file line number Diff line number Diff line change
Expand Up @@ -298,6 +298,16 @@ gtk-update-icon-cache "${ICON_DIR}" # <6>
5. Add any mime xml files to the mime folder and update the mime database.
6. Add any png or svg icon files to the icon folder and update the icon database.

## Notes on the Jupyter Lab environment

### Terminal in Jupyter Lab

When a terminal is launched from the Launcher, it starts a login bash shell (`bash -l`). When login bash shells are started,
`/etc/profile` script is run. For this image, this script will execute all the scripts in the directory `/etc/profile.d`. There is the script `init_conda.sh` which ensures that the conda notebook environment is activated. The user might override this if they create `~/.bashrc_profile` in which case that is used instead of `/etc/profile`.

For non-login bash shells (interactive), `/etc/bash.bashrc` determines the shell environment unless the user has created `~/.bashrc`,
in which case that file determines the shell environment. In Jupyter Lab, you can start and interactive shell by running `bash` (from a terminal). Be aware that if you run `bash` it might look like the conda environment is deactivated but it is really not since the `PATH` still includes `conda` in it. If you are trying to get remove `conda` from the path (and get rid of all the conda environment variables) you need to run `conda deactivate` (2x).

## Notes on the RStudio environment

[jupyter-rsession-proxy](https://github.com/jupyterhub/jupyter-rsession-proxy) allows us to launch RStudio from Jupyter Lab, but the environment is different than the environment in Jupyter Lab.
Expand All @@ -306,6 +316,14 @@ gtk-update-icon-cache "${ICON_DIR}" # <6>

* PATH is different. conda is not on the path.
* None of the environmental variables in the docker file will be in the `/rstudio` environment. The start command affects `\lab` and `\notebook` but not `\rstudio`.
* The path in the terminal (in RStudio) can/is different than in the R console. Expect weird unexpected behavior because of this. If you type `bash`, then `.bashrc` is run and that will run `conda init` and that will add conda binaries to the path. Then really weird and unexpected things can happen.

If you need some environmental variable set, you will need to set those in `$R_HOME/etc/Rprofile.site` which is run when R starts.

### Terminal in RStudio

The default way that a terminal is started is `bash -l` which means it is a login terminal. When a login terminal launches,
`/etc/profile` script is run. For this image, this script will execute all the scripts in the directory `/etc/profile.d`. You
can add scripts there that you want to run when a login terminal is started. In particular, there is the script `init_conda.sh`.
This ensures that when a terminal is opened from the Launcher in JupyterLab, the conda notebook environment is activated.
However, we do not want this to happen in RStudio so the script checks if RSTUDIO==1 and R_HOME is set, if that is true then we
are in the RStudio UI and conda should not be initialized.

0 comments on commit b1925d4

Please # to comment.