Each time my Quarkus app restarts it has a different Postgres port. There is testcontainers.reuse.enable=false in the ~/.testcontainers.properties. MacOS, run from Idea.
1 Answer
Setting
quarkus.datasource.devservices.port=5432
in your application.properties should do the trick. Obviously, setting a fixed port creates the risk of port conflicts. What is it you need the fixed port for? The Dev UI should give you some access to the database admin, and CDI injection should allow your code to access a client without needing to hardcode in a port.
3 Comments
Dmitry
just to connect IDE to pg at dev stage, not in production
Holly Cummins
Ah, if you want to use the IDE to connect to it, rather than the Quarkus dev UI, that would be easier with a fixed port. If there's things you can do through an IDE that you can't do through the dev UI, it's worth raising a Quarkus feature request.
Dmitry
I am new to Quarkus, maybe there is a way to open Postgres console or look through a database structure. And I used to DBeaver or Idea internal db tool… So fixed pg port would be useful on my opinion. In my current configuration (according to the advice above) I use port 54320.