I created simple java app, built jar, and now I am trying to deploy it on heroku. The problem is that I can't setup right jdk version. I need jdk 17.0.2, but heroku provides only jdk 8 by default.
I use heroku java cli plugin (https://github.com/heroku/plugin-java), and according to the documentation I created Procfile in folder with my jar:
web: java $JAVA_OPTS -jar <myjar>.jar -v 17.0.2 $JAR_OPTS.
but nothing has changed.
I've also tried deploy my jar like this:
heroku deploy:jar <myjar>.jar -v 17.0.2 -a <appname>
heroku deploy:jar <myjar>.jar -a <appname> -v 17.0.2
instead of simple:
heroku deploy:jar <myjar>.jar -a <appname>
but it also did't help.
Since I'm trying to deploy jar, I can't use git and change jdk version by system.properties file. How can I solve this problem? Thanks for any help.
Related
I'm getting an error when my dyno attempts to start nginx, on both heroku-16 and heroku-18:
bin/start-nginx: No such file or directory
I used the heroku-buildpack-multi buildpack.
.buildpacks file:
"https://github.com/heroku/heroku-buildpack-nginx.git"
"https://github.com/heroku/heroku-buildpack-nodejs.git"
Procfile:
web: bin/start-nginx npm start
Is there something I'm missing?
It seems that the latest versions of Heroku CLI support multiple buildpacks natively, and the .buildpacks file is not used, so all I had to do was use the command (from here):
heroku buildpacks:add --index 1 https://github.com/heroku/heroku-buildpack-nginx.git
to add the nginx buildpack.
I have installed heroku with homebrew in my OSX El Capitan(10.11.5) and installed the heroku-container-tools with:
heroku plugins:install heroku-container-tools
The installation goes successfully:
Installing plugin heroku-container-tools... done
When I run a heroku version, I got this:
heroku-toolbelt/3.42.22 (universal.x86_64-darwin15) ruby/2.0.0
heroku-cli/5.2.20-9d094b0 (darwin-amd64) go1.6.2
=== Installed Plugins
heroku-container-tools#3.0.0
But when I run a heroku container:init I got this:
! `container:init` is not a heroku command.
! See `heroku help` for a list of available commands.
Running heroku help container I got this:
Usage: heroku container
Use Docker to build and deploy Heroku apps
Use Docker to build and deploy Heroku apps
Additional commands, type "heroku help COMMAND" for more details:
container:login # Logs in to the Heroku Docker registry
container:push [PROCESS] # Builds, then pushes a Docker image to deploy your Heroku app
I am following this heroku tutorial: https://devcenter.heroku.com/articles/local-development-with-docker
In the tutorial is said to run heroku container:init
This command was replaced but some other and heroku did not updated their documentation or I have some problem installing the plugin?
Yes, they restricted access to their container registry, just read the warning on top of the tutorial you're following https://devcenter.heroku.com/articles/local-development-with-docker
heroku container:release, which creates a Heroku-compatible slug and
deploys it to Heroku, has been deprecated. For access to our container
registry (available in private beta), please contact
docker-feedback#heroku.com
now there are only login and push commands. I hope you can easily ask for the access.
I'm testing an older package and it won't successfully run unless I boot Meteor with:
meteor --allow-incompatible-update
It's my intention to deploy this application to Heroku. I'm also using a buildpack to accomplish this: https://github.com/jordansissel/heroku-buildpack-meteor
How does one deploy an app to Heroku while passing in a flag/setting on the CLI?
You need to fork the buildpack and edit this line: https://github.com/jordansissel/heroku-buildpack-meteor/blob/master/bin/compile_meteor#L64
meteor build ../build --allow-incompatible-update --directory 2>&1 | indent
You can then use this fork as your buildpack.
so I have building management app, which locally uses the pdftk to generate pdf forms (prefilled with tenant/expense data). Works like magic on my local machine.
However, on Heroku I get the error:
pdftk executable /usr/local/bin/pdftk not found
in the logs when I try to generate the pdf file. I realize that I need to install pdftk on my heroku app using a buildpack. I've tried following some tutorials with Vulcan, but vulcan is deprecated and they say use heroku run, however I can't find much documentation of how to install the pdftk-source: https://github.com/millie/pdftk-source using heroku run.
I'm going to try https://github.com/millie/heroku-buildpack-ruby-pdftk, but if there is an easier/less messy way let me know, thanks!
EDIT:
Tried the above method, and now my heroku logs say:
RuntimeError (pdftk executable /app/vendor/pdftk/bin not found)
So I'm thinking the buildpack didn't include pdftk to begin with, which doesn't make sense.
I must be doing something wrong, but I followed the instructions exactly, only difference is I used dropbox instead of S3 to store the tar.gz file (the pdftk source)
EDIT:
OK, I figured out how to include pdftk executable in the heroku buildpack and upload it successfully as part of the app environment. HOWEVER, for some very strange reason, in the heroku bash console, when I cd into pdftk directory and try to run the executable, heroku bash says pdftk executable not found.
It works on my local machine, when cd into the pdftk directory and run pdftk, it runs the executable, so its not the executable..so why isn't it working inside the heroku bash directory?
SOLUTION:
Was missing setting LD_LIBRARY_PATH in my config vars on heroku, because pdftk relies on a library file. Also, remember to tar the tar.gz to the root directory and set a PATH to /bin/pdftk. Just check out #heroku on IRC, that's where I got my answer.
Was missing setting LD_LIBRARY_PATH in my config vars on heroku, because pdftk relies on a library file. Also, remember to tar the tar.gz to the root directory and set a PATH to /bin/pdftk. Just check out #heroku on IRC, that's where I got my answer.
This is how i setup pdftk in nodejs app in heroku
Create heroku app
heroku create
Set buildpack for pdftk
BUILDPACK_URL=https://github.com/ddollar/heroku-buildpack-apt
Set buildpack for nodejs
heroku buildpacks:add --index 1 heroku/nodejs
Add the libgcj.so.* to your search path:
heroku config:set LD_LIBRARY_PATH=/app/bin
Turn on at least one dyno
heroku ps:scale web=1
Create a Procfile in the root of your project and define the following:
web: node server.js
Push changes in heroku
git push heroku master
Adding answer that worked as of July 2019
Note: Thanks to shake-apps for creating the Buildpack https://elements.heroku.com/buildpacks/shake-apps/heroku-buildpack-pdftk
If you need to have PDFtk installed on Heroku for a Node JS Application, follow these instructions:
Heroku Installation
You'll need to set the base nodejs buildpack, and the pdftk buildpack by shake-apps.
Set them by running the following:
heroku buildpacks:set heroku/nodejs;
heroku buildpacks:add --index 1 https://github.com/shake-apps/heroku-buildpack-pdftk.git;
After build packs are set, the server can be deployed normally with
git push heroku master
If you have any issues with the deploy it could be your previous buildpack. You can clear it to start fresh with:
heroku buildpacks:clear
I want to use a scala script in console on Heroku.
So, after command
$heroku run bash
I try a script ./scala_script.sh, but the result is scala: not found.
So, how to install scala or even some package on Heroku?
Thanks
If this is a Scala app, you should use the Scala buildpack. You can hardcode the buildpack url:
$ heroku config:set BUILDPACK_URL=https://github.com/heroku/heroku-buildpack-scala
If you need Scala in addition to Play! Framework, you can experiment with buildpack-multi to get both buildpacks applied to your app.