Reusable PostgreSQL dev service for different data sources #31655
Replies: 2 comments
-
Hi @DCCSKrezovic, I am also facing a similar kind of problem where I have two data sources I wanted to ask if you have figured out a way to do it. Thanks. |
Beta Was this translation helpful? Give feedback.
-
docker compose up -d :) I had to dig up the same answer a few months ago when I had to connect 2 quarkus apps with different db users to same db. Painful story indeed. Here are my insights (I'm not RedHat-ter) Some devservices are designed to be shared (e.g. kafka, elastic), databases are (probably for a good reason) not. Testcontainers(or quarkus devservices under the hood) are primarily a testing library, featuring disposable containers. And quarkus starts db testcontainer with some env vars that create db,user,password. Thats why, if you specify different users with quarkus.datasource.devservices.username there will be new container spawned for each service. If you want you can check out testcontainers docs, here you will find some meaningfull insights (about dockerJava command that is executed to start container): https://java.testcontainers.org/features/advanced_options My advice is: when using 1app=1db devservices are fine, otherwise go with docker-compose. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Hello!
I have defined two data sources and would like to use devservices to create a test DB for me.
I have explicitly given, for testing purposes,
where the correct options are set, i.e.
When I do
mvn quarkus:dev
ormvn clean install
, the devservices will create two containers, one for default data source, another for named data source.Is there a way to use the same devservices container for two data sources?
I require "schemaowner" datasource to specify additional set of credentials for liquibase and not run the whole app with users that have ALTER privileges. The bug report that fixes this is already available, but not the topic right now ... #31214
Beta Was this translation helpful? Give feedback.
All reactions