Pandora-IsoMemo / CausalR

GNU General Public License v3.0
0 stars 0 forks source link

Dockerization #21

Open policybot2020 opened 1 year ago

policybot2020 commented 1 year ago

Tutorial: https://www.r-bloggers.com/2021/05/dockerizing-shiny-applications/

Video Youtube Tutorial: https://www.youtube.com/watch?v=e7l4h8bptcM

policybot2020 commented 1 year ago

there are two ways 1) use renv or packrat: which already have the dependencies packaged, then restore them to use them in the app

policybot2020 commented 1 year ago

@arunge I also have a question on DataTools

I have tried to Dockerize this package. But in with the Renv, there is an issue with downloading dev version of DataTools package, because it's not published on CRAN yet. There are also very complex dependencies of DataTools, so there is an error when I try to Dockerize CausalR. Do you have any tips?

I see ReSources has this dockerfile: https://github.com/Pandora-IsoMemo/resources/blob/main/Dockerfile

and here is CausalR dockerfile: https://github.com/Pandora-IsoMemo/CausalR/blob/feat/pandoraUpload/Dockerfile

arunge commented 1 year ago

@policybot2020 In general, a package does not need to be on CRAN to be able to create a docker container. Currently, all our apps run in a docker-container AND use DataTools.

Also for the future, there is no plan to publish DataTools on CRAN, because DataTools depends on e.g. rgpt3, which is also not available on CRAN.

Regarding your Dockerfile, all of our apps use the base-image, e.g. Resources: https://github.com/Pandora-IsoMemo/resources/blob/1e333815dd3fde467aa370cc2261512e269192d8/Dockerfile#L1

This base-image installs a lot of required dependencies, also the source of our self-maintained packages that are not on CRAN.

Please, use the base-image for your docker container.

policybot2020 commented 1 year ago

@arunge

I ran the INWT base-image you gave me the link here: https://github.com/Pandora-IsoMemo/resources/blob/1e333815dd3fde467aa370cc2261512e269192d8/Dockerfile#L1

I tried to adapt it the CausalR package here: https://github.com/Pandora-IsoMemo/CausalR/blob/feat/pandoraUpload/Dockerfile

I try to run docker build but i received this error:

Johanns-MacBook-Pro:CausalR johann$ docker build -t my-shinyapp-image . 
[+] Building 1.1s (3/3) FINISHED                                                                                               
 => [internal] load build definition from Dockerfile                                                                      0.0s
 => => transferring dockerfile: 2.25kB                                                                                    0.0s
 => [internal] load .dockerignore                                                                                         0.0s
 => => transferring context: 2B                                                                                           0.0s
 => ERROR [internal] load metadata for ghcr.io/pandora-isomemo/base-image:latest                                          1.0s
------
 > [internal] load metadata for ghcr.io/pandora-isomemo/base-image:latest:
------
failed to solve with frontend dockerfile.v0: failed to create LLB definition: no match for platform in manifest sha256:66e561ca1fc63c3fcfb28c1362ca80960f9c1968bab3423d8aa52eb60ba4a45a: not found

what does this mean?

arunge commented 1 year ago

Hi @policybot2020 ,

In general, all of our apps are developed as a package, that's why we do not need the line https://github.com/Pandora-IsoMemo/CausalR/blob/240b911d5ee4300aaabaf2dc2547ebedf5dda366/Dockerfile#L22 all dependencies are usually loaded via the description file of the package and part of the base-image, see https://github.com/Pandora-IsoMemo/base-image/blob/1da14e0a7b15da84ca391df0be6a001fd0945467/Dockerfile#L26

policybot2020 commented 7 months ago

@arunge

Just to catch up where we left off for the dockerization/implementation of the CausalR app.

I have finished testing Causal 0.0.1 Now we need to implement the Shiny App. Again, it's not a package. If we want to make it into a package, that's another discussion. @isomemo

My job is turn the package into a usable interface with downloadable visualizations and make sure the methodologies are sound, but the software development and data engineering part is not my Forte. It will take me a long time to learn this on my own. @isomemo is there capacity for INWT to take over implementation the App from here? Which means these steps still has to be done:

policybot2020 commented 1 month ago

@arunge

Returning to this issue: did you or Jan made a CausalR docker container file for pulling and docker run?

like this on DRAT repo: https://github.com/Pandora-IsoMemo/drat?tab=readme-ov-file:

Instructions for download and Start Application via Docker:

I tried to run docker pull ghcr.io/pandora-isomemo/causalr-app:main, but it denied this command and no success for me. If you and Jan did not make this Docker container capability, then please confirm with me. thanks!

jan-abel-inwt commented 1 month ago

Hello @policybot2020,

Yes, a Docker container for CausalR has been available for two months. You can find it in the GitHub Container Registry, along with our other apps. Here is the link to the Image.

The image in the registry was named causalr not causalr-app.

Please refrain from using the documentation from the drat repository as it is outdated. I plan to remove it soon. Instead, you can access the latest documentation on our new Documentation Hub. The Docker instructions for CausalR can be found here.

I have tested the workflow on my machine, and it functions correctly.

You can also use the script to run the dockerized apps