49 lines
1.6 KiB
Markdown
49 lines
1.6 KiB
Markdown
# 🧰 Deployment Configuration
|
|
|
|
Need to configure project to be able to deploy on Heroku.
|
|
|
|
## Set up configuration files
|
|
|
|
- Create [`app.json`](https://github.com/PatilShreyas/NotyKT/blob/master/noty-api/app.json) in the root directory of the project and add content as below.
|
|
|
|
```json
|
|
{
|
|
"name": "Noty API",
|
|
"description": "The API for Noty",
|
|
"image": "heroku/java",
|
|
"addons": [
|
|
"heroku-postgresql"
|
|
]
|
|
}
|
|
```
|
|
|
|
- Create a [`system.properties`](https://github.com/PatilShreyas/NotyKT/blob/master/noty-api/system.properties) file describing your java version:
|
|
|
|
```properties
|
|
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`](https://github.com/PatilShreyas/NotyKT/blob/master/noty-api/application/build.gradle)
|
|
|
|
```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`](https://github.com/PatilShreyas/NotyKT/blob/master/noty-api/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.
|
|
|
|
```Procfile
|
|
web: application/build/install/application/bin/application
|
|
```
|
|
|
|
Okay, It's time to test deployment locally.
|