Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Document how to integrate Quarkiverse Amazon DevServices with custom Dev Services #1527

Open
ryandens opened this issue Dec 16, 2024 · 1 comment

Comments

@ryandens
Copy link

I have a quarkus app that uses Amazon S3 that I like to use in quarkus dev mode. I really enjoy and appreciate this extensions ability to start a localstack container and configure my AWS SDK inside the app.

My app has an external dependency on another service that I run locally with Docker. This service also needs access to the same localstack container as my app. I attempted to write a dev service and can quite easily create another extension that creates a new DevServicesResultBuildItem responsible for starting/stopping a docker container.

However, getting access to the localstack container's generated host name on the the network is quite challenging. This line of code is responsible for configuring the network with the hostname localstack-<random-string>.

It would be nice to be able to explicitly depend on the Amazon Dev Service build item in some way shape or form, but I was unable to do that. I can't reliably find that the amazon devservice container starts before my own build item so manually inspecting the docker daemon state and attempting to discover the localstack network/hostname/host port doesn't seem to work either.

Is there some mechanism I'm missing with quarkus extensions?

@scrocquesel
Copy link
Member

AFAIK, it is currently not possible to orchestrate order of dev services from different extensions. I guess each container should be responsible of waiting for its dependencies to be available to be ready. This should be enough if the dependency graph acyclic and it keeps things simple and isolated.

When not possible, this discussion is a good start describing your issue. you could also look at this DevServices Processor where it implements a consumer of DevServicesLauncherConfigResultBuildItem to ultimately start a container but you will not be able to return dev services properties.

As for, Quarkus Amazon extension, I think that if we add ability to configure a network alias for the container, you should be able to connect to it from your other dev services when using a shared network. The line ConfigureUtil.configureSharedNetwork should be rewrited accordingly to a more recent pattern introduced by this PR. Then when shared network is turned on, we can add a predictable network aliases based on the serviceName (something like .withNetworkAliases(serviceName);) The alias will be localstack-s3 in dev mode.

Would you like to contribute ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants