Is there a working nodejs/phantomjs Heroku buildpack? - heroku

I'd like to deploy an app with a Procfile that runs
web: node myapp.js
Where myapp.js uses phantomjs-node to run headless webkit stuff, returning the results to browser requests. Is this possible?

I also ran into the same problem, the way I fixed it was by using this "Multiple Buildpack" Buildpack. Then in my .buildpacks file I put the following:
http://github.com/heroku/heroku-buildpack-nodejs.git
http://github.com/stomita/heroku-buildpack-phantomjs.git
Finally, you want to add PhantomJS to the path
heroku config:set PATH=$PATH:vendor/phantomjs/bin
I hope this helps.

Heroku Toolbelt now has first class support for multiple buildpacks, so you can get a working Node and PhantomJS setup with the following:
heroku buildpacks:set https://github.com/heroku/heroku-buildpack-nodejs.git
heroku buildpacks:add --index 1 https://github.com/stomita/heroku-buildpack-phantomjs.git

Here's a PhantomJS buildpack: https://github.com/stomita/heroku-buildpack-phantomjs
I also am able to run the x86_64 build of PhamtomJS, just stuck in my app's vendor directory:
http://phantomjs.org/download.html

Checkout my modified version of stomita that includes NodeJS, PhantomJS & CasperJS ready to run.
https://github.com/olragon/heroku-buildpack-nodejs

This is an old thread but for anybody that lands here I have created a working buildpack for Node and Phantom that's a fork of the official Heroku Node buildpack which incorporates the build scripts from Beedesk's custom Phantom buildpack. Here it is https://github.com/datamail/heroku-buildpack-nodejs-phantomjs

I have forked #stomita buildpack to use the official linux build binary from phantomJS.org. I tested it and it is working with heroku.
Hope some security paranoids like me out there will find it useful.
https://github.com/beedesk/heroku-buildpack-phantomjs
The disadvantage of my pack it that, unlike stomita's, it doesn't include fontconfig and freetype. But, PhantomJS should work without them.

Related

Why isn't my clojure/cljs app deploying on Heroku?

I'm trying to deploy my app to heroku and I keep getting this error:
The required namespace "react" is not available, it was required by "reagent/core.cljs".
But I have
"react": "17.0.2-0",
"react-dom": "17.0.2-0",
"react-highlight.js": "1.0.7",
all in my package.json and I also put
[cljsjs/react "17.0.2-0"]
[cljsjs/react-dom "17.0.2-0"]
in my project.clj. I also did npm install react. I'm not sure what I'm doing wrong?
It compiles fine using shadow-cljs to my localhost, but it won't compile when I try to push to heroku. Any idea what I'm missing?
Editing to add some more details:
I made a bin/build file based on this blog post, even though I'm not using Fulcro: https://folcon.github.io/post/2020-04-12-Fulcro-on-Heroku/
I created a bin/build file that say this:
#!/usr/bin/env bash
npm install
npx shadow-cljs release main
clojure -A:depstar -m hf.depstar.uberjar fulcro.jar
I added this to my shadow-cljs.edn file:
;; v-- and this!
:release {:compiler-options {:optimizations :advanced}}}
And it also said to add something to my deps.edn file, but I don't have one so I didn't.
I also did the buildpack step to add the clojure and nodejs buildpacks, although I'm not using nodejs to my knowledge.
I had the same problem, it was very easy to fix.
You need to first specify buildpacks nodejs, and after it only clojure.
from here:
npm install react react-dom create-react-class

Getting PDFTK installed on Heroku 18 for use in my Laravel app

I have added this pdftk buildpack to my free app on Heroku: https://github.com/fxtentacle/heroku-pdftk-buildpack.git.
I am unable to deploy my application to Heroku:
Preparing runtime environment...
-----> Checking for additional extensions to install...
-----> heroku-pdftk-buildpack app detected
cp: cannot stat 'binaries-heroku-18/*': No such file or directory
! Push rejected, failed to compile heroku-pdftk-buildpack app.
! Push failed
Also, I have added heroku/php and set the index of this buildpack to 1. When I go to my app's temporary URL, Laravel runs, but for some reasons, pdftk doesn't seem to run. Has anybody faced the same issue?
That buildpack hasn't been updated for the heroku-18 stack. Its compile script tries to copy precompiled binaries from binaries-$STACK/ into /app/bin/, but only contains binary directories for cedar-14 and heroku-16.
You could roll your app back to heroku-16, which will be supported until April, 2021, but of course this will also change other package versions:
heroku apps:stacks:set heroku-16 --app myapp
This would be very similar to going from Ubuntu 18.04 to Ubuntu 16.04, but it's likely to be your simplest solution.
Alternatively, you could fork the pdftk buildpack you found and update it for Ubuntu 18.04, but that isn't likely to be straightforward.
pdftk was removed from Ubuntu's official repositories because it depends on a deprecated library called gcj. The buildpack you're trying to use includes libgcj for cedar-14 and heroku-16 in their respective binary directories. You'll have to include that as well if you want to update the buildpack.
Also, I have added heroku/php and set the index of this buildpack to 1. When I go to my app's temporary URL, Laravel runs, but for some reasons, pdftk doesn't seem to run. Has anybody faced the same issue?
The error you're seeing is preventing your application from being deployed. You're not seeing a new version of the application with pdftk, but whatever was last deployed successfully. You'll have to resolve the build issue before you can use pdftk.
I followed this article (http://derekbarber.ca/blog/2014/11/20/using-pdftk-with-rails-on-heroku/) and got PDFTK working on Heroku-18, though on a Rails app.
Code excerpted below, HT #derek-barber.
mkdir -p [my_project]/vendor/pdftk/lib [my_project]vendor/pdftk/bin
cd /tmp
git clone https://github.com/millie/pdftk-source.git
cd pdftk-source
tar xzvf pdftk.tar.gz
mv bin/pdftk [my_project]/vendor/pdftk/bin/
mv lib/libgcj.so.12 [my_project]/vendor/pdftk/lib/
cd [my_project]
git add -f vendor/pdftk/
git commit -m "Add pdftk dependencies"
git push heroku master
heroku config:set LD_LIBRARY_PATH=/app/.heroku/vendor/lib:/app/vendor/pdftk/lib
heroku config:set PATH=/app/.heroku/python/bin:/usr/local/bin:/usr/bin:/bin:/app/vendor/p
Once this PR is merged: https://github.com/fxtentacle/heroku-pdftk-buildpack/pull/9 then the buildpack should work with heroku-18 stack.
Maybe leave a comment to the repo owner asking them to merge?
For now, you could use the forked & updated version: https://github.com/Aesthetikx/heroku-pdftk-buildpack which works with heroku-18 stack.
If you are using an app.json file, then point the pdftk buildpack to the forked version:
"buildpacks": [
...,
{
"url": "https://github.com/fxtentacle/heroku-pdftk-buildpack.git"
}
]

Heroku Cedar-14 heroku-geo-buildpack GEOSException

I recently updated my heroku cedar from Bamboo to Cedar-14.
I had a geodjango buildpack installed which is now failing with this error:
OGRException: OGR failure.
This is my buildpacks:
cat .buildpacks
https://github.com/dulaccc/heroku-buildpack-geodjango.git
https://github.com/heroku/heroku-buildpack-python
https://github.com/gregburek/heroku-buildpack-pgbouncer.git#v0.3.2
This is my runtime:
cat runtime.txt
python-2.7.8
Is there a buildpack for geodjango that workis good on Cedar-14?
Thanks in advance
Managed to solve this issue by doing this:
Changed my .buildpack file to look like this:
https://github.com/dulaccc/heroku-buildpack-geodjango.git#1.1
https://github.com/gregburek/heroku-buildpack-pgbouncer.git#v0.3.2
I used here the latest release of the heroku-buildpack-geodjango by checking their release tags and specifying the latest one.
I ended up using this runtime.txt:
python-2.7.9
I made sure I had the following enviroment varialbles pointing to the correct location which is:
heroku config:set GDAL_DATA=.geodjango/gdal/share/gdal
heroku config:set GDAL_LIBRARY_PATH=.geodjango/gdal/lib/libgdal.so
heroku config:set GEOS_LIBRARY_PATH=.geodjango/geos/lib/libgeos_c.so
There is also an issue opened recently which explains more in this link:
https://github.com/dulaccc/heroku-buildpack-geodjango/issues/8

Install FFMPEG on Heroku

I am trying to install FFMPEG to work with my NodeJs server.
I am using heroku-buildpack-multi plugin:
heroku config:set BUILDPACK_URL=https://github.com/ddollar/heroku-buildpack-multi.git
I have created a .buildpacks (without extesion) file at my github repository. This is what it includes:
https://github.com/jayzes/heroku-buildpack-ffmpeg
https://github.com/heroku/heroku-buildpack-nodej
Each time i am trying to push my changes to heroku, this is what i get:
-----> Fetching custom git buildpack... failed
! Push rejected, error fetching custom buildpack
Unforlunatly, there is not much information regarding ffmpeg installtion
on heroku. What am i missing here?
I just tried this with a demo app I cloned from Heroku:
https://github.com/heroku/node-js-getting-started.git
I was able to deploy successfully following the same steps you listed above, except I added an 's' to the end of your second buildpack (you have a typo - could this be the issue?): https://github.com/heroku/heroku-buildpack-nodejs
I would recommend following the same process with a fresh codebase to help troubleshoot your environment. But note two things: 1) The heroku-buildpack-multi plugin you're using is deprecated, and 2) Heroku officially supports multiple buildpacks:
https://devcenter.heroku.com/articles/using-multiple-buildpacks-for-an-app
and has an officially supported ffmpeg buidback you can use:
https://elements.heroku.com/buildpacks/jonathanong/heroku-buildpack-ffmpeg-latest

Node.js version and Heroku

So, I got a small site started in node.js (my first one) using Express. Pretty happy with it, until I tried to deploy to Heroku and found that I had 0.4.9 installed and they only support 0.4.7.
Is uninstalling 0.4.9 and installing 0.4.7 my only option, or is there a way to do a side-by-side on the two?
You can override the version of node.js and npm by customizing the Heroku build pack:
http://blog.superpat.com/2011/11/15/running-your-own-node-js-version-on-heroku/
Actually...you do not have to remove anything.
Just ensure you are using features of node compliant with node 0.4.7 and when you make your package.json which specifies your dependencies has the correct version number or range specified.
I had a similar issue where one of our developers made is packacge and set the dependency to node 0.4.8 however it didn't require this it was just what version he was using at the time, we ended up updating his package.json to list node 0.4.7 instead and then my package which depended on his deployed to heroku just fine.
It seems Heroku only supports 0.4.7 at the moment and even suggests to develop strictly on that version.
If you have to use heroku then you have to uninstall 0.4.9, install 0.4.7.
If you don't have to use heroku. You can always setup a VPS yourself, and you will have the freedom to install whatever version that pleases you. :D

Resources