ShinyProxy 1-click App
Tags: shinyproxy, shiny, rstats, docker
Published: 2021-09-02 20:28:10

*By: [Peter Solymos](https://hosting.analythium.io/author/peter/)*

**ShinyProxy is a great way to deploy containerized Shiny apps to production and it is only 1 click away.**

ShinyProxy is one of the most popular options to host any type of containerized web application, including but not limited to Shiny apps. It provides authentication, authorization, application isolation, scalability, and a lot more with [extensive documentation](https://shinyproxy.io/).

ShinyProxy is free and open-source. Although free here means that you are free to do anything with the software within the broad limits of the Apache 2 license. But you will have to manage your server and pay for hosting it.

## Is there a simple setup process?

Setting up ShinyProxy can be a bit intimidating if this is the first time you are venturing into this realm. [Tutorials](https://hosting.analythium.io/tag/shinyproxy/) about the installation process, configuration, and custom domains are great. But you might wonder if there is an easier way to fast forward the process.

This is the reason [Analythium Solutions](https://analythium.io/) published the [ShinyProxy  1-click app in the DigitalOcean marketplace](https://marketplace.digitalocean.com/apps/shinyproxy?refcode=a8041699739d). We have been successfully using the setup reflected in the tutorials and the 1-click app for some years with our consulting clients. Automating the system setup is beneficial for our own purposes. Releasing it as a marketplace app, however, means that others can benefit from our learnings too.

<figure>
<img src="https://hosting.analythium.io/content/images/2021/08/Screen-Shot-2021-08-16-at-10.28.19-PM.png" class="kg-image" sizes="(min-width: 720px) 720px" srcset="https://hosting.analythium.io/content/images/size/w600/2021/08/Screen-Shot-2021-08-16-at-10.28.19-PM.png 600w, https://hosting.analythium.io/content/images/size/w1000/2021/08/Screen-Shot-2021-08-16-at-10.28.19-PM.png 1000w, https://hosting.analythium.io/content/images/size/w1600/2021/08/Screen-Shot-2021-08-16-at-10.28.19-PM.png 1600w, https://hosting.analythium.io/content/images/size/w2400/2021/08/Screen-Shot-2021-08-16-at-10.28.19-PM.png 2400w" width="2000" height="1250" alt="The ShinyProxy 1-click app info page" /><figcaption aria-hidden="true">The ShinyProxy 1-click app info page</figcaption>
</figure>

This post is a screenshot-based demo of the setup process explaining how you can reclaim an hour of your day. There is also a video version:

<div class="iframe">

<div id="player">

</div>

<div class="player-unavailable">

# An error occurred.

<div class="submessage">

[Try watching this video on www.youtube.com](https://www.youtube.com/watch?v=aoIlaOYRpQs), or enable JavaScript if it is disabled in your browser.

</div>

</div>

</div>

ShinyProxy 1-click app tutorial video

## What is the Marketplace?

The [DigitalOcean Marketplace](https://marketplace.digitalocean.com/) is a collection of so-called 1-click apps, which are pre-configured [machine images](https://docs.digitalocean.com/products/images/custom-images/) that can be used to spin up virtual machines in minutes.

The apps are maintained by DigitalOcean or different vendors. Apps include WordPress for blogging, [RStudio](https://marketplace.digitalocean.com/apps/rstudio) image for computing applications, our [ShinyProxy image](https://marketplace.digitalocean.com/apps/shinyproxy?refcode=a8041699739d), and a lot more.

## Get started

[DigitalOcean](https://www.digitalocean.com/) has a simple and intuitive browser-based dashboard and prices are predictable pricing.

### Signup

When you create a DigitalOcean account, you can choose to sign up with an email address or with Google or GitHub single sign-on (SSO) following the prompts after clicking the 'Sign Up' button. Once you sign up, you can set up [two-factor authentication](https://www.digitalocean.com/docs/accounts/security/2fa/) to protect your account. You can consider using this [referral link](https://m.do.co/c/a8041699739d) and get $100 free credits on sign-up.

### Login

To log into your account, click on the 'Sign In' button in the top right corner. This should take you to a form where you can sign in using email and password, or use Google or GitHub SSO. Once you pass login, you'll be prompted to type in a 6-digit verification code that you receive to the email address that you have used for signup.

### Add your SSH key

Ideally, you should add your SSH key to your DigitalOcean account before creating the creating resources (virtual machines, etc.). This way your SSH key can be deployed to the new servers and accessing those through the command line will be straightforward.

To set up an SSH key, follow [this](https://phoenixnap.com/kb/generate-ssh-key-windows-10) guide. Once your SSH key is generated you will see two files (these fine names might be different depending on how you generated them), one public, one private. These two files are cryptographically matched, like a key and a lock.

Open the public key file (e.g. `.ssh/id_rsa.pub`) in a text editor, copy the content. Now go to your DigitalOcean Dashboard, under Settings find Security. Click 'Add SSH Key'. Paste here the contents of the public key file. Add a name, that will remind you which one is yours.

## Spin up a "droplet"

Now you signed up and logged in to your account and see your dashboard. The top navigation has a search bar to quickly find your resources, a 'Create' button with a dropdown listing the most common actions. This is where you can find an option to create a new Droplet. What is a "droplet"? A droplet is a small part of the ocean, and this is how DigitalOcean refers to its [virtual machines](https://docs.digitalocean.com/products/droplets/).

<figure>
<img src="https://hosting.analythium.io/content/images/2021/08/Screen-Shot-2021-08-16-at-10.16.59-PM.png" class="kg-image" sizes="(min-width: 720px) 720px" srcset="https://hosting.analythium.io/content/images/size/w600/2021/08/Screen-Shot-2021-08-16-at-10.16.59-PM.png 600w, https://hosting.analythium.io/content/images/size/w1000/2021/08/Screen-Shot-2021-08-16-at-10.16.59-PM.png 1000w, https://hosting.analythium.io/content/images/size/w1600/2021/08/Screen-Shot-2021-08-16-at-10.16.59-PM.png 1600w, https://hosting.analythium.io/content/images/size/w2400/2021/08/Screen-Shot-2021-08-16-at-10.16.59-PM.png 2400w" width="2000" height="1250" alt="The user dashboard with the Create button" /><figcaption aria-hidden="true">The user dashboard with the Create button</figcaption>
</figure>

Click the 'Create' button and select the 'Droplets - create cloud servers' option. This will take you to a page where you can set the specifications for the new Droplet. You can create the new Droplet as a fresh Linux server (you can select many different Linux distributions, including Ubuntu, Debian, etc., and different versions), or you can use one of your saved images to replicate a given setting.

Search and select the ShinyProxy 1-Click app. This is a pre-configured image on Ubuntu 20.04.

<figure>
<img src="https://hosting.analythium.io/content/images/2021/08/Screen-Shot-2021-08-16-at-10.17.21-PM.png" class="kg-image" sizes="(min-width: 720px) 720px" srcset="https://hosting.analythium.io/content/images/size/w600/2021/08/Screen-Shot-2021-08-16-at-10.17.21-PM.png 600w, https://hosting.analythium.io/content/images/size/w1000/2021/08/Screen-Shot-2021-08-16-at-10.17.21-PM.png 1000w, https://hosting.analythium.io/content/images/size/w1600/2021/08/Screen-Shot-2021-08-16-at-10.17.21-PM.png 1600w, https://hosting.analythium.io/content/images/size/w2400/2021/08/Screen-Shot-2021-08-16-at-10.17.21-PM.png 2400w" width="2000" height="1250" alt="Select ShinyProxy from the Marketplace as your image" /><figcaption aria-hidden="true">Select ShinyProxy from the Marketplace as your image</figcaption>
</figure>

After the image is selected, you can choose a plan based on hardware configuration and pricing (see Droplet pricing [here](https://www.digitalocean.com/docs/droplets/resources/choose-plan/)).

<figure>
<img src="https://hosting.analythium.io/content/images/2021/08/Screen-Shot-2021-08-16-at-10.17.43-PM.png" class="kg-image" sizes="(min-width: 720px) 720px" srcset="https://hosting.analythium.io/content/images/size/w600/2021/08/Screen-Shot-2021-08-16-at-10.17.43-PM.png 600w, https://hosting.analythium.io/content/images/size/w1000/2021/08/Screen-Shot-2021-08-16-at-10.17.43-PM.png 1000w, https://hosting.analythium.io/content/images/size/w1600/2021/08/Screen-Shot-2021-08-16-at-10.17.43-PM.png 1600w, https://hosting.analythium.io/content/images/size/w2400/2021/08/Screen-Shot-2021-08-16-at-10.17.43-PM.png 2400w" width="2000" height="1250" />
</figure>

Next, you can pick your data region, I picked Toronto (Canada) here, feel free to choose what's closest to you.

<figure>
<img src="https://hosting.analythium.io/content/images/2021/08/Screen-Shot-2021-08-16-at-10.18.01-PM.png" class="kg-image" sizes="(min-width: 720px) 720px" srcset="https://hosting.analythium.io/content/images/size/w600/2021/08/Screen-Shot-2021-08-16-at-10.18.01-PM.png 600w, https://hosting.analythium.io/content/images/size/w1000/2021/08/Screen-Shot-2021-08-16-at-10.18.01-PM.png 1000w, https://hosting.analythium.io/content/images/size/w1600/2021/08/Screen-Shot-2021-08-16-at-10.18.01-PM.png 1600w, https://hosting.analythium.io/content/images/size/w2400/2021/08/Screen-Shot-2021-08-16-at-10.18.01-PM.png 2400w" width="2000" height="1250" />
</figure>

Finally, you can add additional monitoring (recommender: this allows collecting more refined monitoring data and is required for alerts).

Authentication can be based on a root password or using SSH keys. If you select SSH key-based authentication, password-based authentication will be turned off by default.

Finally, you can specify how many Droplets you wish to create with the same specifications, you can edit the hostname (this is how the new Droplet will show up in the dashboard), or add backup for 20% of the Droplet price.

<figure>
<img src="https://hosting.analythium.io/content/images/2021/08/Screen-Shot-2021-08-16-at-10.18.33-PM.png" class="kg-image" sizes="(min-width: 720px) 720px" srcset="https://hosting.analythium.io/content/images/size/w600/2021/08/Screen-Shot-2021-08-16-at-10.18.33-PM.png 600w, https://hosting.analythium.io/content/images/size/w1000/2021/08/Screen-Shot-2021-08-16-at-10.18.33-PM.png 1000w, https://hosting.analythium.io/content/images/size/w1600/2021/08/Screen-Shot-2021-08-16-at-10.18.33-PM.png 1600w, https://hosting.analythium.io/content/images/size/w2400/2021/08/Screen-Shot-2021-08-16-at-10.18.33-PM.png 2400w" width="2000" height="1250" alt="Set monitoring, security, and replication levels" /><figcaption aria-hidden="true">Set monitoring, security, and replication levels</figcaption>
</figure>

If everything looks good, you can click the 'Create Droplet' button at the bottom and wait for your Droplet to be provisioned.

<figure>
<img src="https://hosting.analythium.io/content/images/2021/08/Screen-Shot-2021-08-16-at-10.19.09-PM.png" class="kg-image" sizes="(min-width: 720px) 720px" srcset="https://hosting.analythium.io/content/images/size/w600/2021/08/Screen-Shot-2021-08-16-at-10.19.09-PM.png 600w, https://hosting.analythium.io/content/images/size/w1000/2021/08/Screen-Shot-2021-08-16-at-10.19.09-PM.png 1000w, https://hosting.analythium.io/content/images/size/w1600/2021/08/Screen-Shot-2021-08-16-at-10.19.09-PM.png 1600w, https://hosting.analythium.io/content/images/size/w2400/2021/08/Screen-Shot-2021-08-16-at-10.19.09-PM.png 2400w" width="2000" height="1250" alt="Click &#39;Create Droplet&#39;" /><figcaption aria-hidden="true">Click 'Create Droplet'</figcaption>
</figure>

Once the progress bar reaches 100% you can copy the IP address and visit the droplet in the browser or in the terminal.

<figure>
<img src="https://hosting.analythium.io/content/images/2021/08/Screen-Shot-2021-08-16-at-10.19.28-PM.png" class="kg-image" sizes="(min-width: 720px) 720px" srcset="https://hosting.analythium.io/content/images/size/w600/2021/08/Screen-Shot-2021-08-16-at-10.19.28-PM.png 600w, https://hosting.analythium.io/content/images/size/w1000/2021/08/Screen-Shot-2021-08-16-at-10.19.28-PM.png 1000w, https://hosting.analythium.io/content/images/size/w1600/2021/08/Screen-Shot-2021-08-16-at-10.19.28-PM.png 1600w, https://hosting.analythium.io/content/images/size/w2400/2021/08/Screen-Shot-2021-08-16-at-10.19.28-PM.png 2400w" width="2000" height="1250" alt="Droplet creation in progress" /><figcaption aria-hidden="true">Droplet creation in progress</figcaption>
</figure>

In the meantime you can study the 1-click app information on what to do next once the virtual machine is up.

<figure>
<img src="https://hosting.analythium.io/content/images/2021/08/Screen-Shot-2021-08-16-at-10.19.56-PM.png" class="kg-image" sizes="(min-width: 720px) 720px" srcset="https://hosting.analythium.io/content/images/size/w600/2021/08/Screen-Shot-2021-08-16-at-10.19.56-PM.png 600w, https://hosting.analythium.io/content/images/size/w1000/2021/08/Screen-Shot-2021-08-16-at-10.19.56-PM.png 1000w, https://hosting.analythium.io/content/images/size/w1600/2021/08/Screen-Shot-2021-08-16-at-10.19.56-PM.png 1600w, https://hosting.analythium.io/content/images/size/w2400/2021/08/Screen-Shot-2021-08-16-at-10.19.56-PM.png 2400w" width="2000" height="1250" alt="ShinyProxy 1-click app description" /><figcaption aria-hidden="true">ShinyProxy 1-click app description</figcaption>
</figure>

Click on the droplet name to see the relevant dashboard. The green dot indicates a healthy instance, but you might have to wait another minute before you see CPU and memory usage info. Click on the 'ipv4' address, it will copy the address to your clipboard.

<figure>
<img src="https://hosting.analythium.io/content/images/2021/08/Screen-Shot-2021-08-16-at-10.21.06-PM.png" class="kg-image" sizes="(min-width: 720px) 720px" srcset="https://hosting.analythium.io/content/images/size/w600/2021/08/Screen-Shot-2021-08-16-at-10.21.06-PM.png 600w, https://hosting.analythium.io/content/images/size/w1000/2021/08/Screen-Shot-2021-08-16-at-10.21.06-PM.png 1000w, https://hosting.analythium.io/content/images/size/w1600/2021/08/Screen-Shot-2021-08-16-at-10.21.06-PM.png 1600w, https://hosting.analythium.io/content/images/size/w2400/2021/08/Screen-Shot-2021-08-16-at-10.21.06-PM.png 2400w" width="2000" height="1250" alt="Droplet about the new instance" /><figcaption aria-hidden="true">Droplet about the new instance</figcaption>
</figure>

## API Creation

In addition to creating a Droplet from the ShinyProxy 1-Click App via the control panel, you can also use the [DigitalOcean API](https://digitalocean.com/docs/api).

As an example, to create a 4GB ShinyProxy Droplet in the SFO2 region, you can use the following curl command. You’ll need to either save your [API access token](https://docs.digitalocean.com/reference/api/create-personal-access-token/) to an environment variable or substitute it into the command below.

``` shell
curl -X POST -H 'Content-Type: application/json' \
     -H 'Authorization: Bearer '$TOKEN'' -d \
    '{"name":"choose_a_name","region":"sfo2","size":"s-2vcpu-4gb","image":"analythium-shinyproxy-20-04"}' \
    "https://api.digitalocean.com/v2/droplets"
```

## Log in using the ShinyProxy UI

It takes some time for all the services, including Docker and ShinyProxy to come online. Once your new droplet with the ShinyProxy 1-Click app is up and running, you can visit your droplet's IP address. Use `admin`/`password` or `user`/`password` as user name and password to log into your ShinyProxy instance.

<figure>
<img src="https://hosting.analythium.io/content/images/2021/08/Screen-Shot-2021-08-16-at-10.23.28-PM.png" class="kg-image" sizes="(min-width: 720px) 720px" srcset="https://hosting.analythium.io/content/images/size/w600/2021/08/Screen-Shot-2021-08-16-at-10.23.28-PM.png 600w, https://hosting.analythium.io/content/images/size/w1000/2021/08/Screen-Shot-2021-08-16-at-10.23.28-PM.png 1000w, https://hosting.analythium.io/content/images/size/w1600/2021/08/Screen-Shot-2021-08-16-at-10.23.28-PM.png 1600w, https://hosting.analythium.io/content/images/size/w2400/2021/08/Screen-Shot-2021-08-16-at-10.23.28-PM.png 2400w" width="2000" height="1250" alt="ShinyProxy login page" /><figcaption aria-hidden="true">ShinyProxy login page</figcaption>
</figure>

Once you are in, you'll see two demo R Shiny applications. Try them to make sure Docker is running fine.

<figure>
<img src="https://hosting.analythium.io/content/images/2021/08/Screen-Shot-2021-08-16-at-10.23.41-PM.png" class="kg-image" sizes="(min-width: 720px) 720px" srcset="https://hosting.analythium.io/content/images/size/w600/2021/08/Screen-Shot-2021-08-16-at-10.23.41-PM.png 600w, https://hosting.analythium.io/content/images/size/w1000/2021/08/Screen-Shot-2021-08-16-at-10.23.41-PM.png 1000w, https://hosting.analythium.io/content/images/size/w1600/2021/08/Screen-Shot-2021-08-16-at-10.23.41-PM.png 1600w, https://hosting.analythium.io/content/images/size/w2400/2021/08/Screen-Shot-2021-08-16-at-10.23.41-PM.png 2400w" width="2000" height="1250" alt="ShinyProxy listing the available applications" /><figcaption aria-hidden="true">ShinyProxy listing the available applications</figcaption>
</figure>

Now you can modify the configuration to deploy your own apps. This will require you to access the droplet through a secure shell (SSH).

## Log in through SSH

Secure shell or `ssh` is a command-line tool and also a cryptographic [network protocol](https://en.wikipedia.org/wiki/Secure_Shell_Protocol) for operating network services securely over an unsecured network.

SSH provides a secure channel connecting an SSH client application with an SSH server (the standard port for SSH is 22).

You'll be able to log into a new Droplet if your SSH key was added on droplet creation:

``` bash
ssh -i c:/.ssh/id_rsa root@142.93.156.135
```

This will use the SSH private key (`c:/.ssh/id_rsa`) to let you into the server as the `root` user (superuser).

I used the full path to tell `ssh` where to find the private key (using the `-i` flag) that will be matched with the public key already on the server. You'll be asked to add the server to your list of trusted hosts on the first login, just answer yes.

<figure>
<img src="https://hosting.analythium.io/content/images/2021/08/Screen-Shot-2021-08-16-at-10.25.27-PM.png" class="kg-image" sizes="(min-width: 720px) 720px" srcset="https://hosting.analythium.io/content/images/size/w600/2021/08/Screen-Shot-2021-08-16-at-10.25.27-PM.png 600w, https://hosting.analythium.io/content/images/size/w1000/2021/08/Screen-Shot-2021-08-16-at-10.25.27-PM.png 1000w, https://hosting.analythium.io/content/images/size/w1600/2021/08/Screen-Shot-2021-08-16-at-10.25.27-PM.png 1600w, https://hosting.analythium.io/content/images/2021/08/Screen-Shot-2021-08-16-at-10.25.27-PM.png 1770w" width="1770" height="1264" alt="Message of the day after log in through SSH" /><figcaption aria-hidden="true">Message of the day after log in through SSH</figcaption>
</figure>

Edit `/etc/shinyproxy/application.yml` to configure your instance. Pay special attention to authentication: it is set to `simple`. You should change user names and passwords, possibly the authentication type.

Pull Docker images and add those to the configuration file to deploy your Shiny apps.

Then restart ShinyProxy for the changes to take effect using `sudo service shinyproxy restart`.

All this is explained in the following posts:

-   ⚙️ [Advanced Configuration for ShinyProxy](https://hosting.analythium.io/advanced-configuration-for-shinyproxy/?utm_source=as-digest&utm_medium=email&utm_campaign=aug-2021)
-   🔄 [Update Existing Shiny Apps in ShinyProxy](https://hosting.analythium.io/update-existing-shiny-apps-in-shinyproxy/?utm_source=as-digest&utm_medium=email&utm_campaign=aug-2021)
-   🚀 [The Quickest Way to Add New Apps to ShinyProxy](https://hosting.analythium.io/the-quickest-way-to-add-new-apps-to-shinyproxy/?utm_source=as-digest&utm_medium=email&utm_campaign=aug-2021)

You can also go ahead and set up a custom domain name and HTTPS:

-   🔒 [Custom Domain and Security for ShinyProxy with Nginx](https://hosting.analythium.io/custom-domain-and-security-for-shinyproxy-with-nginx/?utm_source=as-digest&utm_medium=email&utm_campaign=aug-2021)
-   🔒 [Securing ShinyProxy with Caddy Server](https://hosting.analythium.io/securing-shinyproxy-with-caddy-server/?utm_source=as-digest&utm_medium=email&utm_campaign=aug-2021)

Don't forget to destroy (and not just power off) your droplet if you don't need it any longer to avoid any unwanted changes.

## Conclusions

The ShinyProxy 1-click app is a machine image that helps you get your production server up and running in no time. The usual setup process can take anywhere between 30 minutes to an hour. With the 1-click app, it takes only a few minutes. It is still valuable to understand the details, but the app can be a real-time saver in the long run.

## Further readings

-   [ShinyProxy website](https://shinyproxy.io/)
-   [ShinyProxy forum](https://support.openanalytics.eu/): Q&A website under the ShinyProxy category
-   [1-Click App Support](https://github.com/analythium/shinyproxy-1-click/issues)
-   [DigitalOcean product documentation](https://www.digitalocean.com/docs/)