-
Notifications
You must be signed in to change notification settings - Fork 39
Heroku
Heroku is a cloud platform that can host your JAICF server running with Ktor, Spring Boot or any other HTTP server.
Here is a ready to use template that can be used to deploy your JAICF project to Heroku cloud with a single click. You can investigate its Procfile and build.gradle.kts to learn how you can integrate your JAICF project with Heroku cloud.
Your JAICF project should be compiled into fat jar file that contains all required libraries inside. Also there should be Procfile available in the root of your project's source.
Sign-in and create an app on the Heroku dashboard.
Also add corresponding stage
task and main class configuration that points to the class with main
function.
Here is an example:
plugins {
application
kotlin("jvm") version "1.3.61"
id("com.github.johnrengelman.shadow") version "5.0.0"
}
application {
mainClassName = "com.justai.jaicf.template.ServerKt"
}
repositories {
mavenCentral()
jcenter()
}
dependencies {
implementation(kotlin("stdlib-jdk8"))
implementation("com.just-ai.jaicf:core:$jaicf")
implementation("io.ktor:ktor-server-netty:$ktor")
...
}
tasks.withType<Jar> {
manifest {
attributes(
mapOf(
"Main-Class" to application.mainClassName
)
)
}
}
tasks.create("stage") {
dependsOn("shadowJar")
}
Replace "app-name-1.0.0" with your app name and version:
web: java -jar build/libs/app-name-1.0.0-all.jar
Install Heroku CLI and run these commands from inside the project's folder:
$ git add .
$ git commit -am "make it better"
$ git push heroku master
Heroku will build and deploy your server automatically.
Each time you're ready to push some code changes to Heroku, just commit and push your code to the Heroku git as described in section 4.