Deploy
Introduction
Suppose you have a Ktor application named app and you want to deploy it to a remote server.
Fat JAR
Deploying a Ktor application involves packaging your code into a runnable format (usually a “Fat JAR”) and configuring a remote server to run it continuously while handling incoming web traffic.
Executable JAR file
To run the application on a server, you need to bundle your code and all its dependencies into a single, executable JAR file.
Open your terminal in the root of your project and run the build command:
Once the build succeeds, locate your packaged application. It will be located at build/libs/ and will likely be named something like app.jar.
Server
Connect to your server via SSH and install the Java Runtime Environment (JRE) so it can execute your JAR file.
Update your package manager and install Java (replace 17 with 21 if your project uses Java 21):
Create a directory to hold your application:
Estás leyendo una vista previa.
Inicia sesión para leer el artículo completo. Cualquier cuenta abre 4 artículos gratuitos al mes; el alumnado y el profesorado leen las páginas de su curso sin límite.
Iniciar sesión