Skip to content

Instantly share code, notes, and snippets.

@virtualstaticvoid
Last active February 11, 2019 10:10
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save virtualstaticvoid/65c3e7b8d753365d85ccc26c0f9b82dc to your computer and use it in GitHub Desktop.
Save virtualstaticvoid/65c3e7b8d753365d85ccc26c0f9b82dc to your computer and use it in GitHub Desktop.
Heroku Buildpack R - RPostgreSQL Example
libcurl4-openssl-dev
libpq-dev
# httr package included for parse_url function
my_packages = c("RPostgreSQL", "httr")
install_if_missing = function(p) {
if (p %in% rownames(installed.packages()) == FALSE) {
install.packages(p)
}
else {
cat(paste("Skipping already installed package:", p, "\n"))
}
}
invisible(sapply(my_packages, install_if_missing))
#!/bin/bash
shopt -s extglob
set -e
heroku create --stack cedar-14 --buildpack https://github.com/virtualstaticvoid/heroku-buildpack-r.git#cedar-14-chroot
# add postgresql addon
heroku addons:create heroku-postgresql:hobby-dev
git push heroku master
# run prog.R via console
heroku run R --no-save -f /app/prog.R
/tmp/tmp.PM1ZGkL6X0 ~/CS/Projects/heroku/heroku-buildpack-r-chroot/src/test/pg
Initialized empty Git repository in /tmp/tmp.PM1ZGkL6X0/.git/
[master (root-commit) 6423ebb] initial
6 files changed, 108 insertions(+)
create mode 100644 .gitignore
create mode 100644 Aptfile
create mode 100755 init.R
create mode 100755 install
create mode 100644 output.txt
create mode 100644 prog.R
Creating app... done, nameless-mountain-46611, stack is cedar-14
Setting buildpack to https://github.com/virtualstaticvoid/heroku-buildpack-r.git#cedar-14-chroot... done
https://nameless-mountain-46611.herokuapp.com/ | https://git.heroku.com/nameless-mountain-46611.git
Creating heroku-postgresql:hobby-dev on nameless-mountain-46611... free
Database has been created and is available
! This database is empty. If upgrading, you can transfer
! data from another database with pg:copy
Created postgresql-clear-40390 as DATABASE_URL
Use heroku addons:docs heroku-postgresql to view documentation
remote: Compressing source files... done.
remote: Building source:
remote:
remote: -----> R Console app detected
remote: -----> Vendoring R 3.3.3 for cedar-14 stack (latest)
remote: Downloading and unpacking R binaries (http://heroku-buildpack-r.s3.amazonaws.com/cedar-14/R-3.3.3-binaries-latest.tar.gz)
remote: -----> Installing binary dependencies from Aptfile
remote: Reading package lists...
remote: Building dependency tree...
remote: Reading state information...
remote: libcurl4-openssl-dev is already the newest version.
remote: Suggested packages:
remote: postgresql-doc-9.3
remote: The following NEW packages will be installed:
remote: libpq-dev libpq5
remote: 0 upgraded, 2 newly installed, 0 to remove and 91 not upgraded.
remote: Need to get 219 kB of archives.
remote: After this operation, 1,016 kB of additional disk space will be used.
remote: Get:1 http://archive.ubuntu.com/ubuntu/ trusty-updates/main libpq5 amd64 9.3.16-0ubuntu0.14.04 [78.9 kB]
remote: Get:2 http://archive.ubuntu.com/ubuntu/ trusty-updates/main libpq-dev amd64 9.3.16-0ubuntu0.14.04 [140 kB]
remote: debconf: delaying package configuration, since apt-utils is not installed
remote: Fetched 219 kB in 0s (488 kB/s)
remote: Selecting previously unselected package libpq5.
remote: (Reading database ... 27125 files and directories currently installed.)
remote: Preparing to unpack .../libpq5_9.3.16-0ubuntu0.14.04_amd64.deb ...
remote: Unpacking libpq5 (9.3.16-0ubuntu0.14.04) ...
remote: Selecting previously unselected package libpq-dev.
remote: Preparing to unpack .../libpq-dev_9.3.16-0ubuntu0.14.04_amd64.deb ...
remote: Unpacking libpq-dev (9.3.16-0ubuntu0.14.04) ...
remote: Processing triggers for man-db (2.6.7.1-1ubuntu1) ...
remote: /usr/bin/mandb: error while loading shared libraries: libmandb-2.6.7.1.so: cannot open shared object file: No such file or directory
remote: Setting up libpq5 (9.3.16-0ubuntu0.14.04) ...
remote: Setting up libpq-dev (9.3.16-0ubuntu0.14.04) ...
remote: -----> Executing init.r script
remote: Installing package into ‘/usr/local/lib/R/site-library’
remote: (as ‘lib’ is unspecified)
remote: also installing the dependency ‘DBI’
remote:
remote: trying URL 'http://cran.revolutionanalytics.com/src/contrib/DBI_0.6-1.tar.gz'
remote: Content type 'application/octet-stream' length 611344 bytes (597 KB)
remote: ==================================================
remote: downloaded 597 KB
remote:
remote: trying URL 'http://cran.revolutionanalytics.com/src/contrib/RPostgreSQL_0.4-1.tar.gz'
remote: Content type 'application/octet-stream' length 476204 bytes (465 KB)
remote: ==================================================
remote: downloaded 465 KB
remote:
remote: * installing *source* package ‘DBI’ ...
remote: ** package ‘DBI’ successfully unpacked and MD5 sums checked
remote: ** R
remote: ** inst
remote: ** preparing package for lazy loading
remote: ** help
remote: *** installing help indices
remote: ** building package indices
remote: ** installing vignettes
remote: ** testing if installed package can be loaded
remote: * DONE (DBI)
remote: * installing *source* package ‘RPostgreSQL’ ...
remote: ** package ‘RPostgreSQL’ successfully unpacked and MD5 sums checked
remote: checking for gcc... gcc
remote: checking for C compiler default output file name... a.out
remote: checking whether the C compiler works... yes
remote: checking whether we are cross compiling... no
remote: checking for suffix of executables...
remote: checking for suffix of object files... o
remote: checking whether we are using the GNU C compiler... yes
remote: checking whether gcc accepts -g... yes
remote: checking for gcc option to accept ISO C89... none needed
remote: checking build system type... x86_64-unknown-linux-gnu
remote: checking host system type... x86_64-unknown-linux-gnu
remote: checking target system type... x86_64-unknown-linux-gnu
remote: checking for pg_config... /usr/bin/pg_config
remote: checking for "/usr/include/postgresql/libpq-fe.h"... yes
remote: configure: creating ./config.status
remote: config.status: creating src/Makevars
remote: ** libs
remote: gcc -std=gnu99 -I/usr/share/R/include -DNDEBUG -I/usr/include/postgresql -fpic -g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security -D_FORTIFY_SOURCE=2 -g -c RS-DBI.c -o RS-DBI.o
remote: gcc -std=gnu99 -I/usr/share/R/include -DNDEBUG -I/usr/include/postgresql -fpic -g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security -D_FORTIFY_SOURCE=2 -g -c RS-PQescape.c -o RS-PQescape.o
remote: gcc -std=gnu99 -I/usr/share/R/include -DNDEBUG -I/usr/include/postgresql -fpic -g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security -D_FORTIFY_SOURCE=2 -g -c RS-PostgreSQL.c -o RS-PostgreSQL.o
remote: RS-PostgreSQL.c: In function ‘RS_PostgreSQL_createDataMappings’:
remote: RS-PostgreSQL.c:446:5: warning: passing argument 1 of ‘Rf_protect’ from incompatible pointer type [enabled by default]
remote: PROTECT(flds = RS_DBI_allocFields(num_fields));
remote: ^
remote: In file included from /usr/share/R/include/Rdefines.h:40:0,
remote: from S4R.h:64,
remote: from RS-DBI.h:29,
remote: from RS-PostgreSQL.h:25,
remote: from RS-PostgreSQL.c:17:
remote: /usr/share/R/include/Rinternals.h:1366:6: note: expected ‘SEXP’ but argument is of type ‘struct RS_DBI_fields *’
remote: SEXP Rf_protect(SEXP);
remote: ^
remote: gcc -std=gnu99 -I/usr/share/R/include -DNDEBUG -I/usr/include/postgresql -fpic -g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security -D_FORTIFY_SOURCE=2 -g -c RS-pgsql-copy.c -o RS-pgsql-copy.o
remote: gcc -std=gnu99 -I/usr/share/R/include -DNDEBUG -I/usr/include/postgresql -fpic -g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security -D_FORTIFY_SOURCE=2 -g -c RS-pgsql-getResult.c -o RS-pgsql-getResult.o
remote: gcc -std=gnu99 -I/usr/share/R/include -DNDEBUG -I/usr/include/postgresql -fpic -g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security -D_FORTIFY_SOURCE=2 -g -c RS-pgsql-pqexec.c -o RS-pgsql-pqexec.o
remote: gcc -std=gnu99 -I/usr/share/R/include -DNDEBUG -I/usr/include/postgresql -fpic -g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security -D_FORTIFY_SOURCE=2 -g -c RS-pgsql-pqexecparams.c -o RS-pgsql-pqexecparams.o
remote: gcc -std=gnu99 -shared -L/usr/lib/R/lib -Wl,-Bsymbolic-functions -Wl,-z,relro -o RPostgreSQL.so RS-DBI.o RS-PQescape.o RS-PostgreSQL.o RS-pgsql-copy.o RS-pgsql-getResult.o RS-pgsql-pqexec.o RS-pgsql-pqexecparams.o -L/usr/lib -lpq -L/usr/lib/R/lib -lR
remote: installing to /usr/local/lib/R/site-library/RPostgreSQL/libs
remote: ** R
remote: ** inst
remote: ** preparing package for lazy loading
remote: ** help
remote: *** installing help indices
remote: ** building package indices
remote: ** testing if installed package can be loaded
remote: * DONE (RPostgreSQL)
remote:
remote: The downloaded source packages are in
remote: ‘/tmp/Rtmp16qKWc/downloaded_packages’
remote: Installing package into ‘/usr/local/lib/R/site-library’
remote: (as ‘lib’ is unspecified)
remote: also installing the dependencies ‘curl’, ‘openssl’
remote:
remote: trying URL 'http://cran.revolutionanalytics.com/src/contrib/curl_2.6.tar.gz'
remote: Content type 'application/octet-stream' length 405626 bytes (396 KB)
remote: ==================================================
remote: downloaded 396 KB
remote:
remote: trying URL 'http://cran.revolutionanalytics.com/src/contrib/openssl_0.9.6.tar.gz'
remote: Content type 'application/octet-stream' length 1239339 bytes (1.2 MB)
remote: ==================================================
remote: downloaded 1.2 MB
remote:
remote: trying URL 'http://cran.revolutionanalytics.com/src/contrib/httr_1.2.1.tar.gz'
remote: Content type 'application/octet-stream' length 133398 bytes (130 KB)
remote: ==================================================
remote: downloaded 130 KB
remote:
remote: * installing *source* package ‘curl’ ...
remote: ** package ‘curl’ successfully unpacked and MD5 sums checked
remote: Found pkg-config cflags and libs!
remote: Using PKG_CFLAGS=
remote: Using PKG_LIBS=-lcurl
remote: ** libs
remote: rm -f curl.so callbacks.o curl.o download.o escape.o fetch.o form.o getdate.o handle.o ieproxy.o init.o interrupt.o multi.o nslookup.o reflist.o utils.o version.o
remote: gcc -std=gnu99 -I/usr/share/R/include -DNDEBUG -fpic -g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security -D_FORTIFY_SOURCE=2 -g -c callbacks.c -o callbacks.o
remote: gcc -std=gnu99 -I/usr/share/R/include -DNDEBUG -fpic -g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security -D_FORTIFY_SOURCE=2 -g -c curl.c -o curl.o
remote: gcc -std=gnu99 -I/usr/share/R/include -DNDEBUG -fpic -g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security -D_FORTIFY_SOURCE=2 -g -c download.c -o download.o
remote: gcc -std=gnu99 -I/usr/share/R/include -DNDEBUG -fpic -g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security -D_FORTIFY_SOURCE=2 -g -c escape.c -o escape.o
remote: gcc -std=gnu99 -I/usr/share/R/include -DNDEBUG -fpic -g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security -D_FORTIFY_SOURCE=2 -g -c fetch.c -o fetch.o
remote: gcc -std=gnu99 -I/usr/share/R/include -DNDEBUG -fpic -g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security -D_FORTIFY_SOURCE=2 -g -c form.c -o form.o
remote: gcc -std=gnu99 -I/usr/share/R/include -DNDEBUG -fpic -g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security -D_FORTIFY_SOURCE=2 -g -c getdate.c -o getdate.o
remote: gcc -std=gnu99 -I/usr/share/R/include -DNDEBUG -fpic -g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security -D_FORTIFY_SOURCE=2 -g -c handle.c -o handle.o
remote: gcc -std=gnu99 -I/usr/share/R/include -DNDEBUG -fpic -g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security -D_FORTIFY_SOURCE=2 -g -c ieproxy.c -o ieproxy.o
remote: gcc -std=gnu99 -I/usr/share/R/include -DNDEBUG -fpic -g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security -D_FORTIFY_SOURCE=2 -g -c init.c -o init.o
remote: gcc -std=gnu99 -I/usr/share/R/include -DNDEBUG -fpic -g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security -D_FORTIFY_SOURCE=2 -g -c interrupt.c -o interrupt.o
remote: gcc -std=gnu99 -I/usr/share/R/include -DNDEBUG -fpic -g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security -D_FORTIFY_SOURCE=2 -g -c multi.c -o multi.o
remote: gcc -std=gnu99 -I/usr/share/R/include -DNDEBUG -fpic -g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security -D_FORTIFY_SOURCE=2 -g -c nslookup.c -o nslookup.o
remote: gcc -std=gnu99 -I/usr/share/R/include -DNDEBUG -fpic -g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security -D_FORTIFY_SOURCE=2 -g -c reflist.c -o reflist.o
remote: gcc -std=gnu99 -I/usr/share/R/include -DNDEBUG -fpic -g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security -D_FORTIFY_SOURCE=2 -g -c utils.c -o utils.o
remote: gcc -std=gnu99 -I/usr/share/R/include -DNDEBUG -fpic -g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security -D_FORTIFY_SOURCE=2 -g -c version.c -o version.o
remote: gcc -std=gnu99 -shared -L/usr/lib/R/lib -Wl,-Bsymbolic-functions -Wl,-z,relro -o curl.so callbacks.o curl.o download.o escape.o fetch.o form.o getdate.o handle.o ieproxy.o init.o interrupt.o multi.o nslookup.o reflist.o utils.o version.o -lcurl -L/usr/lib/R/lib -lR
remote: installing to /usr/local/lib/R/site-library/curl/libs
remote: ** R
remote: ** data
remote: *** moving datasets to lazyload DB
remote: ** inst
remote: ** preparing package for lazy loading
remote: ** help
remote: *** installing help indices
remote: ** building package indices
remote: ** installing vignettes
remote: ** testing if installed package can be loaded
remote: * DONE (curl)
remote: * installing *source* package ‘openssl’ ...
remote: ** package ‘openssl’ successfully unpacked and MD5 sums checked
remote: Found pkg-config cflags and libs!
remote: Using PKG_CFLAGS=
remote: Using PKG_LIBS=-lssl -lcrypto
remote: ** libs
remote: rm -f aes.o base64.o bignum.o cert.o compatibility.o diffie.o envelope.o error.o hash.o info.o keygen.o keys.o onload.o openssh.o password.o pem.o pkcs12.o pkcs7.o rand.o rsa.o signing.o ssl.o stream.o write.o openssl.so
remote: gcc -std=gnu99 -I/usr/share/R/include -DNDEBUG -fpic -g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security -D_FORTIFY_SOURCE=2 -g -c aes.c -o aes.o
remote: gcc -std=gnu99 -I/usr/share/R/include -DNDEBUG -fpic -g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security -D_FORTIFY_SOURCE=2 -g -c base64.c -o base64.o
remote: gcc -std=gnu99 -I/usr/share/R/include -DNDEBUG -fpic -g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security -D_FORTIFY_SOURCE=2 -g -c bignum.c -o bignum.o
remote: gcc -std=gnu99 -I/usr/share/R/include -DNDEBUG -fpic -g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security -D_FORTIFY_SOURCE=2 -g -c cert.c -o cert.o
remote: gcc -std=gnu99 -I/usr/share/R/include -DNDEBUG -fpic -g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security -D_FORTIFY_SOURCE=2 -g -c compatibility.c -o compatibility.o
remote: gcc -std=gnu99 -I/usr/share/R/include -DNDEBUG -fpic -g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security -D_FORTIFY_SOURCE=2 -g -c diffie.c -o diffie.o
remote: gcc -std=gnu99 -I/usr/share/R/include -DNDEBUG -fpic -g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security -D_FORTIFY_SOURCE=2 -g -c envelope.c -o envelope.o
remote: gcc -std=gnu99 -I/usr/share/R/include -DNDEBUG -fpic -g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security -D_FORTIFY_SOURCE=2 -g -c error.c -o error.o
remote: gcc -std=gnu99 -I/usr/share/R/include -DNDEBUG -fpic -g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security -D_FORTIFY_SOURCE=2 -g -c hash.c -o hash.o
remote: gcc -std=gnu99 -I/usr/share/R/include -DNDEBUG -fpic -g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security -D_FORTIFY_SOURCE=2 -g -c info.c -o info.o
remote: gcc -std=gnu99 -I/usr/share/R/include -DNDEBUG -fpic -g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security -D_FORTIFY_SOURCE=2 -g -c keygen.c -o keygen.o
remote: gcc -std=gnu99 -I/usr/share/R/include -DNDEBUG -fpic -g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security -D_FORTIFY_SOURCE=2 -g -c keys.c -o keys.o
remote: gcc -std=gnu99 -I/usr/share/R/include -DNDEBUG -fpic -g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security -D_FORTIFY_SOURCE=2 -g -c onload.c -o onload.o
remote: gcc -std=gnu99 -I/usr/share/R/include -DNDEBUG -fpic -g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security -D_FORTIFY_SOURCE=2 -g -c openssh.c -o openssh.o
remote: gcc -std=gnu99 -I/usr/share/R/include -DNDEBUG -fpic -g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security -D_FORTIFY_SOURCE=2 -g -c password.c -o password.o
remote: gcc -std=gnu99 -I/usr/share/R/include -DNDEBUG -fpic -g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security -D_FORTIFY_SOURCE=2 -g -c pem.c -o pem.o
remote: gcc -std=gnu99 -I/usr/share/R/include -DNDEBUG -fpic -g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security -D_FORTIFY_SOURCE=2 -g -c pkcs12.c -o pkcs12.o
remote: gcc -std=gnu99 -I/usr/share/R/include -DNDEBUG -fpic -g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security -D_FORTIFY_SOURCE=2 -g -c pkcs7.c -o pkcs7.o
remote: gcc -std=gnu99 -I/usr/share/R/include -DNDEBUG -fpic -g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security -D_FORTIFY_SOURCE=2 -g -c rand.c -o rand.o
remote: gcc -std=gnu99 -I/usr/share/R/include -DNDEBUG -fpic -g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security -D_FORTIFY_SOURCE=2 -g -c rsa.c -o rsa.o
remote: gcc -std=gnu99 -I/usr/share/R/include -DNDEBUG -fpic -g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security -D_FORTIFY_SOURCE=2 -g -c signing.c -o signing.o
remote: gcc -std=gnu99 -I/usr/share/R/include -DNDEBUG -fpic -g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security -D_FORTIFY_SOURCE=2 -g -c ssl.c -o ssl.o
remote: gcc -std=gnu99 -I/usr/share/R/include -DNDEBUG -fpic -g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security -D_FORTIFY_SOURCE=2 -g -c stream.c -o stream.o
remote: gcc -std=gnu99 -I/usr/share/R/include -DNDEBUG -fpic -g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security -D_FORTIFY_SOURCE=2 -g -c write.c -o write.o
remote: gcc -std=gnu99 -shared -L/usr/lib/R/lib -Wl,-Bsymbolic-functions -Wl,-z,relro -o openssl.so aes.o base64.o bignum.o cert.o compatibility.o diffie.o envelope.o error.o hash.o info.o keygen.o keys.o onload.o openssh.o password.o pem.o pkcs12.o pkcs7.o rand.o rsa.o signing.o ssl.o stream.o write.o -lssl -lcrypto -L/usr/lib/R/lib -lR
remote: installing to /usr/local/lib/R/site-library/openssl/libs
remote: ** R
remote: ** inst
remote: ** preparing package for lazy loading
remote: ** help
remote: *** installing help indices
remote: ** building package indices
remote: ** installing vignettes
remote: ** testing if installed package can be loaded
remote: * DONE (openssl)
remote: * installing *source* package ‘httr’ ...
remote: ** package ‘httr’ successfully unpacked and MD5 sums checked
remote: ** R
remote: ** demo
remote: ** inst
remote: ** preparing package for lazy loading
remote: ** help
remote: *** installing help indices
remote: ** building package indices
remote: ** installing vignettes
remote: ** testing if installed package can be loaded
remote: * DONE (httr)
remote:
remote: The downloaded source packages are in
remote: ‘/tmp/Rtmp16qKWc/downloaded_packages’
remote: R 3.3.3 successfully installed (with init)
remote: -----> Discovering process types
remote: Procfile declares types -> (none)
remote: Default types for buildpack -> console
remote:
remote: -----> Compressing...
remote: Done: 112.3M
remote: -----> Launching...
remote: Released v4
remote: https://nameless-mountain-46611.herokuapp.com/ deployed to Heroku
remote:
remote: Verifying deploy... done.
To https://git.heroku.com/nameless-mountain-46611.git
* [new branch] master -> master
Running R --no-save -f /app/prog.R on nameless-mountain-46611... starting, run.7817 (Free)
Running R --no-save -f /app/prog.R on nameless-mountain-46611... connecting, run.7817 (Free)
Running R --no-save -f /app/prog.R on nameless-mountain-46611... up, run.7817 (Free)
R version 3.3.3 (2017-03-06) -- "Another Canoe"
Copyright (C) 2017 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu (64-bit)
R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.
R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.
Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.
> #
> # Example R program
> #
>
> library("httr")
> library("RPostgreSQL")
Loading required package: DBI
>
> db_uri <- Sys.getenv('DATABASE_URL')
> parts <- parse_url(db_uri)
>
> drv <- dbDriver("PostgreSQL")
>
> con <- dbConnect(
+ drv,
+ host = parts$hostname,
+ port = parts$port,
+ user = parts$user,
+ password = parts$password,
+ dbname = parts$path
+ )
>
> dbListTables(con)
character(0)
>
> dbDisconnect(con)
[1] TRUE
>
~/CS/Projects/heroku/heroku-buildpack-r-chroot/src/test/pg
Destroying nameless-mountain-46611 (including all add-ons)... done
#
# Example R program, connects to PG and lists tables
#
library("httr")
library("RPostgreSQL")
db_uri <- Sys.getenv('DATABASE_URL')
parts <- parse_url(db_uri)
drv <- dbDriver("PostgreSQL")
con <- dbConnect(
drv,
host = parts$hostname,
port = parts$port,
user = parts$user,
password = parts$password,
dbname = parts$path
)
dbListTables(con)
dbDisconnect(con)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment