jupyter-rsession-proxy
jupyter-rsession-proxy copied to clipboard
open rstudio session for multi-user in jupyterhub
Whether it is possible to open multi rstudio sessions in a multi-user jupyterhub environment with the Jupyter-rsession-proxy extension? I have already installed the Jupyter-rsession-proxy and could open rstudio session for one user. But when I switch to another user, the rstudio session didn't work. It showed 500 : Internal Server Error, the error was could not start rstudio in time. Could anyone help me with that?
If the user sessions are not containerized and can run on the same node, multiple rserver processes will conflict since they expect to own the same directory in /tmp/. The second rserver process fails because it cannot write to the directory in /tmp/ that is owned by the first user.
One workaround is to namespace /tmp/ using something like pam_namespace. Your spawner would need to be PAM-aware.
@ryanlovett how to do this exactly? Or what workarounds are available at the moment to enable multi-user rstudio?
@wmaroy One way I know of is pam_namespace, as mentioned above.
I took a different approach by modifying the setup_rstudio function in jupyter_rsession_proxy/__init__.py to spawn rserver with the --secure-cookie-key-file option with a user-specific path.
I'm happy to submit a PR if there is interest.
@wil do you have a gist or example of what your setup_rstudio function looks like in jupyter_rsession_proxy/__init__.py for spawning rserver with --secure-cookie-key-file for multi users? I've also been trying to get this to work
@elijahc I based it on #57 and updated it like this:
--- a.py 2020-02-05 18:02:17.000000000 +1100
+++ b.py 2020-02-05 18:02:41.000000000 +1100
@@ -58,8 +58,11 @@
else:
raise FileNotFoundError('Can not find rserver in PATH')
+ cookie_dir = os.path.join(tempfile.gettempdir(), 'rstudio-server-{}'.format(getpass.getuser()))
+ os.makedirs(cookie_dir, mode=0o700, exist_ok=True)
return [
executable,
+ '--secure-cookie-key-file', os.path.join(cookie_dir, 'secure-cookie-key'),
'--www-port=' + str(port)
]
@wil Yes, it'd be great if you could submit a PR. Thanks for discovering this!
I tried to implement this, but couldn't get it to work. The most recently rstudio-server doesn't appear to have an option for --secure-cookie-key-file. Could this be an option specific to rstudio pro?
I tried with the --launcher-token arg token identifying session launcher option but that didn't seem to work and I'm not sure if it's an equivalent setting.