1.6 KiB
🧰 Deployment Configuration
Need to configure project to be able to deploy on Heroku.
Set up configuration files
- Create
app.jsonin the root directory of the project and add content as below.
{
"name": "Noty API",
"description": "The API for Noty",
"image": "heroku/java",
"addons": [
"heroku-postgresql"
]
}
- Create a
system.propertiesfile describing your java version:
java.runtime.version=11
Define Gradle Task
Whenever deployment is triggered on Heroku, it executes Gradle task - stage which will be responsible for project build generation and then deployment. So declare a Gradle task in build.gradle
task stage {
dependsOn installDist
}
!> If this is not configured then you can face the error generated by heroku at the time of deployment.
Set up Procfile
You will also need a Procfile describing what to execute at the time of deployment.
As we set up Gradle task in previous step, whenever Gradle task stage is executed, built application artifacts are generated at the path application/build/install/application/bin/application. In the Procfile, just provide the name of the process and the generated executable file.
web: application/build/install/application/bin/application
Okay, It's time to test deployment locally.