Multiple instances of ShinyProxy on ubuntu server

Hi,
I am using the .deb version of the Shinyproxy on a linux server and everything is working perfect. In this method, we configure everything by editing the /etc/shinyproxy/application.yml file.
I want to host 2 different shiny apps on 2 different ports using shinyproxy. I am assuming in order to do that we would need two different application.yml files one for each application but when we use the service version i.e deb package version of shinyproxy we can only use a single location for the config file as mentioned above right?
Is there a way to do that within a single config file or any other way to be able to do this?
Any help is much appreciated.

Thank you…!!!

Hi psama,

maybe having more (two) users for your apps will solve your case. One user can see just one app and another user just second one. No need for two instances of Shinyproxy.

Does this approach solve your problem?

If not, there are other settings scenarios which can give you different ports for more instances (eg. each instance in separate docker). Give some more details about what you exactly need for your users.

Dusan

If you have two apps using different ports, just declare the port in each app’s section of your application.yml like this:

proxy:
...
  - id: app_01
    display-name: 
    description: 
    container-image: app_01:latest
    container-cmd: ["R", "-e", "shiny::runApp('./app01.R', host = '0.0.0.0', port = 6988)"]
    port: 6988

  - id: app_02
    display-name: 
    description: 
    container-image: app_02:latest
    container-cmd: ["R", "-e", "shiny::runApp('./app01.R', host = '0.0.0.0', port = 6989)"]
    port: 6889
...

Hi Dusan,
Thanks for the reply…!!!

Currently we are running shiny proxy on ubuntu server and we have 2 different applications which needed to be hosted. One application has around 6-9 users and the other one has around 70 users. The reason for asking it to be on different ports is, each app is confidential for the respective teams. I know that we can host the two apps on same port and control the users who can access the apps based on groups or usernames in the ldap but unfortunately our ldap doesn’t have groups and we dont want to use usernames because on the long run we thought it’s a bad idea as, for one app we have around 70 users.

Also just to clarify when I talk about ports I am talking about the host ports on ubuntu server and am using either deb based or jar based shinyproxy. I didn’t quite get your second point (also am not very experienced in docker just know the basics), can you please elaborate on it.

Best,
Prashanth

Hi jkh1,

I tried your solution, but its not working for me. Its using the default 8080 port and hosting both the apps on 8080.

Also the documentation says the port: the port on which the app is listening in the container; this setting will override the default port (3838)

Just to clarify my issue, I want to host 2 diff apps on 2 diff ports of my ubuntu server.

Best
Prashanth

Hi @psama,
In light of your reply to Dusan, I think I misunderstood the issue. In this case, it may indeed be easier to run two instances of shinyproxy. Here is how I do it:

  • Set up two shinyproxy directories, e.g. /opt/shinyproxy1 and /opt/shinyproxy2
  • Configure shinyproxy1 as normal.
  • In /opt/shinyproxy2/application.yml, add at the top
management:                                                                     
  server:                                                                       
    port: 9091                                                                  
                                                                                
proxy:
....

What this does is tell Java to use port 9091 instead of the default 9090. This is required to allow a second instance of shinyproxy to start if one is already running on the default port 9090.

  • In your nginx configuration, create a location entry for each instance, e.g.
      location /shinyproxy1 {                                                    
         
         proxy_pass  http://localhost:8080;                                                                                                        
         ...                                                                            
       }                                                                        
                                                                                
       location /shinyproxy2 {                                            
         proxy_pass  http://localhost:9080;                                     
         ...                                                                      
       }                                  

Great Thanks…!!!
Will try it and let you know of the progress in the next few days.

Best,
Prashanth

Won’t specifying a different config file work?
java -noverify -jar /opt/shinyproxy/shinyproxy.jar --spring.jmx.enabled=false --spring.config.location=/opt/shinyproxy/application.yml