-
-
Notifications
You must be signed in to change notification settings - Fork 187
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
Conversation
docker/all-in-one/Dockerfile
Outdated
@@ -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 |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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 | |||
|
There was a problem hiding this comment.
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
docker/all-in-one/shutdown.sh
Outdated
|
||
supervisorctl stop postgresql | ||
|
||
# Postgres ships the latest WAL file using archive_commAND during shutdown, in a blocking operation |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
# 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 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
intentional?
There was a problem hiding this comment.
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.
docker/all-in-one/entrypoint.sh
Outdated
|
||
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" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
-f
as well?
docker/all-in-one/entrypoint.sh
Outdated
if [ "${DATA_VOLUME_MOUNTPOINT}" ]; then | ||
LOGS_FOLDER="${DATA_VOLUME_MOUNTPOINT}/logs" | ||
|
||
mkdir -p "${LOGS_FOLDER}/postgresql" |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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
* chore: remove folder creation * trigger build * trigger build * chore: reorder symlinks * chore: fly fixes; PITR + logging + shutdown + perms * chore: rename shutdown script; refactoring
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.