rocker-versioned2 icon indicating copy to clipboard operation
rocker-versioned2 copied to clipboard

Allow to pass values to rserver.conf or to rserver bin

Open ColinFay opened this issue 3 years ago • 3 comments

Hey,

Sorry if that has been answered / documented already, but I've been trying to find a way to do the following and been unsuccessful so far.

I want to pass arguments to the server launch, either via setting an entry inside rserver.conf, or as a param to /usr/lib/rstudio-server/bin/rserver.

As far as I have understood, this is not doable :

  • at the s6.run level because it's written like this: https://github.com/rocker-org/rocker-versioned2/blob/master/scripts/install_rstudio.sh#L106

  • at the /etc/rstudio/rserver.conf level because it is overwritten if DISABLE_AUTH is TRUE https://github.com/rocker-org/rocker-versioned2/blob/master/scripts/install_rstudio.sh#L94

So to sum, let's say I want to pass www-frame-origin=any to rserver, which is doable with

  • /usr/lib/rstudio-server/bin/rserver --www-frame-origin=any
  • via echo "www-frame-origin=any" >> /etc/rstudio/rserver.conf,

what's the preferred way to do this?

If it's not doable, is this intentional, or is it a feature request you'd consider?

ColinFay avatar Nov 25 '21 15:11 ColinFay

Thanks @ColinFay . This sounds reasonable, but I don't entirely follow where you get stuck.

  • At the s6 run level, I gather you would merely want to provide your own custom /etc/services.d/rstudio/run file, e.g. by volume linking. (note it will need the same header, but easy to modify based on the built-in one?)

  • if you prefer to go the custom etc/rstudio/rserver.conf route (which may be more natural), I think you should merely avoid setting the environmental variable DISABLE_AUTH, since you're providing your own rserver.conf you can set "auth-none=1" yourself along with any other variables you have in mind.... The DISABLE_AUTH env var thing is merely a convenience for users that don't want to provide a custom rserver.conf, https://github.com/rocker-org/rocker-versioned2/blob/master/scripts/userconf.sh#L20

Let me know if either of these ways works, or if I'm missing something (I haven't tested the above, just what comes to mind!)

Best of luck!

cboettig avatar Nov 29 '21 05:11 cboettig

Hey Carl,

Thanks for your feedback.

I was experimenting with both methods but:

  • I would prefer not to rely on my own S6.run file, I have way more faith on the one you're writing :) — And of course if at some point you make a change to this file for one reason or another because of changes in the way S6 and /or rserver work, I'd have to keep an eye on this, so it makes the maintenance more complex over time.

  • Some params can only be passed to the bin and can't be set on the rserver.conf (for example server-app-armor-enabled or www-url-path-prefix) so that would work for some config but not others.

I wonder if we could have something like -e RSERVERCONF_EXTRARGS="xyz=12;abc=13" and -e RSERVERBIN_EXTRARGS="xyz=12;abc=13", the first will add the extra args to the server.conf file, the other after the bin inside the s6.run.

Happy to try to implement this. If I understand correctly, this would be implemented in https://github.com/rocker-org/rocker-versioned2/blob/master/scripts/userconf.sh.

Colin

ColinFay avatar Nov 30 '21 09:11 ColinFay

I see your point, but the s6 script is merely a short bash script (that happens to start with #!/usr/bin/with-contenv bash instead of #!/bin/bash; which is the only gotcha).

The full contents are:

#!/usr/bin/with-contenv bash
## load /etc/environment vars first:
for line in $( cat /etc/environment ) ; do export $line > /dev/null; done
exec /usr/lib/rstudio-server/bin/rserver --server-daemonize 0

So I think that's the most straight-forward place to add additional runtime arguments to the call to rserver, if they can't be passed to rsever.conf?

You could have code from userconf.sh which modifies this file on the fly, so to speak, but that feels a bit more cumbersome? (arguably you could also bi-pass s6 all together by specifying the rserver command, like so:

docker run -p 8787:8787 --rm --name test rocker/rstudio rserver --server-daemonize 0

cboettig avatar Dec 02 '21 05:12 cboettig