How can I prevent my Shiny App from disconnecting in a open-source shiny-server?

非 Y 不嫁゛ 提交于 2021-01-27 17:09:51

问题


I'm running a R shiny application on an open source shiny-server, using Ubuntu and NGINX. However, my app keeps getting the message "Disconnected from the Server" for some reason and I can't seem to get it to work. The shiny app runs perfectly fine on my local.

I've tried the javascript workaround via the following suggestion in Shiny server session time out doesn't work, but it still doesn't seem to work.

Also tried to set app_idle_timeout and app_init_timeout to a longer duration, but to no avail.

This is my nginx config file:

server {
    listen 80;
    listen [::]:80;
    listen 443 ssl;

    server_name some_ip_address;

    location / {
         proxy_pass http://localhost:3838/;
         proxy_redirect http://localhost:3838/ $scheme://$host/;
         proxy_http_version 1.1;
         proxy_set_header Upgrade $http_upgrade;
         proxy_set_header Connection $connection_upgrade;
         proxy_read_timeout 20d;
    }

}

Was wondering if I editing shiny server or nginx config file to make this work? But I understand that it is only possible to extend the timeout in the pro version but I'm guessing there must be some workaround possible.


回答1:


You can disable application idle timeouts in Shiny Server (open source or Pro) by setting app_idle_timeout to 0 in your Shiny Server config file.

For example,

location / {
    app_idle_timeout 0;
}

https://docs.rstudio.com/shiny-server/#application-timeouts

app_idle_timeout -- Defines the amount of time (in seconds) an R process with no active connections should remain open. After the last connection disconnects from an R process, this timer will start and, after the specified number of seconds, if no new connections have been created, the R process will be killed. The default value for app_idle_timeout is 5 seconds.



来源:https://stackoverflow.com/questions/54417101/how-can-i-prevent-my-shiny-app-from-disconnecting-in-a-open-source-shiny-server

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!