Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/daggerok/heroku-java-buildpack-example
Heroku java buildpack example.
https://github.com/daggerok/heroku-java-buildpack-example
heroku herokuapp java maven mvn mvnw
Last synced: 3 days ago
JSON representation
Heroku java buildpack example.
- Host: GitHub
- URL: https://github.com/daggerok/heroku-java-buildpack-example
- Owner: daggerok
- License: mit
- Created: 2018-06-11T16:18:31.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2020-11-01T22:38:42.000Z (about 4 years ago)
- Last Synced: 2023-04-05T03:19:10.551Z (over 1 year ago)
- Topics: heroku, herokuapp, java, maven, mvn, mvnw
- Language: Java
- Homepage: https://daggerok.github.io/heroku-java-buildpack-example
- Size: 201 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.adoc
- License: LICENSE
Awesome Lists containing this project
README
= heroku-java-buildpack-example (maven) image:https://travis-ci.org/daggerok/heroku-java-buildpack-example.svg?branch=master["Build Status", link="https://travis-ci.org/daggerok/heroku-java-buildpack-example"] image:https://gitlab.com/daggerok/heroku-java-buildpack-example/badges/master/build.svg["Build Status", link="https://gitlab.com/daggerok/heroku-java-buildpack-example/-/jobs"]
//tag::content[]
== development.run locally
[source,bash]
----
./gradlew
java -jar build/libs/*.jar --spring.profiles.active=dev
SPRING_PROFILES_ACTIVE=dev bash build/libs/*.jar./mvnw
java -Dspring.profiles.active=dev -jar target/*.jar
bash target/*.jar./mvnw; ./mvnw com.dkanejs.maven.plugins:docker-compose-maven-plugin:1.0.1:up
./mvnw com.dkanejs.maven.plugins:docker-compose-maven-plugin:1.0.1:down
----== production
.prepare heroku.yml
[source,yml]
----
# default java build pack will use maven wrapper command: `./mvnw clean innstall`
build:
languages:
- java
run:
web: java -Dspring.profiles.active=dev -jar target/*.jar
----.install heroku cli
[source,bash]
----
brew install heroku
----.register in heroku.com and login
[source,bash]
----
heroku login
----.create heroku app (in my case it's `daggerok-java-buildpack`)
[source,bash]
----
heroku create daggerok-java-buildpack
----.customize java/maven versions: create file `system.properties` with content:
[source,bash]
----
java.runtime.version=1.8
maven.version=3.5.3
----.configure application:
[source,bash]
----
heroku config:set APP_BASE_URL=https://daggerok-java-buildpack.herokuapp.com
heroku config:set SPRING_PROFILES_ACTIVE=dev# output:
# Setting APP_BASE_URL and restarting ⬢ daggerok-java-buildpack... done, v5
# APP_BASE_URL: https://daggerok-java-buildpack.herokuapp.com
----.deploy dev version first (using H2 inmemory database)
[source,bash]
----
git remote -v | grep heroku
git add .
git commit -am "First blood: prepare heroku development deployment."
git push heroku master
open https://daggerok-java-buildpack.herokuapp.com
heroku logs -t
----.for production (heroku) version add postgres database
[source,bash]
----
heroku addons:create heroku-postgresql:hobby-dev
----.now let's switch out spring-boot app to production prpofile which is using postgres database:
[source,bash]
----
heroku config:set SPRING_PROFILES_ACTIVE=prod
heroku logs -t
# verifu log contains: The following profiles are active: prod,app,spring-boot,data-jpa
----link:
- link:https://github.com/heroku/heroku-buildpack-java[heroku java buildpack]
generated by link:https://github.com/daggerok/generator-jvm/[generator-jvm] yeoman generator (java-spring-boot)
//end::content[]