diff --git a/README.md b/README.md index d988296a7d1aaa573741dc9bf6e72951f7da6d2d..dec13e5e38b38463ac065ebfcf63f99c0255bef0 100644 --- a/README.md +++ b/README.md @@ -1,90 +1,50 @@ # rshiny-k8s -## Aim of the project -Help hub members to deploy correctly and easily an Web application, initially developed in RShiny, under Kubernetes. +## Project Goal +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. - -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 +## Project structure and dependencies +Today, -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: -- an Ubuntu Linux system with R installed -- a shiny server (not the professional version) -- your app +In the future: -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 -FROM rocker/shiny:latest -USER root -# delete previous exemples on shiny-server -RUN rm -rf /srv/shiny-server/* -# change permission for user shiny -RUN sudo chown -R shiny:shiny /usr/local/lib/R/etc/ -## Install R packages from CRAN or bioconductor -COPY ./script_r_to_docker/script_install_r_packages.R . -COPY ./script_r_to_docker/packages_to_install.csv . -RUN Rscript script_install_r_packages.R - -WORKDIR /srv/shiny-server/ - -# copy the app directory into the image -COPY ./MyAppName/. /srv/shiny-server/MyAppName/ - -USER shiny -CMD ["/usr/bin/shiny-server"] -``` - - - -# Troubleshooting, dev cheat sheet - -Build the image, and run it -```sh -docker build . -t rshiny-k8s-test -docker run -it -p 3838:3838 rshiny-k8s-test -``` - -To locally run the server -```sh -docker build . -t rshiny-k8s-test -docker run --rm -ti -v $(pwd)/example_proj:/srv/shiny-server --user shiny -p 3838:3838 rocker/shiny -docker run --rm -ti -v $(pwd)/example_proj:/srv/shiny-server -p 3838:3838 rocker/shiny -``` +1. Create a basic docker image with R and Shiny Server +2. Create a docker image, based on the previous one, with Rshiny application and R packages needed +3. Initiate the deployement under gitlab with CI configuration +4. Configure the deployement under kubernetes +5. Configure the deployement under kubernetes with helm +6. Deploy the application using your previous recipe +### for RShiny Application Developer +This workflow described all steps to follow in order to deploy your app under kubernetes available at Institut Pasteur - Paris. +1. Develop your shiny app +2. Containerize your Shiny app +3. Deployement your application under kubernetes +## Documentation +More information, see [Documentation](https://hub.pages.pasteur.fr/rshiny-k8s/) \ No newline at end of file