Don't fork me!

Travis CI status: Build Status

GitLab CI status: Build Status

1. Introduction

2. development

run locally
./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

3. production

prepare heroku.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
brew install heroku
register in heroku.com and login
heroku login
create heroku app (in my case it’s daggerok-java-buildpack)
heroku create daggerok-java-buildpack
customize java/maven versions: create file system.properties with content:
java.runtime.version=1.8
maven.version=3.5.3
configure application:
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)
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
heroku addons:create heroku-postgresql:hobby-dev
now let’s switch out spring-boot app to production prpofile which is using postgres database:
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:

generated by generator-jvm yeoman generator (java-spring-boot)

4. Implementation