8000 chore: fly fixes; PITR + logging + shutdown + perms by pcnc · Pull Request #665 · supabase/postgres · GitHub
[go: up one dir, main page]

Skip to content

chore: fly fixes; PITR + logging + shutdown + perms #665

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

Merged
merged 7 commits into from
Jun 13, 2023
Merged

Conversation

pcnc
Copy link
Member
@pcnc pcnc commented Jun 13, 2023

What kind of change does this PR introduce?

Bug fix, feature, docs update, ...

What is the current behavior?

Please link any relevant issues here.

What is the new behavior?

Feel free to include screenshots if it includes visual changes.

Additional context

Add any other context or screenshots.

@pcnc pcnc requested a review from a team as a code owner June 13, 2023 13:31
@pcnc pcnc force-pushed the pcnc/fly-fixes branch from 2f6a4c4 to 938c1ea Compare June 13, 2023 13:32
@pcnc pcnc force-pushed the pcnc/fly-fixes branch from 938c1ea to 28c7cf5 Compare June 13, 2023 13:33
@@ -230,4 +230,6 @@ HEALTHCHECK --interval=3s --timeout=2s --start-period=4s --retries=10 CMD [ "hea

COPY docker/all-in-one/init /init
COPY docker/all-in-one/entrypoint.sh /usr/local/bin/
COPY docker/all-in-one/postgres-entrypoint.sh /usr/local/bin/
COPY docker/all-in-one/shutdown.sh /usr/local/bin/supa-shutdown
Copy link
Contributor

Choose a reason for hiding this comment

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

any reason not to preserve the .sh ext?

Copy link
Member Author

Choose a reason for hiding this comment

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

no reason - will add extension

@@ -0,0 +1,60 @@
#!/bin/sh

Copy link
Contributor

Choose a reason for hiding this comment

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

Let's give a brief overview of what the script does


supervisorctl stop postgresql

# Postgres ships the latest WAL file using archive_commAND during shutdown, in a blocking operation
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
# Postgres ships the latest WAL file using archive_commAND during shutdown, in a blocking operation
# Postgres ships the latest WAL file using archive_command during shutdown, in a blocking operation

@@ -31,3 +31,5 @@ log_rotation_size = 0 # Automatic rotation of logfiles will
# or size-driven rotation. Default is
# off, meaning append to existing files
# in all cases.

log_disconnections = on # log end of a session, including duration
Copy link
Contributor

Choose a reason for hiding this comment

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

intentional?

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes.
This param is disabled by default and can't track disconnections any other way since the connections are terminated and thus not available in pg_stat_activity.
This allows the shutdown script to track when the last disconnection happened and shutdown the machine after X minutes.

Postgres output related to disconnections is filtered out by Vector, so it won't additionally be shipped to Logflare.

This approach diverges the configs, thus we could have the shutdown script run an ALTER SYSTEM at startup to set log_disconnections to on, since it's a shutdown script dependency after all.


if [ "${INIT_PAYLOAD_PRESIGNED_URL:-}" ]; then
curl -sSL "$INIT_PAYLOAD_PRESIGNED_URL" -o "$INIT_PAYLOAD_PATH"
curl -sSL "$INIT_PAYLOAD_PRESIGNED_URL" -o "/tmp/payload.tar.gz"
Copy link
Contributor

Choose a reason for hiding this comment

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

-f as well?

if [ "${DATA_VOLUME_MOUNTPOINT}" ]; then
LOGS_FOLDER="${DATA_VOLUME_MOUNTPOINT}/logs"

mkdir -p "${LOGS_FOLDER}/postgresql"
Copy link
Contributor

Choose a reason for hiding this comment

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

could be a loop over postgresql, services, wal-g, but this is fine too

Copy link
Member Author

Choose a reason for hiding this comment

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

fair point - refactored into a loop

@pcnc pcnc merged commit 932d7cc into develop Jun 13, 2023
@pcnc pcnc deleted the pcnc/fly-fixes branch June 13, 2023 16:11
damonrand pushed a commit to cepro/postgres that referenced thi 75C4 s pull request Jun 15, 2025
* chore: remove folder creation

* trigger build

* trigger build

* chore: reorder symlinks

* chore: fly fixes; PITR + logging + shutdown + perms

* chore: rename shutdown script; refactoring
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

Successfully merging this pull request may close these issues.

2 participants
0