I get the following when deploying:
Error: Unhandled Exception: child_task=1532792797 child_task_status=error: Unhandled Exception: Unsupported R version 4.5.0 for operating system jammy.
I get the following when deploying:
Error: Unhandled Exception: child_task=1532792797 child_task_status=error: Unhandled Exception: Unsupported R version 4.5.0 for operating system jammy.
Same here, but with 4.5.1 version:
Error: Unhandled Exception: child_task=1560616281 child_task_status=error: Unhandled Exception: Unsupported R version 4.5.1 for operating system jammy.
This is a paid service: Isn't there a compatibility matrix we can check? What time-frame can we expect to support the latest version? Is it not possible to just deploy to a different version without having to downgrade the development environment?
Same here. I succedeed to deploy thanks to a previous version of R in a docker. Create a Dockerfile with a previous version and list all your packages and a script ( here deploy.R) which uses rsconnect::deployApp :
FROM rocker/r-ver:4.3.2
RUN Rscript -e "install.packages(c('rsconnect', 'shiny', <all_packages>))"
COPY . /app
WORKDIR /app
CMD ["Rscript", "deploy.R"]
Build an image with docker build -t deploy-app
and then run container with docker run -it deploy-app
.
That worked for me today.
Thanks a lot for taking the time to share!
I'll definitely try it. One question: how does that solution deal with authentication in shinyapps to perform the deployment?
Best!
Replying to myself:
# Dockerfile
# 1) Base con R 4.3.2
FROM rocker/r-ver:4.3.2
# 2) Dependencias de SO para compilar paquetes R
RUN apt-get update && \
apt-get install -y --no-install-recommends \
libcurl4-openssl-dev \
libssl-dev \
libxml2-dev \
libfontconfig1-dev && \
rm -rf /var/lib/apt/lists/*
# 3) Instala en una sola instrucción todos los paquetes desde CRAN
RUN Rscript -e "install.packages(c('shiny','bs4Dash','plotly','waiter','shinycssloaders','DT','shinyjs','lubridate','shinyalert','htmlwidgets','tidyr','dplyr','httr','jsonlite','rsconnect'), dependencies=TRUE, repos='https://cloud.r-project.org')"
# 4) Copia la app
COPY aplicacion /app
WORKDIR /app
# 5) Copia el script de despliegue
COPY deploy.R /app
# 6) Punto de entrada: ejecuta el deploy
CMD ["Rscript", "deploy.R"]
The deployment script:
# deploy.R
# 1) Asegura que deployApp sepa de dónde venir los paquetes
options(repos = c(CRAN = "https://cloud.r-project.org"))
# 2) Carga rsconnect
library(rsconnect)
# 3) Credenciales via variables de entorno
account <- Sys.getenv("SHINYAPPS_ACCOUNT")
token <- Sys.getenv("SHINYAPPS_TOKEN")
secret <- Sys.getenv("SHINYAPPS_SECRET")
# 4) Configura cuenta shinyapps.io
rsconnect::setAccountInfo(
name = account,
token = token,
secret = secret
)
# 5) Despliega forzando redeploy
rsconnect::deployApp(
appDir = ".",
appName = "Aplicacion",
forceUpdate = TRUE
)
You need to create an access token in Shinyapps.io, and run the container like this:
docker run --rm \
-e SHINYAPPS_ACCOUNT=<YOUR_ACCOUNT> \
-e SHINYAPPS_TOKEN=<YOUR_TOKEN> \
-e SHINYAPPS_SECRET=>YOUR_SECRET> \
<IMAGE NAME>
Best,
Juanje.
I store my secret in a file rsconnect.json called by the script deploy.R :
deploy.R
library(rjson)
library(rsconnect)
credentials <- fromJSON(file="rsconnect.json")
app_name <- ${app_name}
app_dir <- '.'
rsconnect::setAccountInfo(
name = credentials$account,
token = credentials$token,
secret = credentials$secret
)
rsconnect::deployApp(appName = app_name, appDir = app_dir, account = credentials$account, forceUpdate = T)
and authentication is in the file rsconnect.json like :
rsconnect.json
{
"account": ${account},
"token": ${token},
"secret": ${secret}
}
I just copy these 2 files into all my shiny projects and change app_name before deploying.