Skip to content

Conversation

@frederikspang
Copy link
Contributor

Add an optional-modification for pgbouncer. This has been extracted from our internal setup after discussion on #self-hosted in Discord.

Regarding pgbouncer, see also #2740

Legal Boilerplate

Look, I get it. The entity doing business as "Sentry" was incorporated in the State of Delaware in 2015 as Functional Software, Inc. and is gonna need some rights from me in order to utilize my contributions in this here PR. So here's the deal: I retain all rights, title and interest in and to my contributions, and by keeping this boilerplate intact I confirm that Sentry can use, modify, copy, and redistribute my contributions, under Sentry's choice of terms.

@BYK
Copy link
Member

BYK commented Aug 18, 2025

@aldy505 shall we make this part of the default setup?

@lucas-zimerman
Copy link

I think it would be great if it was, tracing UI is leaving a lot of idle connections, breaking sentry due to maximum connections reached, pgcat should help with that.

@frederikspang
Copy link
Contributor Author

@BYK If so, are there any preferences for a pgcat config file? Just a new folder+file /pgcat/config.toml and mount into container? (To follow same procedure as - "./geoip:/geoip:ro" etc

@aldy505
Copy link
Collaborator

aldy505 commented Aug 19, 2025

I'm really torn between making this default vs not.

@saibotk
Copy link

saibotk commented Aug 19, 2025

Additional insight: Our setup also now regularly reaches the connection limit and that freezes Sentry entirely.
Are there any downsides to have this as a default?

@frederikspang
Copy link
Contributor Author

The reason we added this to our setup, was the same. We saw a large amount of idle connections and errors - even with low traffic in ingress and a single user doing Internal demo of trace views, and issues views.

@aldy505
Copy link
Collaborator

aldy505 commented Aug 19, 2025

Alright. Lets make it as default.

@aldy505
Copy link
Collaborator

aldy505 commented Aug 19, 2025

@BYK If so, are there any preferences for a pgcat config file? Just a new folder+file /pgcat/config.toml and mount into container? (To follow same procedure as - "./geoip:/geoip:ro" etc

/pgcat.toml is fine, no need for a directory. Just like the redis.conf and nginx.conf.

@frederikspang
Copy link
Contributor Author

Got it. Will push update later

@frederikspang
Copy link
Contributor Author

I am out of RAM on my laptop for a test-run, which is unfortunate.

@aldy505 Does the integration tests boot a new installed environment, or should I just boot a VM at work, to test out from scratch-installation?

@aldy505
Copy link
Collaborator

aldy505 commented Aug 19, 2025

@aldy505 Does the integration tests boot a new installed environment

Yep, they do

@frederikspang
Copy link
Contributor Author

@aldy505 Can you approve workflow runs, so I can do a quick look using those, before spinning up a VM? (I'm gonna do both, either way)

@BYK
Copy link
Member

BYK commented Aug 19, 2025

@frederikspang looks like it's broken:

 time="2025-08-19T20:54:51Z" level=warning msg="The \"PGCAT_IMAGE\" variable is not set. Defaulting to a blank string."

Copy link
Collaborator

@aldy505 aldy505 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It'd be great if you can add healthcheck to pgcat container. See postgresml/pgcat#607

@aldy505
Copy link
Collaborator

aldy505 commented Aug 20, 2025

Anyway I'll just...

@aldy505
Copy link
Collaborator

aldy505 commented Aug 20, 2025

'exc': 'OperationalError(\'could not translate host name "pgcat" to address: Temporary failure in name resolution\\n\')

@frederikspang
Copy link
Contributor Author

frederikspang commented Aug 20, 2025

@aldy505 Wanna go for the healthcheck command in the linked PR?
PGPASSWORD="<some-password>" psql -U pgcat -p 6432 -h 127.0.0.1 -tA -c "show version;" -d pgcat >/dev/null

Or just for pg_isready like the postgres container?

@aldy505
Copy link
Collaborator

aldy505 commented Aug 20, 2025

@aldy505 Wanan go for the healthcheck command in the linked PR? PGPASSWORD="<some-password>" psql -U pgcat -p 6432 -h 127.0.0.1 -tA -c "show version;" -d pgcat >/dev/null

Or just for pg_isready like the postgres container?

Up to you. What we need is to move other containers to depends on pgcat rather than postgres.

@frederikspang
Copy link
Contributor Author

they depend on both right now, in the x-sentry-defaults; We can remove postgres, no problem.

@aldy505
Copy link
Collaborator

aldy505 commented Aug 20, 2025

they depend on both right now, in the x-sentry-defaults; We can remove postgres, no problem.

Yep yep, let's make sure pgcat is healthy first before any other container starts.

@frederikspang frederikspang changed the title Add patch for pgbouncer Add pgcat Aug 20, 2025
@frederikspang
Copy link
Contributor Author

@BYK Can you approve workflow run? :)

@aldy505
Copy link
Collaborator

aldy505 commented Aug 20, 2025

done

Copy link
Collaborator

@aldy505 aldy505 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nice

@aminvakil
Copy link
Collaborator

On a side note, I really didn't like #2740 then :)

Let's revert that after merging this and changing sentry.conf.py, users which have changed it in .env.custom will be unaffected.

@aldy505 aldy505 removed the request for review from hubertdeng123 August 22, 2025 13:45
@aldy505
Copy link
Collaborator

aldy505 commented Aug 22, 2025

I want to merge this first, then (in concurrent manner):

  1. Create a PR that change user's sentry.conf.py file
  2. Revert the PR that Amin mentioned.

aldy505 added a commit that referenced this pull request Aug 23, 2025
This PR may only be merged after #3884 has been merged
@aldy505
Copy link
Collaborator

aldy505 commented Aug 23, 2025

Install script is here: #3898

@aminvakil can you create the revert PR, so I can quickly approve & merge?

@aminvakil
Copy link
Collaborator

Install script is here: #3898

@aminvakil can you create the revert PR, so I can quickly approve & merge?

Done in #3899 .

@aldy505
Copy link
Collaborator

aldy505 commented Aug 23, 2025

Cool. Let me merge this one.

@aldy505 aldy505 merged commit 2862432 into getsentry:master Aug 23, 2025
15 of 17 checks passed
@frederikspang frederikspang deleted the feature/pgbouncer branch August 26, 2025 08:01
xprotocol-bot added a commit to xprotocol-org/self-hosted that referenced this pull request Sep 6, 2025
@github-actions github-actions bot locked and limited conversation to collaborators Sep 11, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

6 participants