mavenmicroservicesquarkusvscode-devcontainerdevcontainer

How to setup Quarkus for devcontainers, quarkus:dev and micro services?


I have a maven multi-module project that uses Quarkus. Something like:

<project>
  <modules>
     <module>web</module>
     <module>customer</module>
     <module>warehouse</module>
     <module>payment</module>
  </modules>
</project>

Loosely following the answer found here and the Quarkus multi-module guide

The project relies on a RDBMS and a cache. So I setup a devcontainer using docker-compose.yml Each of the modules is an independent micro service with a http interface.

when running quarkus dev (or mvn compile quarkus:dev) on a module it starts in development mode. Now web calls out to the other services, so I add their compiled versions to docker-compose.yml and I can code in the web module.

For developing the customer module, I create a different docker-compose.yml file that loads the compiled web module and the customer module from source, etc. So I end up with one compose file for each module.

This leads to a sub-par development experience: to edit one of the micro services I have to terminate the devcontainer and restart it with a different configuration. This is slow and requires to deal with database persistence.

My question: is there way to setup a devcontainer environment for a multi-module maven project, so I can use quarkus dev concurrently on more than one sub module, so I don't need to go through the shutdown-reconfigure-resart cycle every time?


Solution

  • Turns out, once you wrap your head around (I had help from Alexey) the moving parts, it is quite possible.

    Key points:

    With this setup there is no more need for editing settings between runs. I have documented the insights in a blog entry accompanied by a sample project

    YMMV