简体   繁体   中英

Shiny server: application failed to start on AWS

I am having trouble deploying my own shiny apps to an AWS server. I followed these instructions to a tee. I was able to install shiny and see the example applications working on my server. However when I try to launch my own app, I see the error messages:

"An error has occurred

The application failed to start.

The application exited during initialization."

According to many forums, for example this one , I need to adjust the permissions in the /etc/shiny-server/shiny-server.conf file from run_as shiny; to run_as myusername shiny . I tried this, but it didn't work.

My log looks like this:

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.

Also when I type shiny-server I see:

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)

Config file:

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;

Any help would be greatly appreciated. I feel like I am so close to finally launching my app!

As your error says the user ubuntu isn't allowed to start shiny apps. Make sure to login as sudo, try something below. if that doesn't work check that the shiny app is installed globally with sudo access

  • sudo -i
  • sudo systemctl restart shiny-server

or try stopping and starting it

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

Im running ubuntu on my server btw

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM