I've made a simple web server with Ktor using build system Gradle. My build.gradle
file applies the application
plugin:
application {
mainClass.set("io.ktor.server.netty.EngineMain")
}
So I can use ./gradlew run
to run the web server
This works, but I would like to deploy my web server as a service on my VPS, because I would like the web app to restart automatically when Ubuntu reboots.
I don't know so much about Linux internals and Googling around I'm quite confused by how I should confront this.
I gathered that I should maybe define a init.d
task, but how? Can I just write a bash script which runs ~/MyApp/gradlew run
? Where do I put it?
init.d is the old, deprecated system for starting daemons; is has been supplanted by upstart. Upstart has the advantage of being far easier to configure and allows proper sequencing of task initialization.
I gathered that I should use upstart
, but how?
Project is in maintaince mode only. No new features are being developed and the general advice would be to move over to another minimal init system or systemd.
I gathered that I should use systemd
, but how?