Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/daggerok/heroku-gradle-buildpack-example
Heroku gradle buildpack example.
https://github.com/daggerok/heroku-gradle-buildpack-example
buildpack gradle heroku heroku-buildpack herokuapp
Last synced: 7 days ago
JSON representation
Heroku gradle buildpack example.
- Host: GitHub
- URL: https://github.com/daggerok/heroku-gradle-buildpack-example
- Owner: daggerok
- License: mit
- Created: 2018-06-11T22:33:38.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2018-06-11T23:05:40.000Z (over 6 years ago)
- Last Synced: 2024-11-11T15:39:41.058Z (2 months ago)
- Topics: buildpack, gradle, heroku, heroku-buildpack, herokuapp
- Language: Java
- Homepage: https://daggerok.github.io/heroku-gradle-buildpack-example
- Size: 141 KB
- Stars: 0
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.adoc
- License: LICENSE
Awesome Lists containing this project
README
= heroku-gradle-buildpack-example image:https://travis-ci.org/daggerok/heroku-gradle-buildpack-example.svg?branch=master["Build Status", link="https://travis-ci.org/daggerok/heroku-gradle-buildpack-example"] image:https://gitlab.com/daggerok/heroku-gradle-buildpack-example/badges/master/build.svg["Build Status", link="https://gitlab.com/daggerok/heroku-gradle-buildpack-example/-/jobs"]
//tag::content[]
== migrate from maven to gradle (heroku only).install heroku cli, register (if has no account) and login
[source,bash]
----
brew install heroku
heroku login
----.clone my heroku maven (java buildpack) example project which has already ptrepared gradle stuff
[source,yml]
----
git clone https://github.com/daggerok/heroku-java-buildpack-example.git
rm -rf .git .mvn mvnw* pom.xml heroku.yml
----.add requred heroku-gradle setup
[source,yml]
----
echo "task stage(dependsOn: 'build')" >> build.gradle
----.create heroku app and deploy to it with development profile
[source,yml]
----
git init .
heroku create daggerok-gradle-buildpackecho "web: SPRING_PROFILES_ACTIVE=dev ./build/libs/*.jar" > Procfile
git add .
git commit -am "First blood!"
git push heroku masterheroku logs -t
# find output: The following profiles are active: dev,spring-boot,data-jpa
----key points here (if you just create app from scratch):
- you need prepare gradle `stage` task for build
echo "task stage(dependsOn: 'build')" >> build.gradle
- you need prepare Procfile with bash application startup command (in out case it's: `./build/libs/*.jar`)
echo "web: SPRING_PROFILES_ACTIVE=dev ./build/libs/*.jar" > Procfile
- you need install gradle wrapper in your project
gradle wrapper
git add -f gradle*
git commit -am "Add gradle wrapper"== going production
.for production (heroku) version add postgres database
[source,bash]
----
heroku addons:create heroku-postgresql:hobby-dev
----.now let's configure correct heroku URL and switch spring-boot app to production prpofile which is using postgres database:
[source,bash]
----
echo "web: SPRING_PROFILES_ACTIVE=prod APP_BASE_URL=https://daggerok-gradle-buildpack.herokuapp.com ./build/libs/*.jar" > Procfile
git add .
git commit -am "Setup right heroku application environment variables"
git push heroku master
----.just FYI
[source,bash]
----
heroku git:remote -a daggerok-gradle-buildpack
git remote -v
# skip others...
heroku https://git.heroku.com/daggerok-gradle-buildpack.git (fetch)
heroku https://git.heroku.com/daggerok-gradle-buildpack.git (push)
----link:
- link:https://devcenter.heroku.com/articles/getting-started-with-gradle-on-heroku#deploy-the-app[Getting Started with Gradle on Heroku]
- link:https://devcenter.heroku.com/articles/deploying-gradle-apps-on-heroku[Heroku Gradle documentation]
- link:https://github.com/heroku/heroku-buildpack-gradle[heroku buildpack gradle]
- link:https://github.com/heroku/gradle-getting-started[Gradle heroku buildpack example project]generated by link:https://github.com/daggerok/generator-jvm/[generator-jvm] yeoman generator (java-spring-boot)
//end::content[]