Hi! I’m new to Kotlin and compiled languages and m...
# getting-started
a
Hi! I’m new to Kotlin and compiled languages and my question is: are there some practice to develop server application? I want to add an ability to our team unwrap project with some microservices in a couple of clicks for development. So things I’m trying to do is setup docker compose with these service, DB, etc. mount code via volume to app container and run by command. It is good way to develop JVM application or not? I asked because a lot of examples made by just compiling jar, copy to container and run from it and examples like that. These examples seem not as good decisions, because we need to recompile it every time and build again and again and also because we can use auto-rebuild on code changes that we don’t use. So could anyone explain? Thanks!
j
I'm not entirely sure what you're asking for. The use case would be that other teams unfamiliar with the project could clone your repo and run your set of microservices + db quickly and easily to develop against that running server? Or is it for the team developing this project?
a
Actually it is not matter who developing this project, question was mostly about how to simplify and speed up development and preparations to it and do I use the right way?
j
Docker-compose is a nice way to setup side services. The question is rather about the main application. Usually if you're using Kotlin/JVM you already benefit from the multiplatform aspect of the JVM itself. Building outside docker and then copying the jar into the docker image is actually pretty good IMO, but you may as well just run the app on the host. If you're using a build tool like Gradle you'll get a build cache and incremental compilation, rebuilding the whole project may actually be really quick especially if you don't change much. Are your concerns about recompilation theoretical, or based on actual experience?
a
Theoretical, of course. I know quite a bit about it, so asked to understand more. Thank you
h
If you want to use Docker with JVM you should keep startup and JIT time in mind. And I would use https://github.com/GoogleContainerTools/jib to create the container
s
then there is the new option of getting native images via GraalVM, e.g. by using Spring Boot 3 https://www.baeldung.com/spring-native-intro Here is a link to my Kotlin-SpringBoot3 toy project, if you want to know what a basic setup for Kotlin with Gradle does look like: https://github.com/simon-void/native-spring-echo-kotlin/