ixpantia / faucet

Fast and scalable R application deployment and orchestration
https://ixpantia.github.io/faucet/
MIT License
101 stars 11 forks source link

Shiny App cannot start #156

Closed dejan94it closed 3 days ago

dejan94it commented 4 days ago

Hi! I have the following Dockerfile:

FROM ixpantia/faucet:r4.3

ENV RENV_CONFIG_REPOS_OVERRIDE=https://packagemanager.rstudio.com/cran/latest

RUN apt-get update -qq && \ 
  apt-get install -y --no-install-recommends \
    libcurl4-openssl-dev \
    libfontconfig1-dev \
    libfreetype6-dev \
    libfribidi-dev \
    libharfbuzz-dev \
    libicu-dev \
    libjpeg-dev \
    libpng-dev \
    libsodium-dev \
    libssl-dev \
    libtiff-dev \
    libxml2-dev \
    make \
    pandoc \
    zlib1g-dev \
    locales && \
  locale-gen it_IT.UTF-8 && \
  apt-get clean && \ 
  rm -rf /var/lib/apt/lists/*

ENV LANG=it_IT.UTF-8
ENV LANGUAGE=it_IT:it
ENV LC_ALL=it_IT.UTF-8

COPY renv.lock renv.lock

RUN Rscript -e "install.packages('renv')"

RUN Rscript -e "renv::restore()"

COPY / /

ENV FAUCET_SHUTDOWN=graceful
ENV FAUCET_TYPE=shiny

in my folder I have all files and directories plus a simple app.R file:

shinyApp(ui = ui, server = server)

When I run shiny::runApp(".") in my project folder the app starts smoothly, while when I run the container it loops on the following error:

example
andyquinterom commented 3 days ago

Hey, I see the error could be with the COPY command.

have you tried COPY . . instead of COPY / /. In the first you copy the files to faucet's working directory, on the second on you copy the files to the root of the file system.

Let me know if this works.

dejan94it commented 3 days ago

Yeah! It worked!

I'm definetely not a Docker expert, and asking to chatgpt it told me that it's (almost) always better use COPY . . instead of COPY / /.

Anyway, the app started with all workers and I can use it in localhost!

Maybe I'm missing something but now I need to figure out how to exploit all workers: I opened two istances of the app, and calling functions which last some seconds I see that two istances are not running in parallel but one by one on worker 1.

andyquinterom commented 3 days ago

Hey! Glad it worked. As per the workers. Workers are assigned according to IP address. SO, if you access from the same computer it will always go to the same worker.

At a very small scale there is a 50% chance (using two workers) that you fall into the same worker. Try accessing it from a different PC or network