Deploying a Ktor App
You can find the step-by-step deployment guide here.
This guide explains how to build and deploy a Ktor application on Hostman App Platform. It covers the build environment, JAR selection process, and the runtime requirements your application must meet for a successful deployment.
Building the Application Copy link
The application is built using the following environment:
- OpenJDK
- Kotlin
- Gradle
The build process runs in the root of the repository or in the directory specified in the Project directory path field.
If the project includes a gradlew file, the template uses Gradle Wrapper for the build process. If gradlew is not present, the system Gradle installation is used instead.
By default, the following build command is executed:
./gradlew buildFatJar --no-daemonIf Gradle Wrapper is not available, the following command is used instead:
gradle buildFatJar --no-daemonSelecting the JAR File to Run Copy link
After the build is completed, App Platform selects the JAR file to run using the following logic:
- If the
build/libs/directory contains a file matching the*-all.jarpattern, that file is used. This is typically the fat JAR generated by Ktor. - If no
*-all.jarfile is found, the platform uses the first.jarfile found in thebuild/libs/directory.
Make sure the Ktor Gradle plugin is configured correctly and that the buildFatJar task is available in the project.
Application Requirements Copy link
Make sure your application listens on 0.0.0.0 instead of 127.0.0.1. Otherwise, external connections will not be able to reach the application.