So my app suddenly stopped working and after investigation it seems that the problem came from the fact that leaflet wasn't being installed correctly when the app was being deployed and this was due to the fact that basically Heroku does not support gdal. The error I was getting while the app was being built was checking for gdal-config... no
.
I went to the GitHub of the R buildpack (https://github.com/virtualstaticvoid/heroku-buildpack-r) and it said I need to containerize the app, so I did.
I did what was said in the following link (https://github.com/virtualstaticvoid/heroku-docker-r) and in my dockerfile I added some comands so my docker file looks like this:
FROM virtualstaticvoid/heroku-docker-r:shiny
ENV PORT=8080
RUN apt-get update &&\
apt-get install -y libcurl4-openssl-dev libssl-dev binutils libproj-dev proj-bin libgdal-dev gdal-bin
CMD ["/usr/bin/R", "--no-save", "--gui-none", "-f", "/app/run.R"]
Sadly, I still get the same error. Furthermore I cannot download the openssl module and I have no idea how to implement/try the handful of answers I found online:
Using PKG_CFLAGS=
--------------------------- [ANTICONF] --------------------------------
Configuration failed because openssl was not found. Try installing:
* deb: libssl-dev (Debian, Ubuntu, etc)
* rpm: openssl-devel (Fedora, CentOS, RHEL)
* csw: libssl_dev (Solaris)
* brew: openssl@1.1 (Mac OSX)
If openssl is already installed, check that 'pkg-config' is in your
PATH and PKG_CONFIG_PATH contains a openssl.pc file. If pkg-config
is unavailable you can set INCLUDE_DIR and LIB_DIR manually via:
R CMD INSTALL --configure-vars='INCLUDE_DIR=... LIB_DIR=...'
-------------------------- [ERROR MESSAGE] ---------------------------
tools/version.c:1:10: fatal error: openssl/opensslv.h: No such file or directory
1 | #include <openssl/opensslv.h>
| ^~~~~~~~~~~~~~~~~~~~
compilation terminated.
I need help please.
EDIT:
I think that the problem comes from the fact that I am istalling the libraries after building the image from docker (this image installs R without installing the libgdal, gdal-config,... packages) so these need to be installed before the FROM statement or I need to build an image of my own (no idea how to) or the person needs to do update his image so that it supports gdal and openssl.
CodePudding user response:
As you guessed, the issue is that the libgdal-dev
dependency isn't installed prior to the rgdal
R package being installed.
heroku-docker-r
makes provision for this with an "Aptfile" to specify dependencies to be installed (as per Applications with Additional Dependencies in the documentation).
I've created an example project, heroku-docker-r-rgdal-example to show how to structure the project with the required files etc.