Skip to content

Information for the super user

Find out if you have sudo rights

To check if you have sudo user rights on awb-webapp01 run

Bash
sudo -l -U <username>

If you don't you get 'User is not allowed to run sudo on awb-webapp01.

If successful you get the message

Text Only
...
User <username> may run the following commands on awb-webapp01:
    (ALL : ALL) ALL

Creating new users locally on the VM

Since the move to the "red zone" within interim services, FreeIPA managed accounts no longer work. Therefore, we can create user accounts ourselves with

Text Only
sudo adduser <username>

and following the prompts, where the username is either (for individual accounts) or - (for accounts belonging to a project, see below for access to project directories).

When new users are needed for the shiny dev, the helpdesks only need to request accounts for the VDI and for that account to be able to connect to the space-rshiny-dev VM. The local user accounts can then be created and passed on by anyone within the support group with sudo rights as needed.

We recommend to add all new (project)users to the table at the bottom of Current User Accounts.

Shared project directories

If data analysts want to collaborate on a project using a shared project directory on space-rshiny-dev.

Text Only
sudo mkdir -p /home/shared/<projectname>          //The -p will create the directory and would ignore any errors if the directory already exists.

sudo groupadd <projectname>                 //Create the new group
sudo chgrp -R <projectname> /home/shared/<projectname>   //The -R recursive for subdirectories
sudo chmod -R 2770 /home/shared/<projectname>/      //The 2 inheritence for new subfiles
sudo usermod -a -G <projectname> <username>     //The -G a list of supplementary groups which the user is also a member of. Not gid group!

Where to find the server

The server 'shinyproxy-2.5.0.jar' is in '/usr/bin/shiny/'.

How and when to (re-)start the server

The server needs to be restarted if any changes to the configuration file 'application.yml' are to take effect.

Check the server status: "sudo systemctl status shinyproxy"

To stop the server: "sudo systemctl stop shinyproxy"

(Re-)start the server: "sudo systemctl start shinyproxy". The server must be stopped before restarting for changes to take effect.

The configuration file

The configuration file 'application.yml' and the server 'shinyproxy-2.3.1.jar' must be in the same directory, and can both be found in '/usr/bin/shiny/'.

The configuration file should not be readable by 'group' or 'other.

Text Only
root@space-rshiny-dev:/usr/bin/shiny# ls -lrt
total 99848
....
-rw------- 1 root        root             2312 Sep 15 14:39 application.yml

Otherwise this can be changed by the sudo user with the command "chmod go= application.yml".

The configuration file looks like this:

Text Only
proxy:
  title: SPACe Shiny Proxy
  logo-url: /home/ebreitmoser/ediunilogo.png
  landing-page: /
  bind-address:
  heartbeat-rate: 10000
  heartbeat-timeout: 60000
  port: 3939
  authentication: simple
  admin-groups: scientists
  # Example: 'simple' authentication configuration
  users:
  - name: <user1>
    password: <password1>
    groups: scientists
  - name: <user2>
    password: <password2>
    groups: maths
  # Docker configuration
  docker:
    cert-path: /home/none
    url: http://localhost:2375
    port-range-start: 20000
  specs:
  - id: 01_hello
    display-name: Hello Application
    description: Application which demonstrates the basics of a Shiny app
    container-cmd: ["R", "-e", "shinyproxy::run_01_hello()"]
    container-image: openanalytics/shinyproxy-demo
    access-groups: scientists
  - id: 06_tabsets
    container-cmd: ["R", "-e", "shinyproxy::run_06_tabsets()"]
    container-image: openanalytics/shinyproxy-demo
    access-groups: scientists
  - id: euler
    display-name: Euler Application
    description: Euler Application for Elena
    container-cmd: ["R", "-e", "shiny::runApp('/root/shinyproxy-template/euler',host='0.0.0.0',port=3838)"]
    container-image: openanalytics/shinyproxy-template
    access-groups: scientists, maths


logging:
  file:
    shinyproxy.log

server:
  servlet:
    context-path: /eidf.epcc.ed.ac.uk/space-shiny

Please do NOT change anything in the application file below 'server:'.

How to edit the configuration file

It's advisable to save a copy of the application.yml before editing, as a state to return to if breaking changes are made.

The file can be edited in the user's choice of editor, the below example is for emacs:

  • Run: sudo emacs -nw application.yml
  • Make necessary changes (paying close attention to indentation)
  • To save changes: Ctrl + x, Ctrl + s
  • To exit emacs editor: Ctrl + x, Ctrl + c

How to add new users (aka data analysts)

If you want new users to be able to see and interact with the apps on the website https://eidf.epcc.ed.ac.uk/space-shiny/ you need to add them to the configuration file.

  • Edit 'application.yml' and add the new user below 'users'. Note that indentations are important! We recommend NOT to use the same username and password as the one to access awb-webapp01!
Text Only
users:
- name: <userN>
   password: <passwordN>
   groups: scientists
  • For the changes to become effective, the server has to be restarted.
  • You might want to add the new user to the docker group as well (see Howtoaddanewusertothedockergroup of how to do this)

How to add new apps to the VM

Any new app needs to be added to the configuration file 'application.yml' to become visible and useable on the website.

  • Edit 'application.yml' and add the new app below 'specs'. Note that indentations are important!
Text Only
- id: myappname
    display-name: My new Application
    description: The new Application doing x
    container-cmd: ["R", "-e", "shiny::runApp('/root/<username>/myappname',host='0.0.0.0',port=3838)"]
    container-image: myappname
    access-groups: scientists
  • For the changes to become effective, the server has to be restarted.

What's different for 'flexdashboard' package/rmarkdown

If you are to deploy an app consisting of rmarkdown and making use of the flexdashboard package.

Edit 'application.yml' and add the new app below 'specs'. Note that indentations are important! The only differences between other apps and rmarkdown ones are in the line for 'container-cmd'

Text Only
- id: myappname
    display-name: My new Application using rmarkdown
    description: The new Application doing x with rmarkdown
    container-cmd:  ["R", "-e", "rmarkdown::run('/root/<username>/flexdashboard.Rmd',shiny_args = list(port = 3838, host='0.0.0
.0'))"]
    container-image: myappname
    access-groups: scientists

For the changes to become effective, the server has to be restarted.

How to make apps visible to certain users only

The 'groups' in the configuration file 'application.yml' determines which apps a given user can see and interact with. In our case '' belongs to the group 'maths', only the app 'euler' can be accessed by him:

Text Only
  - name: <user2>
    password: <password2>
    groups: maths
[...]
  - id: euler
    display-name: Euler Application
    description: Euler Application for Elena
    container-cmd: ["R", "-e", "shiny::runApp('/root/shinyproxy-template/euler',host='0.0.0.0',port=3838)"]
    container-image: openanalytics/shinyproxy-template
    access-groups: scientists, maths

How to change the title of the landing page

Currently the title of the landing page is 'SPACe Shiny Proxy'. This can be changed in the configuration file 'application.yml' by editing 'title: SPACe Shiny Proxy'.

Text Only
proxy:
  title: SPACe Shiny Proxy
  logo-url: /home/ebreitmoser/ediunilogo.png

How to change the logo of the landing page

Currently the logo of the landing page is set to the University of Edinburgh one. This is can be changed in the configuration file 'application.yml' by editing 'logo-url: /home/ebreitmoser/ediunilogo.png'.

Text Only
proxy:
  title: SPACe Shiny Proxy
  logo-url: /home/ebreitmoser/ediunilogo.png

How to add a new data analyst to the docker group

In case a new data analyst hasn't been added to the docker group automatically:

Text Only
sudo usermod -aG docker <username>

For the changes to take effect the user will have to log off and back in.

To check who is in the docker group either

Text Only
more /etc/group|grep -in docker
80:docker:x:998:ebreitmoser,sdt,tcrines,mbarnes2,mdrake2,twilliamson2

or

Text Only
members docker
ebreitmoser sdt tcrines mbarnes2 mdrake2 twilliamson2