I have been developing Golang server applications ...
# ktor
d
I have been developing Golang server applications for 10 years, and I am interested in exploring Ktor embedded native server applications, to be compiled and run as a single binary file, the same as with Golang. However, looking through the Ktor documentation, I found some contradictions about HTTPS. Here (https://ktor.io/docs/native-server.html) it's written that "HTTPS without a reverse proxy is not supported" with a Ktor native server. Here (https://ktor.io/docs/ssl.html#embedded-server) instead there are setup instructions for SSL in embedded native servers. Can anyone clarify if it's possibile to build and run https server applications in Ktor native server as single binaries?
a
embeddedServer
is a function, “simple way to configure server parameters in code and quickly run an application” https://ktor.io/docs/create-server.html#embedded it doesn’t necessarily mean that the Ktor server is targeting Kotlin/Native
here’s a ticket with more details on SSL support for both Ktor client and server https://youtrack.jetbrains.com/issue/KTOR-4085/Multiplatform-Client-Server-SSLTLS-configuration
On current moment SSL API for server is provided only on JVM.
(although it hasn’t been updated in a while)
d
Thanks for the clarification. Indeed I made confusion between the terms "embedded" and "native". I hope SSL is going to be available on Kotlin Native soon, as this would open the opportunity to have the full server application contained into a single binary, just like in Golang, without the need of installing a virtual machine on the production server and dumping JVM for good.
a
for native images, you could consider GraalVM https://ktor.io/docs/graalvm.html And there was a thread recently on how to improve performance for single-shot JVM apps https://kotlinlang.slack.com/archives/C0A974TJ9/p1674830273783799
d
I am interested in running simple applications on a cheap cloud machine instance. Installing a JVM on a cloud instance already drains a lot of resources, and I am expecting a GraalVM installation would be expensive too. With Golang single binary server apps, it’s amazing how much you can run on a very cheap cloud instance, and I am expecting it will be possible to do the same with Ktor native server.