rstudio / shiny-server

Host Shiny applications over the web.
https://rstudio.com/shiny/server
Other
716 stars 288 forks source link

My shiny server is loaded, but not active #357

Closed mnunes closed 6 years ago

mnunes commented 6 years ago

My shiny server is not active. The status I get after I run sudo systemctl start shiny-server is

sudo systemctl status shiny-server.service
● shiny-server.service - ShinyServer
   Loaded: loaded (/etc/systemd/system/shiny-server.service; enabled; vendor preset: disabled)
   Active: inactive (dead) since Tue 2018-05-01 13:34:58 -03; 1s ago
  Process: 19744 ExecStopPost=/usr/bin/env sleep 5 (code=exited, status=0/SUCCESS)
  Process: 19733 ExecStart=/usr/bin/env bash -c exec /opt/shiny-server/bin/shiny-server >> /var/log/shiny-server.log 2>&1 (code=exited, status=0/SUCCESS)
 Main PID: 19733 (code=exited, status=0/SUCCESS)

 May 01 13:34:52 shiny.estatistica.ufrn.br systemd[1]: Started ShinyServer.
 May 01 13:34:52 shiny.estatistica.ufrn.br systemd[1]: Starting ShinyServer...

It seems I have a problem with the log file location. These are the last entries in my log file:

[2018-05-01T13:34:53.007] [INFO] shiny-server - Shiny Server v1.5.7.907 (Node.js v8.10.0)
[2018-05-01T13:34:53.010] [INFO] shiny-server - Using config file "/etc/shiny-server/shiny-server.conf"
[2018-05-01T13:34:53.078] [ERROR] shiny-server - Error loading config: The preserve_logs directive can't be used here (/etc/shiny-server/shiny-server.conf:8:3)
[2018-05-01T13:34:53.079] [INFO] shiny-server - Shutting down worker processes

This is my /etc/shiny-server/shiny-server.conf file:

# Instruct Shiny Server to run applications as the user "shiny"
run_as shiny;

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

  preserve_logs true;

  # Define a location at the base URL
  location / {

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

    # if a user is idle for x seconds, disconnect them from the server
    app_session_timeout 3600;

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

I don't know what else can I do. I noticed that systemctl status shiny-server.service gives me the shiny.estatistica.ufrn.br url. However, my website is at http://shiny.estatistica.ccet.ufrn.br (notice there is a ccet subdomain).

I am running R version 3.4.4 (2018-03-15) and shiny 1.0.5 on CentOS Linux release 7.4.1708 (Core).

fereshtehRS commented 6 years ago

@mnunes It seems that the problem is with the preserve_logs true; configuration. This should be moved to the top level (out of the server directive).

mnunes commented 6 years ago

You were right. I had to change preserve_logs true; place, comment app_session_timeout 3600; and change the port from 80 to 443, but everything is working now.

Thank you!