闪亮的服务器:应用程序无法在AWS上启动

时间:2018-05-17 00:14:26

标签: r amazon-web-services shiny

我无法将自己的shiny应用部署到AWS服务器。我跟着these instructions走了一个发球台。我能够安装shiny并查看我的服务器上运行的示例应用程序。但是,当我尝试启动自己的应用程序时,我看到错误消息:

“发生了错误

应用程序无法启动。

应用程序在初始化期间退出。“

根据许多论坛,例如this one,我需要将/etc/shiny-server/shiny-server.conf文件中的权限从run_as shiny;调整为run_as myusername shiny。我尝试了这个,但它没有用。

我的日志如下所示:

cat /var/log/shiny-server.log
[2018-05-15T08:25:18.770] [INFO] shiny-server - Shiny Server v1.5.7.907 (Node.js v8.10.0)
[2018-05-15T08:25:18.772] [INFO] shiny-server - Using config file "/etc/shiny-server/shiny-server.conf"
[2018-05-15T08:25:18.827] [WARN] shiny-server - Running as root unnecessarily is a security risk! You could be running more securely as non-root.
[2018-05-15T08:25:18.831] [INFO] shiny-server - Starting listener on 0.0.0.0:3838
[2018-05-15T08:25:32.474] [INFO] shiny-server - Created bookmark state directory: /var/lib/shiny-server/bookmarks
[2018-05-15T08:25:32.475] [INFO] shiny-server - Created user bookmark state directory: /var/lib/shiny-server/bookmarks/shiny
[2018-05-16T22:31:45.674] [INFO] shiny-server - Error getting worker: Error: The application exited during initialization.
[2018-05-16T22:40:21.378] [INFO] shiny-server - Error getting worker: Error: The application exited during initialization.
[2018-05-16T22:40:54.257] [INFO] shiny-server - Error getting worker: Error: The application exited during initialization.
[2018-05-16T22:42:02.326] [INFO] shiny-server - Error getting worker: Error: The application exited during initialization.
[2018-05-16T22:42:14.474] [INFO] shiny-server - Error getting worker: Error: The application exited during initialization.
[2018-05-16T22:44:18.246] [INFO] shiny-server - Error getting worker: Error: The application exited during initialization.
[2018-05-16T22:56:41.494] [INFO] shiny-server - Error getting worker: Error: The application exited during initialization.
[2018-05-16T23:00:17.853] [INFO] shiny-server - Error getting worker: Error: The application exited during initialization.
[2018-05-16T23:09:32.642] [INFO] shiny-server - Error getting worker: Error: The application exited during initialization.
[2018-05-16T23:15:39.846] [INFO] shiny-server - Error getting worker: Error: The application exited during initialization.
[2018-05-16T23:16:04.410] [INFO] shiny-server - Error getting worker: Error: The application exited during initialization.
[2018-05-16T23:23:36.596] [INFO] shiny-server - Error getting worker: Error: The application exited during initialization.
[2018-05-16T23:26:43.907] [INFO] shiny-server - Stopping listener on 0.0.0.0:3838
[2018-05-16T23:26:43.907] [INFO] shiny-server - Shutting down worker processes (with notification)
[2018-05-16T23:26:56.234] [INFO] shiny-server - Shiny Server v1.5.7.907 (Node.js v8.10.0)
[2018-05-16T23:26:56.237] [INFO] shiny-server - Using config file "/etc/shiny-server/shiny-server.conf"
[2018-05-16T23:26:56.295] [WARN] shiny-server - Running as root unnecessarily is a security risk! You could be running more securely as non-root.
[2018-05-16T23:26:56.298] [INFO] shiny-server - Starting listener on 0.0.0.0:3838
[2018-05-16T23:27:00.502] [INFO] shiny-server - Error getting worker: Error: The application exited during initialization.
[2018-05-16T23:30:22.786] [INFO] shiny-server - Error getting worker: Error: The application exited during initialization.
[2018-05-16T23:31:25.808] [INFO] shiny-server - Error getting worker: Error: The application exited during initialization.
[2018-05-17T00:35:40.060] [INFO] shiny-server - Error getting worker: Error: The application exited during initialization.

当我输入shiny-server时,我看到:

Using config file "/etc/shiny-server/shiny-server.conf"
[2018-05-17T01:17:12.659] [ERROR] shiny-server - Error loading config: The user 'ubuntu' does not have permissions to run applications as one of the users in 'shiny'. Please restart shiny-server as one of the users in  'shiny'. (/etc/shiny-server/shiny-server.conf:2:1)

配置文件:

cat /etc/shiny-server/shiny-server.conf
# Instruct Shiny Server to run applications as the user "shiny"
run_as ubuntu;

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

  # 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;
  }
}

sanitize_errors off;

非常感谢任何帮助。我觉得我已经如此接近最终推出我的应用程序了!

1 个答案:

答案 0 :(得分:2)

由于您的错误说用户ubuntu不允许启动闪亮的应用程序。请务必以sudo身份登录,请尝试以下操作。如果这不起作用,请检查闪亮的应用程序是否全局安装了sudo access

  • sudo -i
  • sudo systemctl restart shiny-server

或尝试停止并启动它

  • sudo systemctl stop shiny-server
  • sudo systemctl start shiny-server

我在服务器上运行ubuntu btw