Hi, how can I set up a Kotlin microservice using k...
# ktor
l
Hi, how can I set up a Kotlin microservice using ktor on a public cloud such as Google Cloud? I'm particularly interested in Google Cloud supported because they are carbon neutral, and provide DDoS protections along with a competitive price and more, and I want to try cutting edge Kotlin stuff, hence why ktor. Also I wonder if JetBrains is not already in talks with Google about that since they already have some partnership for Android + Kotlin and also Android Studio
d
If you need orchestration for a server cluster using Docker Swarm, I highly recommend DevOps Toolkit series from Viktor Farcic on leanpub... we set up our clusters with ci, monitoring and self-adaptation using those books, he explains things very well...
k
Google cloud runs Java fine.. ktor is just a Java app..m
d
Right, @kenkyee, but he said microservice... meaning that there would be many services speaking to each other. To ensure high availability and scalability of such services, they need to run in a cluster... which Vert.x does out of the box, could be replaced by Docker Swarm or Kubernetes... If it's just a one service api, that's not going to grow, then the cloud might not be necessary... but I would still recommend Docker to make the service portable... it's frustrating when you spend hours or days setting up a server just to discover the fs got messed up and you have to start all over (it happens...), with Docker, all the dependecies are set up in a declerative fashion and can be easily ported.
There's a very nice free pdf guide for understanding microservices in the Vert.x docs main page, worth reading to start on the subject..
k
It sounds like he just wants to try setting it up as a microservice and wanted to know if it can be put in Google cloud... The answer to that is yes.. You're definitely right that it should be done in a scalable way for a real project 😉. But for playing, not necessarily for a first attempt to learn....
l
Thanks for your help all. To be more specific: I'm looking for samples that I can try on Google Cloud if there's any, and I'm looking to get a basic example of scalability, that can run as multiple instances when load increases while sharing common data (through a database and some (virtual?) file system). The only server stuff I did on the JVM at the moment was following a Google App Engine tutorial successfully when I was a student, using Java 7, about 3 years ago, but it seems like there's different approaches to scalability that can work a Kotlin backend/microservice(s) on Google Cloud today (heard of Docker, Kubernetes, Cloud Functions in JS and maybe Kt2Js, still Google app Engine, and more...), so I'm a bit lost.
d
Like I said @louiscad, those books are very very good, the author has a slack channel and is very friendly and helps when he can... for me, it was the only way I managed in such short time to get a production environment in Docker Swarm up and running and it takes care of scalability... the only thing is that Docker for AWS is much easier... especially for services needing storage... but then dbs can always be replicated... Check out the sample chapters... he goes step by step and hands on and gives lots of good advice, you're probably just trying things out right now, but if you want to do anything serious -- you'll need that info.
Of course, if you're just looking for one server, then all of what I said doesn't apply...