ThinkR-open / golem

A Framework for Building Robust Shiny Apps
https://thinkr-open.github.io/golem/
Other
904 stars 132 forks source link

RSConnect git-backed deployment issue #839

Closed kyleweise closed 2 years ago

kyleweise commented 2 years ago

Hey @ColinFay et al,

I'm running into some issues when trying to deploy a golem application to RStudio Connect via git-backed deployment.

So, I have a working application. Following the guide here, I ran the golem::add_rstudioconnect_file() function which added an app.R to the root level of the package/app. I then had to run the rsconnect::writeManifest() function in order to create a manifest.json file that RSConnect will use to build the application. I though this would suffice, but when I go the app on RSConnect, I see a error stacktrace that looks like:

2022/02/19 20:24:34.274790614 Using Packrat dir /opt/rstudio-connect/mnt/app/packrat/lib/x86_64-pc-linux-gnu/4.0.3
2022/02/19 20:24:34.551443655 Warning in loadSupport(appDir, renv = sharedEnv, globalrenv = NULL) :
2022/02/19 20:24:34.551467158   Loading R/ subdirectory for Shiny application, but this directory appears to contain an R package. Sourcing files in R/ may cause unexpected behavior.
2022/02/19 20:24:35.042981508 ℹ Loading GeneDataEditoR
2022/02/19 20:24:36.798015160 Error in value[[3L]](cond) : 
2022/02/19 20:24:36.798049458   could not connect to server: No such file or directory
2022/02/19 20:24:36.798101670   Is the server running locally and accepting
2022/02/19 20:24:36.798119019   connections on Unix domain socket "/var/run/postgresql/.s.PGSQL.5432"?
2022/02/19 20:24:36.798144829 Calls: local ... tryCatch -> tryCatchList -> tryCatchOne -> <Anonymous>
2022/02/19 20:24:36.798147145 Execution halted

I can't find any documentation regarding deploying a golem application in this way. To be clear, instead of publishing directly from RStudio --> RSConnect (probably the most common way of deploying shiny apps to rsconnect and what is currently documented), what we have with git-backed deployment is RStudio --> Git(Hub/Lab/etc.) --> RSConnect (which I find very useful since it's incredibly easy continuous deployment automation).

Would appreciate any advice on how to get this working.

Thanks! -Kyle

ColinFay commented 2 years ago

Hey,

it doesn't seem to be an issue with Connect or Golem but with your postgresql connection:

2022/02/19 20:24:36.798015160 Error in value[[3L]](cond) : 
2022/02/19 20:24:36.798049458   could not connect to server: No such file or directory
2022/02/19 20:24:36.798101670   Is the server running locally and accepting
2022/02/19 20:24:36.798119019   connections on Unix domain socket "/var/run/postgresql/.s.PGSQL.5432"?
2022/02/19 20:24:36.798144829 Calls: local ... tryCatch -> tryCatchList -> tryCatchOne -> <Anonymous>

it seems that your server can't connect to the Postgres socket. Can you connect to Postgres outside of shiny?

Colin

kyleweise commented 2 years ago

Indeed the problem was on my side. Basically forgot to include our production database credentials as RSConnect environment variables. Thanks for pointing me in the right direction, @ColinFay. Closing now.