I have a quite large shiny application in which some constant data is loaded from db (mysql db on external server) in config.R before running of Shiny application. It works when I run docker container only, but in shinyproxy I receive the error “Container did not respond…” But when I delete these db queries in config.R and load it by another way, then the application works, and afterthat all db queries perform well.
few things you should check. Log of container started by shinyproxy (docker ps to get container id and then docker container logs --follow ). If container dies fast you will have a problem with this method. Also, check shinyproxy log file.
But, I do not understand what you do with config.R. Actually how you start it in container first and shiny app after that? What is CMD command in your Dockerfile?
Also, when you start container only, do you map mysql socket like you do in shinyproxy config? I have never used database over socket but over db library and tcp…
Command network_mode is for docker swarm as backend, and than network things became more complicate… Do you use docker as backend od docker swarm?
In the logs of container appears only (except regular library loading stuff) this warning message
System has not been booted with systemd as init system (PID 1). Can't operate.
Failed to create bus connection: Host is down
I will get rid of the network_mode and container-volumes, I added it when I was trying to fix the problem
About config.R: No, There is the regular shinyApp call shiny::runApp('/root/docker_app', port=3838, host='0.0.0.0'), but I have source("config.R") in both server and ui.
Maybe the error occurred because the constant data which is used by server/ui has not been loaded from DB yet when the application starts.
Or docker is not able to connect to db when the application starts (because after application loading all db queries work well)
About warning, I have no idea. Maybe someone else can help. What is your method for starting docker (eg, direct packet installation or maybe over snap on ubuntu)? Check if dockerd is listening over tcp: ps -aux | grep dockerd
and if you do not see something like root 780 0.0 3.0 1160296 123304 ? Ssl Aug09 4:15 /usr/bin/dockerd -H unix:// -D -H tcp://127.0.0.1:2375
than try to fix it with this manual: https://www.atlantic.net/vps-hosting/how-to-set-up-remote-access-to-docker-daemon/
Have you tried to run any test app on that shinyproxy installation?
About config.R: I understand now. Maybe it is not good idea to inline that file to both ui.R and server.R. It is true that you can not guarantee which file will be first runned, but maybe this double connection making some problems. I think that you need to see console output - like I wrote to you in my first reply. Than you will find out what is happening inside app.
I was running shinyproxy with testing applications, and it worked, the only problem that causes shinyproxy to fail is when there are db queries in the config.
Maybe if I don’t find the solution I will just remove the queries from config.R and try to find some another way.
I do not have complete insight in all your setup files but judging to all what we have wrote here I had to ask you did you tried to remove 'network_mode: “host” '?
It looks to me that your container can not access DB over network.
It didn’t help me, but I agree with you that problem is accessing DB over network.
When I run docker in bash, I am able to make queries to db.
I tried to pass these credentials to container-env-file but it didn’t help me too (like these)
FROM openanalytics/r-base
# update packages, add the new ones for r 4.0
RUN apt-get update && apt-get install -y --no-install-recommends software-properties-common && add-apt-repository ppa:c2d4u.team/c2d4u4.0+
# install system dependencies for R packages
RUN apt-get update && \
apt-get install -y --no-install-recommends \
...
# linux dependencies here .....
# Download and install library
RUN R -e "install.packages(c(...packages here...))"
RUN mkdir -p /root/docker_app
COPY app /root/docker_app
COPY /app/RProfile.site/ /usr/lib/R/etc/
EXPOSE 3838
CMD ["R", "-e", "shiny::runApp('/root/docker_app', port=3838, host='0.0.0.0')"]
Well,
it can be how you access DB. Using which library… I am not a experienced R programmer…
Is there any sign of accessing in DB log? Is there locking access by IP addresses in My Sql?
I’ve found the solution.
As I run quite a large app on localhost, container stop waiting more quickly than the application was loaded.
I increased the container-wait-time to container-wait-time: 40000
Also I leave the only one source("config.R") call in project (in server.R).
Hi!
My solution was increasing container-wait-time because I had a large application that took too much time for initialization. My application.yml and Dockerfile are the same as above, they are correct