forked from dockersamples/example-voting-app
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
healthchecks! move to compose spec version!
- Loading branch information
1 parent
69c11f9
commit 383b741
Showing
3 changed files
with
55 additions
and
5 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
#!/bin/bash | ||
set -eo pipefail | ||
|
||
host="$(hostname -i || echo '127.0.0.1')" | ||
user="${POSTGRES_USER:-postgres}" | ||
db="${POSTGRES_DB:-$POSTGRES_USER}" | ||
export PGPASSWORD="${POSTGRES_PASSWORD:-}" | ||
|
||
args=( | ||
# force postgres to not use the local unix socket (test "external" connectibility) | ||
--host "$host" | ||
--username "$user" | ||
--dbname "$db" | ||
--quiet --no-align --tuples-only | ||
) | ||
|
||
if select="$(echo 'SELECT 1' | psql "${args[@]}")" && [ "$select" = '1' ]; then | ||
exit 0 | ||
fi | ||
|
||
exit 1 |
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,10 @@ | ||
#!/bin/sh | ||
set -eo pipefail | ||
|
||
host="$(hostname -i || echo '127.0.0.1')" | ||
|
||
if ping="$(redis-cli -h "$host" ping)" && [ "$ping" = 'PONG' ]; then | ||
exit 0 | ||
fi | ||
|
||
exit 1 |