Komal Rathi
Komal Rathi

Reputation: 4274

R shinyserver: How to deploy my app on shiny server?

I have followed the steps to setup the shiny server on a Red Hat Enterprise Linux Server release 7.2:

# path to my application on server
/home/anon/shinyapps/myapp/

myapp
├── R # Rscripts
├── data # R objects
├── server.R
├── ui.R
└── www
    └── styles.css

# install R
sudo yum update
sudo yum install R
sudo yum install libcurl-devel openssl-devel

# change Rprofile
sudo vi /usr/lib64/R/library/base/R/Rprofile

# add the following to the Rprofile
# download method
options(download.file.method = "libcurl")

# default CRAN mirror
local({
  r <- getOption("repos")
  r["CRAN"] <- "https://cran.rstudio.com/"
  options(repos=r)
})

# install shiny
sudo su - -c "R -e \"install.packages('shiny')\""

# install shiny server
wget https://download3.rstudio.org/centos5.9/x86_64/shiny-server-1.4.4.801-rh5-x86_64.rpm
sudo yum install --nogpgcheck shiny-server-1.4.4.801-rh5-x86_64.rpm

# edit config file
/etc/shiny-server/shiny-server.conf

This is my config file. I add my app myapp with the location:

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

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

  # Define location at NWP URL
  location /NWP {

    # application directory
    app_dir /home/anony/shinyapps/myapp;

    simple_scheduler 10;

    # log directory
    log_dir /home/anon/shinyapps/myapp/logs;

    # directory structure
    directory_index on;
  }
}

I am trying to fire up this application by going to http://myserveraddress:3838/NWP/ it says This site can’t be reached. What am I missing?

What have I tried:

$ sudo firewall-cmd --zone=public --permanent --add-port=3838/tcp && firewall-cmd --reload
success
Authorization failed.
Make sure polkit agent is running or run the application as superuser.

$ systemctl status firewalld
● firewalld.service - firewalld - dynamic firewall daemon
   Loaded: loaded (/usr/lib/systemd/system/firewalld.service; enabled; vendor preset: enabled)
   Active: active (running) since Fri 2016-08-05 10:44:34 EDT; 1 weeks 0 days ago
 Main PID: 1032 (firewalld)
   CGroup: /system.slice/firewalld.service
           └─1032 /usr/bin/python -Es /usr/sbin/firewalld --nofork --nopid

This worked:

sudo firewall-cmd --zone=public --add-port=3838/tcp --permanent && sudo firewall-cmd --zone=public --add-port=3838/tcp

Thanks

Upvotes: 1

Views: 1212

Answers (1)

Komal Rathi
Komal Rathi

Reputation: 4274

This worked:

sudo firewall-cmd --zone=public --add-port=3838/tcp --permanent && sudo firewall-cmd --zone=public --add-port=3838/tcp

Upvotes: 1

Related Questions