Welcome to Shiny-K8s’s documentation!
Introduction
At the bioinformatics hub of Institut Pasteur - Paris, our Shiny-K8s toolkit simplifies the deployment of R Shiny and shiny-python apps. It uses Docker, Kubernetes, Helm, and GitLab-CI/CD for automated deployment. It promotes software developement best practice with GitLab source hosting and new instance automatically deployed for any new branch. Features include auto-scaling, updates without downtime, persistent storage, and private project content. The toolkit provides step-by-step documentation, and is available under an MIT license.
The toolkit is based on GitLab project for hosting the source code which encourages reproducibility, indeed every change in source code is commited, tracked, and versionized, thus we always know who made what. When it comes to projects hosted in a git repository, using branches is also a good practice for introducing new features, fixing issues, or simply testing data and libraries updates. With every new branch, the toolkit automatically starts a new instance of the application, allowing you to test and share this new version of your application before officially publishing it, thanks to the continuous Integration and continuous deployment (CI/CD).
For end-user and ease of use, the toolkit propose togglable features such as auto scaling to scall up the resources (cpu/ram) associated with your application only when it is needed, no-downtime which start the next version of your application before shutting down the old one, persistent storage if you have results computed by your app, and also the possibility to keep the content of your gitlab project private while exposing the running app publicly. The toolkit comes with step-by-step documentation guiding the users to use the toolkit, configure the project and how to estimate and ask resources in the Kubernetes clusters. In terms of security, the app is hosted in a container in read-only, with an applicative user (i.e not root). This means that in case of security issue in the source code of the app or shiny, the source code of the app cannot be changed by malicious attacker. This also means that an application cannot see the private data of another application. The docker image is built by ourselves, reducing the exposition to unmaintained images that have known security issues. Building the image ourselves also allow to provide any version of R, shiny-server, ubuntu, debian, python a user could ask for.
Stay tuned
Join us on rocket chat #Shiny-K8S-Toolkit to get updates on images (new or deprecated R/Python versions, bug‑fix releases); for asking for supporting specific versions, short troubleshooting, or forensic tips; and for reporting bugs or requesting features.
How documentation is organized
This documentation is composed of several parts depending on the user profile.
For user, this documentation will guide you in how to configure your gitlab project, and then configure the docker image that will host your application. Once configured, you will be guided to run you app locally for test purpose, on a kubernetes cluster for dev and production purpose, and as a fallback in a virtual machine in production if you don’t have access to kubernetes cluster.
Contents:
- User Guide
- Step 1 : Setup your project on gitlab
- Step 2 : Containerize your app
- Step 3 : Test and run locally your containerized app
- Step 4 : Deploy your app on dev cluster with kubernetes
- Step 4.1: Define a deploy token (Optionnal)
- Step 4.2: Ask a namespace in the kubernetes dev cluster
- Step 4.3: Adapte the GitLab CI file to your project
- Step 4.4: Configuring your application in Kubernetes (values.yaml)
- Step 4.5: Access to logs and quota
- Step 5 : Deploy your app on prod cluster with kubernetes
- Step 5-alt : Deploy your app on prod with docker-compose (without kubernetes)
- Frequently Asked Questions
- FAQ
- How to open the last run pipeline ?
- Job failed in fetch-log-dev job
- Why does Kubernetes indicat that it cannot pull image?
- How to fix build error during docker compose during R packages installation ?
- How to fix infinite installing R package during docker compose ? How to install “tidyverse” R packages ?
- How to fix infinite installing R package during docker compose ? How to install “tidyverse” R packages ?
- How to upgrade my helm dependency / I can’t enable a feature
- How to fix error “UPGRADE FAILED: failed to create resource” ?
- Uploading to data dir
- Download content of data dir
- How to be able to delete the app in prod
- What version do you propose
- FAQ
- Developer Guide
- Docker base image
- RShiny base image
- Dockerfile.r
- Line 2: The base image
- Lines 5-7 : Environment variables
- Line 9 : Listen port for Shiny-server
- Line 10 : Run Shiny-server
- Lines 13-37 : The system dependencies
- Lines 40-49 : Installation of R
- Lines 51-57 : Install R Packages
- Line 58 : Installation Shiny Server
- Line 61 : Custom Shiny-server configuration file
- Lines 66-70 : Permissions
- Dockerfile.r
- Shiny Python base image
- Dockerfile.python
- Line 2: The base image
- Lines 5-7 : Environment variables
- Line 9 : Listen port for Shiny-server
- Line 10 : Run Shiny-server
- Lines 13-39 : The system dependencies
- Lines 42-43 : Installation Shiny package for python
- Lines 46-49 : Installation Shiny Server
- Line 52 : Custom Shiny-server configuration file
- Lines 57-61 : Permissions
- Specific point in gitlab-ci
- Dockerfile.python
- Helper scripts
- RShiny base image
- Gitlab CI of shiny-k8s
- Gitlab CI of shiny-k8s-example
- Talking with Kubernetes
- Helm template
- FAQ
- Docker base image
- Links