I have trouble to run a shiny app with rstudio server on a centOS server, i have this error message "Connection refused" on the shiny browser opened.
I have install shiny server (and httpd)for deploy my shiny app and rstudio-server for dev new shiny app on the same server centos : here are the different versions of this service.
shiny-server : v1.5.18.987 (Node.js v16.14.0)
R : 4.1.3 (2022-03-10)
CentOS Stream release 8
RStudio Server - 2021.09.1 Build 372- 2009-2021 RStudio, PBC "Ghost Orchid" Release (8b9ced18, 2021-11-08) for CentOS 8
My shiny app in /srv/shiny-server/ works fine, but when i connect to rstudioserver by browser (and ip:8787) and i run my app, i see a new windows with "Connetion refused" and they are no message in the terminal.
The button that indicates that the application is running is even activated in rstudioserver interface and i just see that on the terminal.
> runApp('test')
Listening on http://127.0.0.1:7880
My "test" application is a copy/paste of this Shiny for R Gallery and the shiny directory is in my home directory.
I may have forgotten some information, if so, please do not hesitate, thank you for your help.
Does httpd serve any purpose at the moment, e.g. as reverse proxy? In the browser image with
the "Connection refused" message, can you enable developer tools, navigate to the network tab and reload the page? Does that produce any error messages?
Side note: CentOS Stream 8, which is different from CentOS 8, is not a supported OS. You can use e.g. Rocky Linux 8 for a free RHEL 8 compatible OS that still gets security updates.
Shiny on RStudio Server works for me on CentOS Stream 8 when using the following Dockerfile
FROM docker.io/tgagor/centos:stream8
ENV R_VERSION=4.1.3
RUN yum install -y epel-release procps-ng \
&& yum install -y https://cdn.rstudio.com/r/centos-8/pkgs/R-${R_VERSION}-1-1.x86_64.rpm \
&& yum install -y https://download2.rstudio.org/server/rhel8/x86_64/rstudio-server-rhel-2022.02.3-492-x86_64.rpm
COPY startup.sh /usr/local/bin
RUN chmod +x /usr/local/bin/startup.sh
Run ln -s /opt/R/${R_VERSION}/bin/R* /usr/local/bin
# Set default env values
ENV RSW_TESTUSER rstudio
ENV RSW_TESTUSER_PASSWD rstudio
ENV RSW_TESTUSER_UID 10000
CMD ["/usr/local/bin/startup.sh"]
with startup.sh
#!/bin/bash
set -e
set -x
# Create one user
if [ $(getent passwd $RSW_TESTUSER_UID) ] ; then
echo "UID $RSW_TESTUSER_UID already exists, not creating $RSW_TESTUSER test user";
else
if [ -z "$RSW_TESTUSER" ]; then
echo "Empty 'RSW_TESTUSER' variables, not creating test user";
else
useradd -s /bin/bash -N -u "$RSW_TESTUSER_UID" "$RSW_TESTUSER"
echo "$RSW_TESTUSER:$RSW_TESTUSER_PASSWD" | chpasswd
fi
fi
/usr/lib/rstudio-server/bin/rserver --server-daemonize 0 > /dev/stderr
So I am pretty sure that the combination you are trying to use can work in principle.
Can we get back to my questions from before:
In the browser [window] with the "Connection refused" message, can you enable developer tools, navigate to the network tab and reload the page? Does that produce any error messages?