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

Facing a problem establishing a connection with Postgres from k8s #182

Closed
4 tasks done
xxxsemyonxxx opened this issue Apr 25, 2024 · 1 comment
Closed
4 tasks done

Comments

@xxxsemyonxxx
Copy link

xxxsemyonxxx commented Apr 25, 2024

Pre issue-raising checklist

I have already (please mark the applicable with an x):

  • Confirmed this is the right place to raise the issue - only issues related to the Dockerization of the Pact Broker should be raised here. Issues related to the Pact Broker application itself should be raised in the Pact Broker project.
  • Upgraded to the latest Pact Broker Docker image OR
  • Checked the [CHANGELOG] (/CHANGELOG.md) to see if the issue I am about to raise has been fixed
  • Read the Troubleshooting page

Software versions

  • pact-broker gem version: eg 2.3.1
  • pact-broker docker version: eg 2.3.1-1
  • OS: e.g. Mac OSX 10.11.5
  • pact broker client details: eg. pact-ruby-standalone CLI v 1.23.0

Expected behaviour

Works locally in Docker as expected. When deployed, should act simillarly

Actual behaviour

Fails to start pact-broker app instance due the following error in k8s:

/pact_broker/vendor/bundle/ruby/3.2.0/gems/pg-1.5.5/lib/pg/connection.rb:696:in async_connect_or_reset': PG::ConnectionBad: connection to server at "10.168.3.100", port 5432 failed: server closed the connection unexpectedly (Sequel::DatabaseConnectionError)`

Steps to reproduce

Provide a repository, gist or reproducable code snippet so that we can test the problem.

`FROM pactfoundation/pact-broker:latest

ENV PACT_BROKER_PORT_ENVIRONMENT_VARIABLE_NAME=PACT_BROKER_APPLICATION_PORT
ENV PACT_BROKER_PORT=9292
ENV PACT_BROKER_DATABASE_ADAPTER="postgres"
ENV PACT_BROKER_LOG_LEVEL="DEBUG"
ENV PACT_BROKER_SQL_LOG_LEVEL="DEBUG"
ENV PACT_BROKER_DATABASE_USERNAME="pact_broker"
ENV PACT_BROKER_DATABASE_PASSWORD="xxxxxxxxxxx"
ENV PACT_BROKER_DATABASE_HOST="pact-broker.xxxxxxxxxxxx.us-east-1.rds.amazonaws.com"
ENV PACT_BROKER_DATABASE_NAME="pact_broker"
ENV PACT_BROKER_PUBLIC_HEARTBEAT=true`

Relevent log files

/pact_broker/vendor/bundle/ruby/3.2.0/gems/pg-1.5.5/lib/pg/connection.rb:696:in async_connect_or_reset': PG::ConnectionBad: connection to server at "10.168.3.100", port 5432 failed: server closed the connection unexpectedly (Sequel::DatabaseConnectionError)

from /pact_broker/vendor/bundle/ruby/3.2.0/gems/pg-1.5.5/lib/pg/connection.rb:824:in `connect_to_hosts'

.......

2024-04-25 20:56:33.389634 I [7:3280] pact-broker -- Connecting to database: -- {:adapter=>"postgres", :user=>"pact_broker", :password=>"*****", :host=>"pact-broker.xxxxxxx.us-east-1.rds.amazonaws.com", :database=>"pact_broker", :encoding=>"utf8", :sql_log_level=>:debug, :enable_caller_logging=>false, :log_warn_duration=>5.0, :pool_timeout=>5, :driver_options=>{:options=>"-c statement_timeout=15s"}, :connect_max_retries=>0}

`

Please ensure you set logging to DEBUG and attach any relevant log files here (or link from a gist).

@xxxsemyonxxx xxxsemyonxxx changed the title Facing a problem establishing a connection from k8s Facing a problem establishing a connection with Postgres from k8s Apr 25, 2024
@YOU54F
Copy link
Member

YOU54F commented Sep 27, 2024

Many people have have successful deployments on k8s, we provide an example in this repository and helm charts are held here https://github.com/pact-foundation/pact-broker-chart

I would imagine this to be a network configuration issue, where your database is not accessible to the network your pact broker application is running on. This is out of scope for support I am afraid!

@YOU54F YOU54F closed this as completed Sep 27, 2024
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