Moreover, I can use the container-env parameter inside the application.yml file and remove the container-env-file parameter, and then the application runs fine.
Am I incorrectly specifying the path to the env-file? Does the env-file need to be formatted differently than it would be if passed to docker run --env-file?
I assume you have a directory with an application.yml, Dockerfile and .Renviron file. In that case it might be a path issue, when building the image with ShinyProxy from within that directory, you can simply set the following container-env-file: .Renviron.
Besides that, I am not sure if the file extension matters, perhaps try storing the environment variables in an .env file? Given that you can run it fine with the --env-file input it should not matter though.
Yes, sorry, I should have mentioned that I have an application.yml, Dockerfile, and .Renviron file. Originally, the .Renviron file was in my Documents folder and I was happy leaving it there so I didn’t accidentally commit it to git. I tried moving it to the same directory as the Dockerfile and application.yml with no success. I also tried renaming the .Renviron file to env with no success. Not sure what I’m doing wrong at this point since the application works just fine if I run outside of ShinyProxy and load the .Renviron file with the --env-file option.
I think the issue is because I’m running ShinyProxy inside a docker container so the container-env-file parameter needs to reference a path to a an environmental variable list file inside the container instead of on the host machine. I’m guessing if I was running ShinyProxy standalone, the reference to a file on the host computer would work just fine. Thanks for your help!
Hi Giovanni, I am dealing with the same thing right now. Have you found a way how to mount .Renviron file into shinyproxy running inside a container? Thanks!
EDIT: copying .Renviron into container solves the problem. I have included it using simple COPY .Renviron /opt/shinyproxy/ command inside Dockerfile. Also, application.yml must contain container-env-file: .Renviron .
But I think this approach keeps a copy of the .Renviron file inside the Docker image. Many people prefer not to store information in the .Renviron inside the Docker image.
I load the .Renviron file when I run the ShinyProxy Docker container:
Is there a better solution for this yet? I feel at a minimum “.Renviron” and “config.yml” should be supported as these are fundamental ways in which R can manage sensitive data like passwords as well as multiple configurations. A major advantage of having these files is to be able to set different deployments configurations in one file, local, dev, production etc. then separate out sensitive information like passwords. It is awkward for R programmers to manage these otherwise. It may work on ShinyProxy, but what are we supposed to do when running locally? .Renviron is built into R, and config.yml is pretty close. Ideally, I would launch ShinyProxy with config.yml and .Renviron as parameters, and it would be smart enough to know the target audience and pass these on. I am currently using a volume mount, and secrets for passwords passing through the docker file to the application.yml, but as we move this to other environments where I don’t really want to mount a volume just for the config, I am explicitly keeping the config.yml, because we have a number of apps that use the same config, and I don’t want to update the database connection strings or what not for each app. The config.yml and .Renviron are important, because I use them to replicate ShinyProxy locally, for example ShinyProxy username, I wish it would work the other way around also, to help replicate local things on the servers.