个人应用的闪亮服务器配置

Shiny Server configuration for personal apps

我对 shiny-server 配置比较陌生。目前有一堆应用程序托管在根级别的 shiny-server 上,可以通过 http://<ip.address>:3838/appName 访问。我想让服务帐户能够部署应用程序并能够检查日志文件。服务帐户没有也不会具有 sudo 访问权限。服务帐户已添加到名为 shinyUsers 的组中。在这样做的同时,我仍然想确保当前部署在根级别的应用程序仍在运行,并且不会受到配置更改的影响。

通读配置指南后,我了解了一些有关部署个人应用程序的信息。但是我不确定要为 site_dirlog_dir 键添加什么。

以下是我目前的配置文件:

run_as :HOME_USER: shiny;

# Define a server that listens on port 3838
server {
  listen 3838;

  location / {
    user_dirs;

    # Only allow members of the 'shinyUsers' group to host personal applications.
    members_of shinyUsers;

    # When a user visits the base URL rather than a particular application,
    # an index of the applications available in this directory will be shown.
    directory_index off;

  }

  # Define a location at the base URL
  location / {

    # Host the directory of Shiny Apps stored in this directory
    site_dir /srv/shiny-server;

    # Log all Shiny output to files in this directory
    log_dir /var/log/shiny-server;

    # When a user visits the base URL rather than a particular application,
    # an index of the applications available in this directory will be shown.
    directory_index on;
  }
}

以下配置仍将保留根应用程序 运行(尽管 url 中有一个小的变化)并且还提供对服务帐户的访问权限以便能够托管应用程序。应用程序需要位于名为 ShinyApps 的目录中,日志文件将自动进入 ShinyApps

中的 log 子目录

根级应用程序将在 url: http://myserver/appName 上,服务帐户应用程序将在 url: http://myserver/serviceAccountName/appName 上。这是因为我在下面的配置中包含了服务器名称 myserver(此处使用实际的服务器名称)。

run_as :HOME_USER: shiny;
http_keepalive_timeout 50000;

# Define a server that listens on port 80
server {
  listen 80;

 
  #replace ip address with name of the server
  server_name: myserver;

  location / {
    user_dirs;

    # Only allow members of the 'shinyUsers' group to host personal applications.
    # I use a centos7 server so sudo usermod -a -G shinyUsers username
    members_of shinyUsers;
  }

  # Define a location at the base URL
  location / {

    # Host the directory of Shiny Apps stored in this directory
    site_dir /srv/shiny-server;

    # Log all Shiny output to files in this directory
    log_dir /var/log/shiny-server;

    # When a user visits the base URL rather than a particular application,
    # an index of the applications available in this directory will be shown.
    directory_index off;
  }
}