Normally, you should push your changes to the dokku repository and watch your code compile and run smoothly. But sometimes, the process of gathering dependencies and compiling your code takes to much time and processor, that sometimes gets rejected or it simply won’t compile on dokku server.
Probably, you already have a valid, tested, runnning jar in your development machine that you want to run on dokku, so how could you push this jar to the dokku server? well, let’s see…
In heroku, you have, among other options, the command
I don’t know of such a command for dokku. but nevertheless you can deploy any jar(Many Java and JVM applications are packaged into a self-contained executable JAR file that includes application code, configuration and dependencies. These artifacts are often called “uberjars” or “fat jars”) with the following trick.
This article explains how to get a metabase runnable jar onto dokku. I’ve tried and it almost worked, the only really difference is that you have to create a java application skeleton with a maven archetype, and put your jar into version control.
so, first let’s create the skeleton for our java app deployment
mvn archetype:generate -DgroupId=com.sample -DartifactId=sample-jar-deploy -DarchetypeArtifactId=maven-archetype-quickstart -DinteractiveMode=false
then run the following commands to configure and deploy to dokku
cd sample-jar-deploy cp ~/Apps/sample-app/target/sample-app.jar . echo "web: java $JAVA_OPTS -jar sample-app.jar --server.port=$PORT" > Procfile git init git add . git commit -m 'sample-app.jar version 0.1' ssh email@example.com apps:create sample-app git remote add dokku firstname.lastname@example.org:sample-app git push dokku master
to upgrade your app
cp ~/Apps/sample-app/target/sample-app.jar . git commit -am 'sample-app.jar version 0.2' git push dokku master
Beware that this is definitively going to increase the size of the repository. This is only a temporary repository to have the jar deployed, your source and main repository should be in ~/Apps/sample-app/
to clean up and start over
cd sample-jar-deploy rm -rf .git/ cp ~/Apps/sample-app/target/sample-app.jar . git init git add . git commit -m 'sample-app.jar version 0.3' ssh email@example.com apps:destroy sample-app ssh firstname.lastname@example.org apps:create sample-app git remote add dokku email@example.com:sample-app git push dokku master
Of course you can deploy using buildpacker, dockerfile, docker image, and tarball based deploys which are documented.
View story at Medium.com
Hi, do anyone know if there's command like 'heroku deploy:jar' available for dokku [16:09] https://devcenter.heroku.com/articles/deploying-executable-jar-files#using-the-heroku-deploy-cli-plugin [16:13] no [16:13] we support buildpacker, dockerfile, docker image, and tarball based deploys [16:14] http://dokku.viewdocs.io/dokku/getting-started/installation/ [16:14] sidebar on that page shows our deployment methods