Help hub members to deploy correctly and easily an Web application, initially developed in RShiny, under Kubernetes.
To help hub members to correctly and easily deploy a web application, initially developed in RShiny, under Kubernetes.
## Workflow
You are in one of the gitlab projects dedicated to Rshiny application deployment under Kubernetes :**"rshiny-k8s".**
This workflow described all steps to follow in order to deploy your app under kubernetes available at Institut Pasteur - Paris.
## Project structure and dependencies
Today,
1. Develop your shiny app
2. Create a docker image
3. Init the deployement under gitlab
4. Configure your deployement under kubernetes.
### Step 1. Develop your shiny app
Create your shiny app by following the basic best practices like using multiple files (ui.R, server.R and global.R) and save files on gitlab project.
Your are free to develop your app as you want. The only constraint is to list the requiered packages.
List all the packages needed by your application in an dedicated file - named "packages_to_install.csv" respecting the following structure :
---> Name of the package;Name of the repository where the package will be found
```console
Package_name;Deposit_name
shiny;cran
dplyr;cran
affy;bioconductor
...
```
Be carefull not to put any space character at the end of word.
This file will be used by the dockerfile in order to install all packages on the shiny server.
### Step 2. Create a docker image
The purpose of the docker image is to create a proper environment where your Shiny application will be hosted. Your application will be containerized.
This tutorial is divided into several gitlab projects:
- project named **"rshiny-k8s"** : For the developer, the co For the developer, the configuration files and templates to build the initial docker image and CI configuration ( /.gitlab-ci.yml ) .
- project named **"rshiny-k8s"** special branch ["docs"](https://gitlab.pasteur.fr/hub/rshiny-k8s/-/tree/docs) : For Developer, branch dedicated to write the complete documentation under sphinx (available on https://hub.pages.pasteur.fr/rshiny-k8s/)
- project named ["rshiny-k8s-example"](https://gitlab.pasteur.fr/hub/rshiny-k8s-example) : For Developper, configuration and template files for deployment under kubernetes with (chart folder) or without helm (k8s folder)
Contains only a simple example of Shiny application.
The image used is based on the previous image created in the "rshiny-k8s" project
This container will contain:
In the future:
- an Ubuntu Linux system with R installed
- a shiny server (not the professional version)
- your app
All these requirements are listed in a dedicated file named "Dockefile".
This tutorial is divided into several gitlab projects:
- project named **"rshiny-k8s"** : For the developer, the configuration files and template to build the initial docker image and CI configuration ( /.gitlab-ci.yml ) .
- project named **"rshiny-k8s"** special branch ["docs"](https://gitlab.pasteur.fr/hub/rshiny-k8s/-/tree/docs) : For Developer, branch dedicated to write the complete documentation under sphinx (available on https://hub.pages.pasteur.fr/rshiny-k8s/)
- project named "rshiny-k8s-helm" : For Developper, configuration files and template in helm for deployment under kubernetes
- project named ["rshiny-k8s-example"](https://gitlab.pasteur.fr/hub/rshiny-k8s-example): For user only, with simplified configuration files and a template to "deploy" your Shiny application on the kube.
Contains several examples of Shiny application templates
The image used is based on the previous image created in the "rshiny-k8s" project
Use the Helm configuration of the "rshiny-k8s-helm" project
In this file, you only need to indicate the folder name of your application. Replace "MyAppName" with the correct name.
## Workflows
### for Developer
```python
1. Create a basic docker image with R and Shiny Server
FROMrocker/shiny:latest
2. Create a docker image, based on the previous one, with Rshiny application and R packages needed
USERroot
3. Initiate the deployement under gitlab with CI configuration
# delete previous exemples on shiny-server
4. Configure the deployement under kubernetes
RUNrm-rf/srv/shiny-server/*
5. Configure the deployement under kubernetes with helm
# change permission for user shiny
6. Deploy the application using your previous recipe