Skip to content

Commit

Permalink
Add logic to clear dangling sockets in docker entrypoint
Browse files Browse the repository at this point in the history
  • Loading branch information
brentos committed Nov 30, 2023
1 parent 57d61d4 commit 8a5a1ba
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions build/dockerfiles/entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,20 @@ if [[ "$1" == "kong" ]]; then
if [[ "$2" == "docker-start" ]]; then
kong prepare -p "$PREFIX" "$@"

# remove all dangling sockets in $PREFIX dir before starting Kong
LOGGED_SOCKET_WARNING=0
for localfile in $(find /var/run/kong -type s); do
if (( LOGGED_SOCKET_WARNING == 0 )); then
printf >&2 'WARN: found dangling unix sockets in the runtime directory '
printf >&2 '(%q) ' "/var/run/kong"
printf >&2 'while preparing to start Kong. This may be a sign that Kong '
printf >&2 'was previously shut down uncleanly or is in an unknown state '
printf >&2 'and could require further investigation.\n'
LOGGED_SOCKET_WARNING=1
fi
rm -f "$localfile"
done

ln -sfn /dev/stdout $PREFIX/logs/access.log
ln -sfn /dev/stdout $PREFIX/logs/admin_access.log
ln -sfn /dev/stderr $PREFIX/logs/error.log
Expand Down

0 comments on commit 8a5a1ba

Please sign in to comment.