CircleCI and Heroku automatic deployment - heroku

I'm trying to configure automatic deploy on Heroku integrated with CircleCI.
On Heroku Dashboard, at the Deploy tab, I have the option to configure an automatic deploy for a specific branch and there is an option "Wait for CI to pass before deploy". What happens when I have both this and the circle.yml configured for an automated deploy on Heroku? Will the app be deployed twice?

Yes it will.
CircleCi and Heroku will trigger building and deploying process at the same time

Related

How can i deploy my spring boot application to github actions self hosted runner?

I want to deploy my application to my internal host machine.
This host has been added as my github runner.
In the github action step, I am running ./gradlew bootRun for my github runner. The application starts, but after the github actions workflow run, it is killed by a cleanup.
Terminate orphan process: pid (11111) (java)
Is github runners only for running a workflow. Should i be able to deploy my application such way?
Whats the right way to deploy my spring boot applcation to my internal host machine?

How do you deploy Maven project from Github to Heroku automatically?

So I have a Maven project and I'd like to deploy it on Heroku via Github. To be more precise I want to use automatic deployments where when I push to my master branch only then is it deployed. The only thing I found for Maven is that I add a dependency and it would deploy to Heroku from my machine (which I essentially don't want).
I really don't know what else to say as I had 0 progress. For now I am just pushing my target as well and then just running the target jar file. But I'd like to just send over my source code and for Heroku to build the project.
Alright, so I found my solution.
I saw an example (I can't find it now, no luck) for Heroku that build the project with a thing called mvnw script which is a Maven wrapper when it's not installed on the system. I added it and the .mvn directory but it didn't start by itself like how it is written on Heroku (it should run it when it's detected), no problem really.
I then edited my Procfile and instead of:
web: java -jar target/my-file.jar
I am using:
web: ./mvnw clean package; java -jar target/my-file.jar
And everything works well!
You only need to integrate your GitHub repository on Heroku, and define the automated deployment of the master branch (each push will trigger a deployment).
Heroku will build the JAR and take care of the deployment, you need though to define the Java version in a system.properties and create an Uber-Jar (ie including all dependencies).

Heroku deployment of Gradle application: pom.xml missing

I have an existing Maven based application on Heroku that I want to replace with a JHipster generated, Gradle based one. The steps I took were:
Develop the new Gradle based application using JHipster
run jhipster heroku
git merge heroku --strategy ours
git push heroku
Most of the deployment succeeds (Node.js app detected, webpack logging), but then I get an error:
Could not find a pom.xml file! Please check that it exists and is committed to Git.
It is correct that there is no pom.xml, because now it is a Gradle application. But apparently, Heroku still expects a Maven based one. Where is this knowledge stored and how can I reset it?
Already found out. You have to run this command, to remove the Maven build pack:
heroku buildpacks:clear
Additionally, in my case I also had to set:
heroku buildpacks:set heroku/nodejs
Or Heroku didn't know whether to run as Gradle or NodeJS. The latter is needed for JHipster based applications.

Heroku Deploy War with Jetty Runner

I'm looking for the way to deploy my app in Heroku with Jetty Runner. By not using Heroku Git (Deploy your application to Heroku
) as way of deployment.
heroku war:deploy <path_to_war_file> --app <app_name>
Will run the war with Tomcat Web Runner according to this documentation Deployment with the Heroku CLI.
The Heroku CLI Deploy Plugin deploys a local WAR file to Heroku and
runs it with Tomcat Webapp-Runner
I would like to know if there's a Jetty Runner equivalent.
Here is the one from heroku devcenter.
Ensure you have your Procfile created as mentioned in the article
Optinally ensure to run heroku ps:scale web=1 to allocate a dyno to your project

How to clean Heroku dependency cache (unmanaged maven dependencies)

I have to use an unmanaged SNAPSHOT dependency in my java/maven heroku app.
I do this using a project-local maven repository as desribed in this article.
Heroku caches the dependencies between builds. Unfortunatly Heroku does not notice if the SNAPSHOT Version changes and keeps on using the cached dependency. This leads to compilation errors as I depend on changes in the SNAPSHOT version.
Is there a way to manually or automatically clean this dependency cache?
I found this maven plugin (it does a local build and pushes the resulting artefacts to heroku) but its not really the way I want to do it.
One could argue its a bad practice to use this snapshot dependency in the first place but I think there are other more or less valid reasons for cleaning the cash e.g. leaking storage as the unmanaged dependencies are not even removed if they are deleted from the project local repository.
I appreciate your answer
There's a branch of the java buildpack that clears maven cache. To use it, configure your app to use the cache_clear branch:
heroku config:set BUILDPACK_URL=https://github.com/heroku/heroku-buildpack-java.git#cache_clear
===Update===
There's a plugin that clears cache on any app. Install it and run the purge-cache command.
$ heroku plugins:install https://github.com/heroku/heroku-repo.git
$ heroku repo:purge_cache -a appname
Login to heroko by console, go to the git repository directory of your app, run the following commands and try to push to the heroku git repository again
$ heroku config:set MAVEN_CUSTOM_GOALS="clean package"
$ heroku config:set MAVEN_CUSTOM_OPTS="--update-snapshots -DskipTests=true"
Now, it will download the latest SNAPSHOT from the repository before build.
Refer this heroku build pack for java for more details.
You can also configure a custom settings.xml for your maven, refer this heroku documentation.
I've written plugin with an alternate take: bundling the container + the war image into a git repository base image (for now, its either winstone and/or jetty) which is pushed to Heroku, thus maving easier to deploy (I think) :]
http://cedarhero.ingenieux.com.br/heroku-maven-plugin/
This doesn't answer the question directly, but if you're having the same issue with Clojure project (using Leiningen), there's a better way to handle this than purging cache with each build: use :update :always property for the repository you're working with. (https://github.com/technomancy/leiningen/blob/master/sample.project.clj#L91)
:repositories [["releases" {:url "http://blueant.com/archiva/internal"
;; How often should this repository be checked for
;; snapshot updates? (:daily, :always, or :never)
:update :always}]]

Resources