Offer a Quarkus Dev Services compatible way to launch Kafka and PostgreSQL containers with API server
Current Behavior
Currently, local development on the API server requires Kafka and PostgreSQL to be launched via Docker Compose.
While this works, it's a bit fiddly and not a good experience for new contributors.
Quarkus has Dev Services, which can automatically launch containers for infrastructure dependencies such as message buses and databases. Further, multiple services can discover and re-use existing containers started by another service.
The API server, being based on Alpine, does not offer a comparable capability. However, Dependency-Track v4.x already offers a dev-only feature to enable the H2 web console (https://github.com/DependencyTrack/dependency-track/pull/2592), which can only be enabled through the h2-console Maven profile.
Proposed Behavior
Implement a new dev-only capability to automatically start Kafka and PostgreSQL containers.
Optimally, make it so that containers started by the API server can be reused by Quarkus services, and vice versa. This needs a bit of investigation as to how Quarkus performs discovery on existing containers. Based on my current understanding, container labels play a role.
Similar to the H2 console, leverage a Maven profile to ensure that production builds will not have this behavior.
Implementation notes:
- Use docker-java to launch and discover containers
- Execute this logic in a
ServletContextListenerso it's run on application startup - Register the listener as one of the first in
web.xmlso it executes before the database or Kafka clients are initialized
Checklist
- [X] I have read and understand the contributing guidelines
- [X] I have checked the existing issues for whether this enhancement was already requested
Hey, I will replicate the issue and take it up. Can you assign this to me?
@withPrasheel Are you still planning to work on this?
Hi @nscuro , I worked on the setup and understanding of the documentation. I have an exam due tomo 5pm right now, after which I will be available complete summer. So I can work on it after it. Is there a deadline you are expecting for this?
Thanks for reporting back @withPrasheel! No deadline at all, just checking in to see if we need to un-assign people from issues they don't have the capacity to work on. Otherwise they'd be blocked for other contributors interested to work on them. :)
Please let me know if you need help in any way!
@nscuro Can you unassign this issue? It's taken too much time, and I am not able to find time. I will continue to work in my capacity, learning a few things first in case no one takes it up later. Sorry for the inconvenience.
Sure, no worries!
Related https://github.com/quarkusio/quarkus/issues/40376