jupyterhub / jupyter-rsession-proxy

Jupyter extensions for running an RStudio rsession proxy
BSD 3-Clause "New" or "Revised" License
118 stars 87 forks source link

Environment variable for rproject file #150

Closed rickmcgeer closed 3 months ago

rickmcgeer commented 3 months ago

Proposed change

A common practice in RStudio is to use an Rproject file on startup, which is given in the --rproj-file argument to rsession, e.g.: rsession --standalone=1 --program-mode=server --www-port=8787 --rproj-file=/etc/foo.rproj

It's no problem to put the rproject file in the Docker container and then add the following lines to https://github.com/jupyterhub/jupyter-rsession-proxy/blob/main/jupyter_rsession_proxy/__init__.py right after line 110:

if os.getenv('JUPYTER_RSESSION_RPROJ_FILE', default):
      cmd.append(f'--rproj-file={JUPYTER_RSESSION_RPROJ_FILE}')

Alternative options

This might be subsumed (or a special case) of the open PR https://github.com/jupyterhub/jupyter-rsession-proxy/pull/86. It appears to have been open for four years without activity.

Who would use this feature?

This is a common way for R users to express startup behavior.

(Optional): Suggest a solution

My proposed solution is in the description above, and I'd be happy to fork the repo, make and test it, and do a PR.

rickmcgeer commented 3 months ago

This was a bad idea, suggested to me by an R programmer. On investigation, it turns out that the actual flag is --rsession-config-file arg which just uses arg rather than /etc/rstudio/rsession.conf as the configuration file. But for the JupyterHub use case, the simpler and more reliable solution is just to overwrite /etc/rstudio/rsession.conf in the Jupyter server container image. So this should be closed as unnecessary.