SnpHub搭建(四) | SnpHub实例的上线

在装好了环境(SnpHub搭建 | CentOS 7下配置SnpHub所需系统环境)、准备好了数据(SnpHub搭建 | 数据预处理与样本描述文件准备)、填好配置文件(SnpHub搭建 | 手动处理数据后的配置文件填写)之后,就可以准备将SnpHub实例上线使用了。

0. 目录

1. Shiny-Server的安装

官方介绍:Open Source Shiny Server provides a platform on which you can host multiple Shiny applications on a single server, each with their own URL or port. It enables you to support non-websocket-enabled browsers like Internet Explorer 10, and is available under an AGPLv3 license.

官方安装教程:Download Shiny Server for Red Hat/CentOS 6+

官方配置教程:Shiny Server Professional v1.5.14 Administrator's Guide

wget https://download3.rstudio.org/centos6.3/x86_64/shiny-server-1.5.14.948-x86_64.rpm
sudo yum install --nogpgcheck shiny-server-1.5.14.948-x86_64.rpm

# 安装完成后启动、停止与重启shiny-server
sudo systemctl start shiny-server
sudo systemctl stop shiny-server
sudo systemctl restart shiny-server

# 允许/禁止开机启动
sudo systemctl enable shiny-server
sudo systemctl disable shiny-server

2. Shiny-server的简单配置与SnpHub实例上线

安装完成后,默认配置文件路径为/etc/shiny-server/shiny-server.conf

去掉注释后,配置文件内容如下:

run_as shiny;

server {
  listen 3838;

  location / {
    site_dir /srv/shiny-server;
    log_dir /var/log/shiny-server;

    directory_index on;
  }
}

这表示,shiny-server正在监听3838端口,有一个URL路径是URL根目录。shiny应用放在路径/srv/shiny-server中,应用日志放在/var/log/shiny-server中。

当访问URL<ip>:3838/的时候,shiny-server会在路径/srv/shiny-server中寻找index.html文件。

directory_index项表示当未寻找到index.html文件时,是否列出文件夹内各文件(夹)。出于安全考虑,建议设为off

如果把SnpHub实例整个文件夹命名为SnpHub-1,并放入路径/srv/shiny-server中,则可以通过网址<ip>:3838/SnpHub-1访问到。

如果浏览器返回无法连接服务器或类似错误,请检查对应端口是否开放、Shiny-server是否运行

3. Shiny-server配置其他应用路径

若只想改变应用放置路径或日志文件路径,则更改site_dirlog_dir 对应的路径即可。

若想增加应用路径,下述配置文件表示增加了shiny应用目录/user/someone/shinyApps。当访问<ip>:3838/App2/snphub-2时,shiny-server会在/user/someone/shinyApps路径下(而非/srv/shiny-server)寻找shiny应用snphub-2

run_as shiny;

server {
  listen 3838;

  location / {
    site_dir /srv/shiny-server;
    log_dir /var/log/shiny-server;

    directory_index off;
  }

  location /App2 {
    site_dir /user/someone/shinyApps;
    log_dir /user/someone/shinyLogs;

    directory_index off;
  }
}
原文地址:https://www.cnblogs.com/esctrionsit/p/13415141.html