Skip to content

Conversation

@aldy505
Copy link
Collaborator

@aldy505 aldy505 commented Aug 23, 2025

This PR may only be merged after #3884 has been merged

This PR may only be merged after #3884 has been merged
@aldy505 aldy505 mentioned this pull request Aug 23, 2025
Comment on lines 1 to 2
# Guard this file behind SETUP_PGBOUNCER_MIGRATION
if [ "$SETUP_PGBOUNCER_MIGRATION" == "1" ]; then
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I will need to remove this flag after #3884 is merged.

@aldy505 aldy505 requested review from BYK and aminvakil August 23, 2025 12:23
@aldy505
Copy link
Collaborator Author

aldy505 commented Aug 23, 2025

Test results are ok:

Test 1 (pre 25.9.0 release)
Migrating Postgres config to PGBouncer...
  Migrating sentry/sentry.conf.py to use PGBouncer
  Migrated sentry/sentry.conf.py to use PGBouncer
DATABASES section is correct
Test 2 (post 25.9.0 release)
Migrating Postgres config to PGBouncer...
  Found pgbouncer in sentry/sentry.conf.py, I'm assuming you're good! :)
DATABASES section is correct
Test 3 (custom postgres config)
Migrating Postgres config to PGBouncer...
  ⚠️ You don't have standard configuration for Postgres in sentry/sentry.conf.py, skipping pgbouncer migration. I'm assuming you know what you're doing.
DATABASES section is correct
migrate-pgbouncer-test.sh - Success 👍

@codecov
Copy link

codecov bot commented Aug 23, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 99.49%. Comparing base (ce45294) to head (cc7defb).
⚠️ Report is 1 commits behind head on master.
✅ All tests successful. No failed tests found.

Additional details and impacted files
@@           Coverage Diff           @@
##           master    #3898   +/-   ##
=======================================
  Coverage   99.49%   99.49%           
=======================================
  Files           3        3           
  Lines         197      197           
=======================================
  Hits          196      196           
  Misses          1        1           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@aldy505 aldy505 enabled auto-merge (squash) August 23, 2025 13:23
@frederikspang
Copy link
Contributor

@aldy505 LGTM

@aldy505 aldy505 disabled auto-merge September 2, 2025 12:18
@aldy505
Copy link
Collaborator Author

aldy505 commented Sep 5, 2025

ping @BYK

Copy link
Member

@BYK BYK left a comment

Choose a reason for hiding this comment

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

Looks good, just rejecting for my concerns around unattended install as it looks like this may not work with non-interactive TTYs. Not sure how CI passed (or what I missed)

# }
# ```

if sed -n '/^DATABASES = {$/,/^}$/p' "$SENTRY_CONFIG_PY" | grep -q '"HOST": "postgres"'; then
Copy link
Member

Choose a reason for hiding this comment

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

I think we should either check SKIP_USER_CREATION, SKIP_USER_PROMPT env vars, check for an interactive TTY and/or add a SENTRY_NON_INTERACTIVE_INSTALL option to skip all prompts in a sane way.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I've re-read the codebase, practically the existing SKIP_USER_PROMPT is SENTRY_NON_INTERACTIVE_INSTALL. I'll just add that.

@aldy505 aldy505 requested a review from BYK September 9, 2025 13:57
if [ ! -z "${SKIP_USER_PROMPT:-}" ]; then
depwarn "SKIP_USER_PROMPT variable" "SKIP_USER_CREATION"
SKIP_USER_CREATION="${SKIP_USER_PROMPT}"
APPLY_AUTOMATIC_CONFIG_UPDATES="${SKIP_USER_PROMPT}"
Copy link
Member

Choose a reason for hiding this comment

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

Slightly nervous about this.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Why

Copy link
Member

Choose a reason for hiding this comment

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

Because we will be trying the auto migration/config update without asking about it. Ideally this would be no action on non-interactive installs that said since you try to ensure it is unchanged, I'm fine. Just a little bit nervous in case we missed something.

read -p "y or n? " yn
case $yn in
y | yes | 1)
export apply_config_changes_pgbouncer=1
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

FYI @BYK I made a change for this one, to not let it populate the global APPLY_AUTOMATIC_CONFIG_UPDATES. Hopefully this is the right approach.

Copy link
Member

Choose a reason for hiding this comment

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

Looks good to me. Not sure if you should be exporting it tho.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I'm not sure about it either. Took the safest way about it.

@aldy505 aldy505 merged commit 2e7a3ff into master Sep 12, 2025
16 checks passed
@aldy505 aldy505 deleted the aldy505/feat/sentry-config-pgbouncer branch September 12, 2025 14:03
xprotocol-bot added a commit to xprotocol-org/self-hosted that referenced this pull request Sep 18, 2025
xprotocol-bot added a commit to xprotocol-org/self-hosted that referenced this pull request Sep 24, 2025
@github-actions github-actions bot locked and limited conversation to collaborators Sep 28, 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