From 418ec90ea242eaa77c6bfd7c26e83afa94b5a1b2 Mon Sep 17 00:00:00 2001
From: Elodie Chapeaublanc <elodie.chapeaublanc@pasteur.fr>
Date: Thu, 22 Aug 2024 10:13:44 +0200
Subject: [PATCH] =?UTF-8?q?=E2=9C=A8=20=E2=9C=8F=EF=B8=8F=20Add=20new=20an?=
 =?UTF-8?q?swer=20for=20installation=20of=20tidyverse=20R=20package.=20Fix?=
 =?UTF-8?q?=20typos=20for=20docker-compose=20command=20replaced=20by=20doc?=
 =?UTF-8?q?ker=20compose?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 source/user_guide/FAQ_user.rst | 92 ++++++++++++++++++++++++++++++++--
 1 file changed, 88 insertions(+), 4 deletions(-)

diff --git a/source/user_guide/FAQ_user.rst b/source/user_guide/FAQ_user.rst
index 4b7777c..8e8c19a 100644
--- a/source/user_guide/FAQ_user.rst
+++ b/source/user_guide/FAQ_user.rst
@@ -49,10 +49,10 @@ or if you get the "503 Service unavailable" page when trying to access to your a
 | If so, read :ref:`Private registry helm` to indicate that the registry is private, and then provide the credentials with :ref:`Define registry token`.
 
 
-How to fix build error during docker-compose during R packages installation ?
+How to fix build error during docker compose during R packages installation ?
 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 
-During the build of docker image following ``docker-compose`` command line, it's possible that installation error occur.
+During the build of docker image following ``docker compose`` command line, it's possible that installation error occur.
 
 Example : 
 
@@ -129,14 +129,98 @@ In order to install it inside your container, you just add it in the ``Dockefile
        libgdal-dev \
   && rm -rf /var/lib/apt/lists/*
 
-After modification, you have just to run again the ``docker-compose`` command line ( see dedicated section :ref:`run locally<run_locally>` ).
+After modification, you have just to run again the ``docker compose`` command line ( see dedicated section :ref:`run locally<run_locally>` ).
 
 .. code-block:: bash
 
-    docker-compose up --build
+    docker compose up --build
 
 
 
+How to fix infinite installing R package during docker compose ? How to install "tidyverse" R packages ? 
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+When you run a "docker compose" command, if the step "installation of R package" doesn't finish without error, like in this example with the installation of R package "tidyverse"
+
+.. tabs::
+
+    .. code-tab:: console
+        :caption: local terminal
+        :linenos:
+        :emphasize-lines: 2,12,17
+
+
+        docker compose up --build
+        [+] Building 2138.3s (8/15) 
+        => [shiny-k8s-toolkit internal] load build definition from Dockerfile
+        => => transferring dockerfile: 1.30kB
+        => [shiny-k8s-toolkit internal] load metadata for registry-gitlab.pasteur.fr/hub/shiny-k8s/r:4.4.0
+        => [shiny-k8s-toolkit internal] load .dockerignore
+        => => transferring context: 2B
+        => [shiny-k8s-toolkit  1/11] FROM registry-gitlab.pasteur.fr/hub/shiny-k8s/r:4.4.0
+        => [shiny-k8s-toolkit internal] load build contex=> => transferring context: 22.23kB
+        => CACHED [shiny-k8s-toolkit  2/11] WORKDIR /srv/shiny-server/
+        => CACHED [shiny-k8s-toolkit  3/11] COPY ./my_packages_to_install.csv /opt/scripts/packages_to_install.csv
+        => [shiny-k8s-toolkit  5/11] RUN Rscript /opt/scripts/install_r_packages.R
+        => => # i No downloads are needed
+        => => # v 1 pkg + 68 deps: kept 57 [1.1s]
+        => => # [1] "Installation done!!"
+        => => # [1] "Installation of: "
+        => => # [1] "tidyverse"
+
+
+You need to install some system dependencies in your docker image. Please check the dependencies needed with the R command ``pak::pkg_sysreqs("tidyverse")``
+
+.. tabs::
+
+    .. code-tab:: R
+        :caption: R console
+        :linenos:
+        :selected:
+
+        pak::pkg_system_requirements("tidyverse")
+        "apt-get install -y libcurl4-openssl-dev libssl-dev make zlib1g-dev pandoc libfreetype6-dev libjpeg-dev libpng-dev libtiff-dev libicu-dev libfontconfig1-dev libfribidi-dev libharfbuzz-dev libxml2-dev"
+
+Add the dependenciesin the ``Dockerfile`` file like bellow :
+
+
+.. tabs::
+
+    .. code-tab:: Dockerfile
+        :caption: Dockerfile
+        :linenos:
+        :selected:
+
+        # Add workdir information
+        WORKDIR /srv/shiny-server/
+
+        # Build image from the base image, previously configured for you
+        # Full list of images can be found at 
+        # https://hub.pages.pasteur.fr/shiny-k8s/user_guide/configure_image.html#image-list
+        FROM registry-gitlab.pasteur.fr/hub/shiny-k8s/r:4.4.0
+
+        # Add workdir information
+        WORKDIR /srv/shiny-server/
+
+        # Install additional dependencies, uncomment the block if you have one, and edit/duplicate line 12
+        RUN apt-get update \
+          && apt-get install -y \
+                libcurl4-openssl-dev \
+                libssl-dev \
+                make \
+                zlib1g-dev \
+                pandoc \
+                libfreetype6-dev \
+                libjpeg-dev \
+                libpng-dev \
+                libtiff-dev \
+                libicu-dev \
+                libfontconfig1-dev \
+                libfribidi-dev \
+                libharfbuzz-dev \
+                libxml2-dev \
+          && rm -rf /var/lib/apt/lists/*
+
 .. _update_chart_dependency:
 How to upgrade my helm dependency / I can't enable a feature 
 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-- 
GitLab