Abdulmomen's Blog مدونة عبدالمؤمن

Deploying Ktor on DigitalOcean

I was using Ktor for about a month and I have created a personal project, and I wanted to be deployed on a DigitalOcean droplet, that has Fedora 26 installed. Here are the basic steps I’ve collected in order to deploy your Ktor server running.

First of all, let’s install some required packages.

Pre-requesities

wget, unzip, zip

$ sudo dnf install wget unzip zip

SDKMAN!

$ curl -s https://get.sdkman.io | bash

then, this must be run at your user directory, e.g., at /home/<USERNANE>/ path:
$ source "/home/<USERNANE>/.sdkman/bin/sdkman-init.sh"

Java and Kotlin

After SDKMAN! has been installed, you should now install Java and Kotlin
$ sdk install java
$ sdk install kotlin

Running Ktor…

Now, locate your Ktor project,

$ cd your-ktor-project/

You might want to have the Gradle script be executable,
$ chmod +x gradlew

then, run the Gradle script,

$ ./gradlew run

  • You might get Caught an exception trying to connect to Kotlin Daemon, by which solved through running the above command again 🤔

Your server should be running now!

Well-know ports, e.g., 80, requires root permission.

Questions?

Please feel free to ask any question or explanation if there are missing content or not clear at some point.