Skip to content

Instantly share code, notes, and snippets.

@virtualstaticvoid
Last active March 19, 2018 21:38
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save virtualstaticvoid/0b00f0bc99be0ae2bf32c810f84fcf88 to your computer and use it in GitHub Desktop.
Save virtualstaticvoid/0b00f0bc99be0ae2bf32c810f84fcf88 to your computer and use it in GitHub Desktop.
Heroku Buildpack R - dplyr Example
my_packages = c("dplyr")
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
git push heroku master
heroku run R --no-save -f /app/prog.R
Initialized empty Git repository in /tmp/tmp.IG2elo2Wbd/.git/
[master (root-commit) a198866] initial
4 files changed, 98 insertions(+)
create mode 100644 .gitignore
create mode 100755 init.r
create mode 100755 install
create mode 100644 prog.r
Creating app... done, ⬢ pure-peak-40730, stack is cedar-14
Setting buildpack to https://github.com/virtualstaticvoid/heroku-buildpack-r.git#cedar-14-chroot... done
https://pure-peak-40730.herokuapp.com/ | https://git.heroku.com/pure-peak-40730.git
Counting objects: 6, done.
Delta compression using up to 8 threads.
Compressing objects: 100% (5/5), done.
Writing objects: 100% (6/6), 1.51 KiB | 0 bytes/s, done.
Total 6 (delta 0), reused 0 (delta 0)
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: -----> Executing init.r script
remote: Installing package into ‘/usr/local/lib/R/site-library’
remote: (as ‘lib’ is unspecified)
remote: also installing the dependencies ‘assertthat’, ‘tibble’, ‘magrittr’, ‘lazyeval’, ‘DBI’, ‘BH’
remote:
remote: trying URL 'http://cran.revolutionanalytics.com/src/contrib/assertthat_0.2.0.tar.gz'
remote: Content type 'application/octet-stream' length 11612 bytes (11 KB)
remote: ==================================================
remote: downloaded 11 KB
remote:
remote: trying URL 'http://cran.revolutionanalytics.com/src/contrib/tibble_1.3.0.tar.gz'
remote: Content type 'application/octet-stream' length 58170 bytes (56 KB)
remote: ==================================================
remote: downloaded 56 KB
remote:
remote: trying URL 'http://cran.revolutionanalytics.com/src/contrib/magrittr_1.5.tar.gz'
remote: Content type 'application/octet-stream' length 200504 bytes (195 KB)
remote: ==================================================
remote: downloaded 195 KB
remote:
remote: trying URL 'http://cran.revolutionanalytics.com/src/contrib/lazyeval_0.2.0.tar.gz'
remote: Content type 'application/octet-stream' length 317272 bytes (309 KB)
remote: ==================================================
remote: downloaded 309 KB
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/BH_1.62.0-1.tar.gz'
remote: Content type 'application/octet-stream' length 10181096 bytes (9.7 MB)
remote: ==================================================
remote: downloaded 9.7 MB
remote:
remote: trying URL 'http://cran.revolutionanalytics.com/src/contrib/dplyr_0.5.0.tar.gz'
remote: Content type 'application/octet-stream' length 708476 bytes (691 KB)
remote: ==================================================
remote: downloaded 691 KB
remote:
remote: * installing *source* package ‘assertthat’ ...
remote: ** package ‘assertthat’ successfully unpacked and MD5 sums checked
remote: ** R
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 (assertthat)
remote: * installing *source* package ‘magrittr’ ...
remote: ** package ‘magrittr’ successfully unpacked and MD5 sums checked
remote: ** R
remote: ** inst
remote: ** byte-compile and prepare 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 (magrittr)
remote: * installing *source* package ‘lazyeval’ ...
remote: ** package ‘lazyeval’ successfully unpacked and MD5 sums checked
remote: ** libs
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 expr.c -o expr.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 interp.c -o interp.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 lazy.c -o lazy.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 name.c -o name.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 -shared -L/usr/lib/R/lib -Wl,-Bsymbolic-functions -Wl,-z,relro -o lazyeval.so expr.o interp.o lazy.o name.o utils.o -L/usr/lib/R/lib -lR
remote: installing to /usr/local/lib/R/site-library/lazyeval/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 (lazyeval)
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 ‘BH’ ...
remote: ** package ‘BH’ successfully unpacked and MD5 sums checked
remote: ** inst
remote: ** help
remote: *** installing help indices
remote: ** building package indices
remote: ** testing if installed package can be loaded
remote: * DONE (BH)
remote: * installing *source* package ‘tibble’ ...
remote: ** package ‘tibble’ successfully unpacked and MD5 sums checked
remote: ** libs
remote: g++ -I/usr/share/R/include -DNDEBUG -I"/usr/local/lib/R/site-library/Rcpp/include" -fpic -g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security -D_FORTIFY_SOURCE=2 -g -c RcppExports.cpp -o RcppExports.o
remote: gcc -std=gnu99 -I/usr/share/R/include -DNDEBUG -I"/usr/local/lib/R/site-library/Rcpp/include" -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: g++ -I/usr/share/R/include -DNDEBUG -I"/usr/local/lib/R/site-library/Rcpp/include" -fpic -g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security -D_FORTIFY_SOURCE=2 -g -c matrixToDataFrame.cpp -o matrixToDataFrame.o
remote: g++ -shared -L/usr/lib/R/lib -Wl,-Bsymbolic-functions -Wl,-z,relro -o tibble.so RcppExports.o init.o matrixToDataFrame.o -L/usr/lib/R/lib -lR
remote: installing to /usr/local/lib/R/site-library/tibble/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 (tibble)
remote: * installing *source* package ‘dplyr’ ...
remote: ** package ‘dplyr’ successfully unpacked and MD5 sums checked
remote: ** libs
remote: g++ -I/usr/share/R/include -DNDEBUG -I../inst/include -DCOMPILING_DPLYR -I"/usr/local/lib/R/site-library/Rcpp/include" -I"/usr/local/lib/R/site-library/BH/include" -DBOOST_NO_INT64_T -DBOOST_NO_INTEGRAL_INT64_T -DBOOST_NO_LONG_LONG -fpic -g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security -D_FORTIFY_SOURCE=2 -g -c RcppExports.cpp -o RcppExports.o
remote: g++ -I/usr/share/R/include -DNDEBUG -I../inst/include -DCOMPILING_DPLYR -I"/usr/local/lib/R/site-library/Rcpp/include" -I"/usr/local/lib/R/site-library/BH/include" -DBOOST_NO_INT64_T -DBOOST_NO_INTEGRAL_INT64_T -DBOOST_NO_LONG_LONG -fpic -g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security -D_FORTIFY_SOURCE=2 -g -c address.cpp -o address.o
remote: g++ -I/usr/share/R/include -DNDEBUG -I../inst/include -DCOMPILING_DPLYR -I"/usr/local/lib/R/site-library/Rcpp/include" -I"/usr/local/lib/R/site-library/BH/include" -DBOOST_NO_INT64_T -DBOOST_NO_INTEGRAL_INT64_T -DBOOST_NO_LONG_LONG -fpic -g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security -D_FORTIFY_SOURCE=2 -g -c api.cpp -o api.o
remote: g++ -I/usr/share/R/include -DNDEBUG -I../inst/include -DCOMPILING_DPLYR -I"/usr/local/lib/R/site-library/Rcpp/include" -I"/usr/local/lib/R/site-library/BH/include" -DBOOST_NO_INT64_T -DBOOST_NO_INTEGRAL_INT64_T -DBOOST_NO_LONG_LONG -fpic -g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security -D_FORTIFY_SOURCE=2 -g -c arrange.cpp -o arrange.o
remote: g++ -I/usr/share/R/include -DNDEBUG -I../inst/include -DCOMPILING_DPLYR -I"/usr/local/lib/R/site-library/Rcpp/include" -I"/usr/local/lib/R/site-library/BH/include" -DBOOST_NO_INT64_T -DBOOST_NO_INTEGRAL_INT64_T -DBOOST_NO_LONG_LONG -fpic -g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security -D_FORTIFY_SOURCE=2 -g -c between.cpp -o between.o
remote: g++ -I/usr/share/R/include -DNDEBUG -I../inst/include -DCOMPILING_DPLYR -I"/usr/local/lib/R/site-library/Rcpp/include" -I"/usr/local/lib/R/site-library/BH/include" -DBOOST_NO_INT64_T -DBOOST_NO_INTEGRAL_INT64_T -DBOOST_NO_LONG_LONG -fpic -g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security -D_FORTIFY_SOURCE=2 -g -c bind.cpp -o bind.o
remote: g++ -I/usr/share/R/include -DNDEBUG -I../inst/include -DCOMPILING_DPLYR -I"/usr/local/lib/R/site-library/Rcpp/include" -I"/usr/local/lib/R/site-library/BH/include" -DBOOST_NO_INT64_T -DBOOST_NO_INTEGRAL_INT64_T -DBOOST_NO_LONG_LONG -fpic -g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security -D_FORTIFY_SOURCE=2 -g -c combine_variables.cpp -o combine_variables.o
remote: g++ -I/usr/share/R/include -DNDEBUG -I../inst/include -DCOMPILING_DPLYR -I"/usr/local/lib/R/site-library/Rcpp/include" -I"/usr/local/lib/R/site-library/BH/include" -DBOOST_NO_INT64_T -DBOOST_NO_INTEGRAL_INT64_T -DBOOST_NO_LONG_LONG -fpic -g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security -D_FORTIFY_SOURCE=2 -g -c distinct.cpp -o distinct.o
remote: g++ -I/usr/share/R/include -DNDEBUG -I../inst/include -DCOMPILING_DPLYR -I"/usr/local/lib/R/site-library/Rcpp/include" -I"/usr/local/lib/R/site-library/BH/include" -DBOOST_NO_INT64_T -DBOOST_NO_INTEGRAL_INT64_T -DBOOST_NO_LONG_LONG -fpic -g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security -D_FORTIFY_SOURCE=2 -g -c dplyr.cpp -o dplyr.o
remote: g++ -I/usr/share/R/include -DNDEBUG -I../inst/include -DCOMPILING_DPLYR -I"/usr/local/lib/R/site-library/Rcpp/include" -I"/usr/local/lib/R/site-library/BH/include" -DBOOST_NO_INT64_T -DBOOST_NO_INTEGRAL_INT64_T -DBOOST_NO_LONG_LONG -fpic -g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security -D_FORTIFY_SOURCE=2 -g -c filter.cpp -o filter.o
remote: g++ -I/usr/share/R/include -DNDEBUG -I../inst/include -DCOMPILING_DPLYR -I"/usr/local/lib/R/site-library/Rcpp/include" -I"/usr/local/lib/R/site-library/BH/include" -DBOOST_NO_INT64_T -DBOOST_NO_INTEGRAL_INT64_T -DBOOST_NO_LONG_LONG -fpic -g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security -D_FORTIFY_SOURCE=2 -g -c group_indices.cpp -o group_indices.o
remote: g++ -I/usr/share/R/include -DNDEBUG -I../inst/include -DCOMPILING_DPLYR -I"/usr/local/lib/R/site-library/Rcpp/include" -I"/usr/local/lib/R/site-library/BH/include" -DBOOST_NO_INT64_T -DBOOST_NO_INTEGRAL_INT64_T -DBOOST_NO_LONG_LONG -fpic -g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security -D_FORTIFY_SOURCE=2 -g -c init.cpp -o init.o
remote: g++ -I/usr/share/R/include -DNDEBUG -I../inst/include -DCOMPILING_DPLYR -I"/usr/local/lib/R/site-library/Rcpp/include" -I"/usr/local/lib/R/site-library/BH/include" -DBOOST_NO_INT64_T -DBOOST_NO_INTEGRAL_INT64_T -DBOOST_NO_LONG_LONG -fpic -g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security -D_FORTIFY_SOURCE=2 -g -c join.cpp -o join.o
remote: g++ -I/usr/share/R/include -DNDEBUG -I../inst/include -DCOMPILING_DPLYR -I"/usr/local/lib/R/site-library/Rcpp/include" -I"/usr/local/lib/R/site-library/BH/include" -DBOOST_NO_INT64_T -DBOOST_NO_INTEGRAL_INT64_T -DBOOST_NO_LONG_LONG -fpic -g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security -D_FORTIFY_SOURCE=2 -g -c nth.cpp -o nth.o
remote: g++ -I/usr/share/R/include -DNDEBUG -I../inst/include -DCOMPILING_DPLYR -I"/usr/local/lib/R/site-library/Rcpp/include" -I"/usr/local/lib/R/site-library/BH/include" -DBOOST_NO_INT64_T -DBOOST_NO_INTEGRAL_INT64_T -DBOOST_NO_LONG_LONG -fpic -g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security -D_FORTIFY_SOURCE=2 -g -c select.cpp -o select.o
remote: g++ -I/usr/share/R/include -DNDEBUG -I../inst/include -DCOMPILING_DPLYR -I"/usr/local/lib/R/site-library/Rcpp/include" -I"/usr/local/lib/R/site-library/BH/include" -DBOOST_NO_INT64_T -DBOOST_NO_INTEGRAL_INT64_T -DBOOST_NO_LONG_LONG -fpic -g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security -D_FORTIFY_SOURCE=2 -g -c strings_addresses.cpp -o strings_addresses.o
remote: g++ -I/usr/share/R/include -DNDEBUG -I../inst/include -DCOMPILING_DPLYR -I"/usr/local/lib/R/site-library/Rcpp/include" -I"/usr/local/lib/R/site-library/BH/include" -DBOOST_NO_INT64_T -DBOOST_NO_INTEGRAL_INT64_T -DBOOST_NO_LONG_LONG -fpic -g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security -D_FORTIFY_SOURCE=2 -g -c summarise.cpp -o summarise.o
remote: g++ -I/usr/share/R/include -DNDEBUG -I../inst/include -DCOMPILING_DPLYR -I"/usr/local/lib/R/site-library/Rcpp/include" -I"/usr/local/lib/R/site-library/BH/include" -DBOOST_NO_INT64_T -DBOOST_NO_INTEGRAL_INT64_T -DBOOST_NO_LONG_LONG -fpic -g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security -D_FORTIFY_SOURCE=2 -g -c test.cpp -o test.o
remote: g++ -I/usr/share/R/include -DNDEBUG -I../inst/include -DCOMPILING_DPLYR -I"/usr/local/lib/R/site-library/Rcpp/include" -I"/usr/local/lib/R/site-library/BH/include" -DBOOST_NO_INT64_T -DBOOST_NO_INTEGRAL_INT64_T -DBOOST_NO_LONG_LONG -fpic -g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security -D_FORTIFY_SOURCE=2 -g -c window.cpp -o window.o
remote: g++ -shared -L/usr/lib/R/lib -Wl,-Bsymbolic-functions -Wl,-z,relro -o dplyr.so RcppExports.o address.o api.o arrange.o between.o bind.o combine_variables.o distinct.o dplyr.o filter.o group_indices.o init.o join.o nth.o select.o strings_addresses.o summarise.o test.o window.o -L/usr/lib/R/lib -lR
remote: installing to /usr/local/lib/R/site-library/dplyr/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 (dplyr)
remote:
remote: The downloaded source packages are in
remote: ‘/tmp/Rtmp87Sc1a/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: 126.5M
remote: -----> Launching...
remote: Released v3
remote: https://pure-peak-40730.herokuapp.com/ deployed to Heroku
remote:
remote: Verifying deploy... done.
library(dplyr)
# add code as needed here...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment