-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add upgrade lock file and healthcheck to the container (#63)
Co-authored-by: Wuast94 <[email protected]> Co-authored-by: Wuast94 <[email protected]>
- Loading branch information
1 parent
2649352
commit 57fa939
Showing
4 changed files
with
50 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
#!/usr/bin/env bash | ||
|
||
# Define the path to the upgrade lock file using PGDATA if set, otherwise default | ||
UPGRADE_LOCK_FILE="${PGDATA:-/var/lib/postgresql/data}/upgrade_in_progress.lock" | ||
|
||
# Check if an upgrade is in progress and keep the container alive | ||
if [ -f "$UPGRADE_LOCK_FILE" ]; then | ||
exit 0 | ||
fi | ||
|
||
pg_isready -d "${POSTGRES_DB}" -U "${POSTGRES_USER}" | ||
|
||
# Capture the exit status of pg_isready | ||
PG_ISREADY_STATUS=$? | ||
|
||
if [ $PG_ISREADY_STATUS -eq 0 ]; then | ||
exit 0 | ||
else | ||
# Exit with the status of pg_isready | ||
exit $PG_ISREADY_STATUS | ||
fi |