My Last post showed you how to install R inside a SmartOS zone. This post is about installing the shiny server in the said zone. While setting up R was relatively straight forward, for setting up Shiny server I had to patch some C++ code to make shiny server work on solaris. Which means you don’t have to, just follow along.
First install R in a zone as shown in my earlier post. This is very important, unless you have a working R setup you cannot have a functional working Shiny server. Also make sure to allocate enough CPU, memory, and disk-space for your zone.
# Install some packages pkgin install git-base # Install Shiny R package Rscript -e "install.packages(c('shiny'))" # Next install the shiny server mkdir /opt/src && cd /opt/src git clone https://github.com/rstudio/shiny-server.git cd shiny-server/ # We need a patch for some solaris specific stuff wget https://gist.githubusercontent.com/bhaskarvk/6a15083ab9a7997df0a2/raw/5e7fec0dee4c79b828032ab007bf8b6137f735c3/solaris.diff git apply solaris.diff && rm solaris.diff mkdir tmp cd tmp DIR=`pwd` PATH=$DIR/../bin:$PATH PYTHON=`which PYTHON` PYTHON=`which python` cmake -DCMAKE_INSTALL_PREFIX=/usr/local -DPYTHON="$PYTHON" ../ make mkdir ../build (cd .. && ./bin/npm --python="$PYTHON" rebuild) (cd .. && ./bin/node ./ext/node/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js --python="$PYTHON" rebuild) # Install the software at the predefined location make install
This completes installation of shiny server. Next some post installation stuff
ln -s /usr/local/shiny-server/bin/shiny-server /usr/local/bin useradd -m shiny mkdir -p /var/log/shiny-server mkdir -p /srv/shiny-server mkdir -p /var/lib/shiny-server chown shiny: /var/log/shiny-server /srv/shiny-server /var/lib/shiny-server mkdir -p /etc/shiny-server cd /etc/shiny-server wget https://raw.githubusercontent.com/rstudio/shiny-server/master/config/default.config
That’s it, Shiny is installed and configured. To start it
# We run the shiny server as user shiny su - shiny shiny-server
You should see something like
[2015-10-25 01:49:43.019] [INFO] shiny-server - Shiny Server v18.104.22.168 (Node.js v0.10.40) [2015-10-25 01:49:43.021] [INFO] shiny-server - Using config file "/etc/shiny-server/shiny-server.conf" [2015-10-25 01:49:43.064] [INFO] shiny-server - Starting listener on 0.0.0.0:3838
Congratulations you now have a running shiny server inside a SmartOS zone. The shiny server installation instructions came from the official docs, but I did have to patch some stuff to make it work under solaris. The patch is available on gist. Next I’ll try and create a proper start-up script for shiny-server so that it can be controlled via