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

Investigate support for Docker compose #30

Open
melix opened this issue Jun 21, 2022 · 4 comments
Open

Investigate support for Docker compose #30

melix opened this issue Jun 21, 2022 · 4 comments

Comments

@melix
Copy link
Collaborator

melix commented Jun 21, 2022

Feature description

Docker compose support is available in test containers. Investigate how we could use this.

https://www.testcontainers.org/modules/docker_compose/

@jamesdh
Copy link

jamesdh commented Jul 1, 2023

I tinkered with spring-boot-docker-compose in a Spring Boot 3.1 app this week, and one of the nice things about using it for local development is that it makes it dead simple to define specific/static connection details for your containers, thus it's super easy to configure your IDE/dev tools to connect to Postgres for instance.

With the current implementation of micronaut-test-resources, it seems I'm unable to do that since defining any of the connection details results in the container being skipped on startup. I have to instead modify the connection details on every startup within my dev tools.

@jamesdh
Copy link

jamesdh commented Jul 1, 2023

Related to #185

@melix
Copy link
Collaborator Author

melix commented Jul 7, 2023

With the current implementation of micronaut-test-resources, it seems I'm unable to do that since defining any of the connection details results in the container being skipped on startup. I have to instead modify the connection details on every startup within my dev tools.

Well yes, that's precisely the point : test resources take care of spawning the containers for you (with test containers doing the hard work), so if you want to specify explicit connections, test resources is not what you should use.

However, I understand that the underlying use case is being to be able to use your IDE to connect to the database while it's running, so you need the connection details. I created this issue which may help. Alternatively you could add a bean which logs the connection details on the console. This is obviously not as practical since the details would change on every run (because the container port changes), but it's what we have for choosing that implementation.

The docker compose test resources could be an alternative, as long as we find a way to declare which properties it can resolve, but it would also require disabling the standard JDBC test resources resolvers (or they would conflict on the same property).

At this stage it's still unclear to me how we can implement that concretely, but I'm commenting so that you have all the context.

@jamesdh
Copy link

jamesdh commented Jan 27, 2024

The control panel really isn't helpful. We can get the same information from the logs on startup. In any case, it's really tedious to have to look that up on every restart of the app.

test resources take care of spawning the containers for you (with test containers doing the hard work), so if you want to specify explicit connections, test resources is not what you should use

I would agree if test-resources was strictly only useable for running tests. But its use has expanded into general development containers and that requires some additional configurability in order to really be useful there. Even the bare minimum, like being able to define the port mapped to the container, would be incredibly helpful.

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