Set Up ShinyProxy
The ShinyProxy chapter here describes how to set up and customize your very own ShinyProxy server on Ubuntu (18.04 or 20.04).
If you are short on time, the 1-Click option lets you deploy ShinyProxy on DigitalOcean droplets in fully-tested app environments. You can use this referral link to sign up to DigitalOcean if you don't yet have an account.
Create a VM
tip
You can use your preferred cloud provider or bare metal server running Ubuntu (18.04 or 20.04) for ShinyProxy. But the rest of the tutorial assumes that you use DigitalOcean droplet with Ubuntu 20.04 (LTS).
Use DigitalOcean control panel to create a Droplet based on the one of the supported OS-es for Marketplace images. Select your preferred region, don't forget to add SSH keys.
Install
Once your droplet is up an running, log in with
ssh -i ~/YOUR_SSH_KEY root@YOUR_IP_ADDRESS
,
use your SSH key and IP address.
Update:
Java
First, install Java:
java -version
should return something like this:
Docker
We will install Docker CE (community edition) and Docker Compose:
Check to see if Docker is running sudo service docker status
.
ShinyProxy needs to connect to the docker daemon to spin up the containers for the apps. By default ShinyProxy will do so on port 2375 of the docker host. In order to allow for connections on port 2375, the startup options need to be edited following the ShinyProxy guide.
On an Ubuntu 16.04 LTS or higher that uses systemd
,
one can create a file /etc/systemd/system/docker.service.d/override.conf
:
Add the following content (vim /etc/systemd/system/docker.service.d/override.conf
):
Reload the system daemon and restart Docker:
The sudo systemctl enable docker
enables Docker service start when the system boots.
ShinyProxy
We download the 2.4.0 version of ShinyProxy (in case of newer version, just change the file name accordingly, check for updates here):
Images
Pull two demo Docker images – one of these images is the one we just built in the previous chapter:
Configuration
Create application.yml
in the /etc/shinyproxy
directory:
You can put here the favicon.ico
file as desired.
Now copy these configs using vim /etc/shinyproxy/application.yml
:
Edit /etc/shinyproxy/application.yml
as required (file size limits, apps, heartbeat-timeout
),
then restart ShinyProxy to take effect using sudo service shinyproxy restart
.
Read the ShinyProxy configuration documentation.
Besides adding apps and permissions, edits were made to increase file size limit
and the default heartbeat-timeout: 60000
(1 minute in milliseconds) to 600000
(10 mins), etc. We found these settings more justified in production based on user feedback.
Now cd ~
back to the home (/root
) folder to continue.
Nginx
ShinyProxy is now can be accessed at YOUR_IP_ADDRESS:8080
. We can set the port to 80
which is the standard HTTP port.
Install Nginx:
Edit the config file:
Find the location / {
line and add the following:
Add client_max_body_size 200M;
to the server {
block if handling large files is needed.
Restart nginx with sudo service nginx restart
and you can access the site at http://YOUR_IP_ADDRESS/
.
Firewall
UFW is an Uncomplicated Firewall. We enables the UFW firewall to allow only SSH, HTTP and HTTPS. See a detailed tutorial here.
Finally, enable these rules by running
sudo ufw enable
. This also disables the previously used 8080 port.
Check ufw status
to see: