Run multiple instances of shinyproxy
Closed this issue · 5 comments
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 run 2 different shiny apps on 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 @samaprashanth ,
Shinyproxy is Springboot framework application. It means you can
create single application.yaml config and run multiple instances of shinyproxy and point them to single application.yaml file.
See an example below
---
# This file is managed by Ansible
server:
forward-headers-strategy: native
useForwardHeaders: true
proxy:
title: "Test"
# logo-url: https://www.openanalytics.eu/shinyproxy/logo.png
landing-page: /
heartbeat-rate: 10000
heartbeat-timeout: 60000
bind-address: "127.0.0.1"
port: "8082"
# Docker configuration
container-backend: docker
docker:
cert-path: /home/none
url: "http://127.0.0.1:2375"
authentication: simple
admin-groups: shinyproxyadmin
specs:
- id: 01_hello
display-name: Hello Application
description: Application which demonstrates the basics of a Shiny app
container-cmd: ["R", "-e", "shinyproxy::run_01_hello()"]
container-image: openanalytics/shinyproxy-demo
logging:
file:
name: "/opt/shinyproxy/shinyproxy.log"
level:
root: DEBUG
---
spring:
profiles: prod
management:
server:
port: 9091
proxy:
port: "8091"
docker:
port-range-start: 20000
users:
- name: prod
password: prod
groups: shinyproxyadmin
- name: produser
password: devuser
groups: ['USER']
---
spring:
profiles: dev
management:
server:
port: 9092
proxy:
port: "8092"
docker:
port-range-start: 30000
users:
- name: dev
password: dev
groups: [shinyproxyadmin]
- name: devuser
password: devuser
groups: ['USER']
This file contains default Springboot profile, prod and dev. The last tow are our custom profiles.
Dev and prod profiles are overrided settings in default profile if you add an extra parameter to command line
To use DEV-profile, please, run
/usr/bin/java -jar -Dspring.profiles.active=dev /opt/shinyproxy/shinyproxy-3.0.2.jar
shinyproxy is available on 8092 port, managment port is 9092. Containers ports are started from 30000.
To use PROD-profile, please, run
/usr/bin/java -jar -Dspring.profiles.active=prod /opt/shinyproxy/shinyproxy-3.0.2.jar
shinyproxy is available on 8091 port, managment port is 9091. Containers ports are started from 20000.
To run both command as systemd-service you need to create two service definition.
Example https://github.com/openanalytics/shinyproxy/blob/develop/src/deb/shinyproxy.service
Evgenii
Hi @essemenov ,
Thank you for a detailed explanation.
Before I get into my issue. I have zero knowledge when it comes to frameworks. I am blindly following the documentations.
I tried to deploy 2 diff apps as shown in the below config file but only one of them is working i.e the second one. Looks like the first one is being ignored. I also double checked if my ports are working, they are working when i deploy one application at a time. Can you please take a look and let me know if I am doing anything wrong here.
Basically in the below config file I want Hello application to be run on port 8090 and tabsets app to run on 8080. I want both of them to be working at the same time. Please ignore the service based way of running things. I am fine with running it using jar files.
`
proxy:
title: Open Analytics Shiny Proxy
logo-url: https://www.openanalytics.eu/shinyproxy/logo.png
landing-page: /
heartbeat-rate: 10000
heartbeat-timeout: 60000
port: 8090
authentication: simple
admin-groups: scientists
Example: 'simple' authentication configuration
users:
- name: jack
password: password
groups: scientists
- name: jeff
password: password
groups: mathematicians
docker:
port-range-start: 20000
specs:
- id: 01_hello
display-name: Hello Application
description: Application which demonstrates the basics of a Shiny app
container-cmd: [ "R", "-e", "shinyproxy::run_01_hello()" ]
container-image: openanalytics/shinyproxy-demo
access-groups: [ scientists, mathematicians ]
logging:
file:
name: shinyproxy.log
proxy:
title: Open Analytics Shiny Proxy
logo-url: https://www.openanalytics.eu/shinyproxy/logo.png
landing-page: /
heartbeat-rate: 10000
heartbeat-timeout: 60000
port: 8080
authentication: simple
admin-groups: scientists
Example: 'simple' authentication configuration
users:
- name: jack
password: password
groups: scientists
- name: jeff
password: password
groups: mathematicians
docker:
port-range-start: 20000
specs:
- id: 06_tabsets
container-cmd: [ "R", "-e", "shinyproxy::run_06_tabsets()" ]
container-image: openanalytics/shinyproxy-demo
access-groups: scientists
logging:
file:
name: shinyproxy.log
`
Just in case I am also attaching the config file as a txt file here.
application.txt
Best,
Prashanth
Sorry for late answer! I hope it's still relevant. I attached tar-archive with your config and start.sh script file. Please see it
Thanks you...!!! will check it and let you know.
Apologies for the delay.
I tested it and everything works well. Thanks..!!!
Will close the issue.