Multiple server names in a single connection URI for pact-broker

33 views Asked by At

In the PostgreSQL documentation https://www.postgresql.org/docs/10/libpq-connect.html, it has been said that multiple hosts can be specified in a single connection URI such that all the hosts will be tried in order one after the other until one of the server gets succeeds.

I'm trying to start pactfoundation/pact-broker:2.113.0-pactbroker2.107.1 image with the following var:

PACT_BROKER_DATABASE_URL: "postgres://${user}:${pwd}@${db_host1}:5432,${db_host2}:5432/${db_name}"

And got this:

2023-12-13 12:54:02 Puma starting in single mode...
2023-12-13 12:54:02 * Puma version: 5.6.7 (ruby 3.2.1-p31) ("Birdie's Version")
2023-12-13 12:54:02 *  Min threads: 0
2023-12-13 12:54:02 *  Max threads: 5
2023-12-13 12:54:02 *  Environment: production
2023-12-13 12:54:02 *          PID: 8
2023-12-13 12:54:03 ! Unable to load application: ArgumentError: bad argument (expected URI object or URI string)
2023-12-13 12:54:03 bundler: failed to load command: puma (/pact_broker/vendor/bundle/ruby/3.2.0/bin/puma)
2023-12-13 12:54:03 /usr/local/lib/ruby/3.2.0/uri/common.rb:724:in `URI': bad argument (expected URI object or URI string) (ArgumentError)
2023-12-13 12:54:03     from /pact_broker/vendor/bundle/ruby/3.2.0/gems/pact_broker-2.107.1/lib/pact_broker/config/runtime_configuration_database_methods.rb:113:in `database_configuration_from_url'
2023-12-13 12:54:03     from /pact_broker/vendor/bundle/ruby/3.2.0/gems/pact_broker-2.107.1/lib/pact_broker/config/runtime_configuration_database_methods.rb:93:in `database_credentials'
2023-12-13 12:54:03     from /pact_broker/vendor/bundle/ruby/3.2.0/gems/pact_broker-2.107.1/lib/pact_broker/config/runtime_configuration_database_methods.rb:40:in `database_configuration'
2023-12-13 12:54:03     from /usr/local/lib/ruby/3.2.0/forwardable.rb:240:in `database_configuration'
2023-12-13 12:54:03     from /pact_broker/vendor/bundle/ruby/3.2.0/gems/pact_broker-2.107.1/lib/pact_broker/app.rb:135:in `configure_database_connection'
2023-12-13 12:54:03     from /pact_broker/vendor/bundle/ruby/3.2.0/gems/pact_broker-2.107.1/lib/pact_broker/app.rb:99:in `post_configure'
2023-12-13 12:54:03     from /pact_broker/vendor/bundle/ruby/3.2.0/gems/pact_broker-2.107.1/lib/pact_broker/app.rb:50:in `initialize'
2023-12-13 12:54:03     from config.ru:4:in `new'
2023-12-13 12:54:03     from config.ru:4:in `block in <main>'

Any ideas for solution/workaround?

URI with a single db_host works fine, but I must use external DB with two replicated instances (which is a master instance I don't know).

0

There are 0 answers