Hello, I’m looking to run some Kotlin code on a re...
# server
b
Hello, I’m looking to run some Kotlin code on a remote server that makes an api POST request every 24 hours and saves the result to a remote database. Im comfortable with the Kotlin code portion of what I’m trying to do but I have no experience with deploying code to a server to run continuously. Can anyone point me in the right direction? Are Google cloud functions a good solution for this?
l
If you’re looking to go the google route, look into AppEngine. Kotlin can compile to JVM bytecode, so use the method of uploading a jar instead of java code.
The free tier of AppEngine allows up over 24 hours/day of CPU time if it hasn’t changed, so if you’re only using one CPU, you don’t even have to worry about efficient sleep.
b
Thank you @Landry Norris, I’m not opposed to using services other than Google. Is there a different service or approach you’d recommend or is the Google route a good choice for something like this?
Also sorry I’m not too versed on the differences but why app engine as opposed to just a cloud function?
l
Google AppEngine is a pretty good route. I’ve used it before with Ktor just fine.
You could also do a cloud function instead if you are just doing a POST request. Same idea, compile as JAR and upload that.
🙏 1
I remember cloud functions having a decent start time with JVM, though. It was at least a second if I remember correctly.
b
Ok that’s very helpful thank you. I’m not overly concerned with performance since it’s just a single post request that would be made once daily. My thoughts are I’d save the response to a remote data base which mobile apps would then read from.
l
Clound function ought to be fine then.