Skip to content
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

Autoconfigure fds for readiness checks in mods #995

Merged
merged 5 commits into from
Dec 28, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 15 additions & 1 deletion docker-mods.v3
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

# Version 3
# 2022-09-25 - Initial Release
MOD_SCRIPT_VER="3.20241222"
MOD_SCRIPT_VER="3.20241223"

# Define custom folder paths
SCRIPTS_DIR="/custom-cont-init.d"
Expand Down Expand Up @@ -255,6 +255,13 @@ run_mods() {
write_mod_debug "Running in debug mode"
write_mod_debug "Mod script version ${MOD_SCRIPT_VER}"
mkdir -p /modcache
# Fetch internal fds
FD_MAX=3
while IFS= read -r -d '' FD; do
if [[ $(cat "${FD}") -gt "${FD_MAX}" ]]; then
FD_MAX=$(cat "${FD}")
fi
done < <(find /etc/s6-overlay/s6-rc.d -type f -name 'notification-fd' -print0)
for DOCKER_MOD in $(echo "${DOCKER_MODS}" | tr '|' '\n'); do
# Support alternative endpoints
case "${DOCKER_MOD}" in
Expand Down Expand Up @@ -421,6 +428,13 @@ run_mods() {
if [[ -d /tmp/mod/etc/services.d ]]; then
rm -rf /tmp/mod/etc/services.d
fi
# Rationalise fds
if [[ ! -f "/tmp/mod/fd-static" ]]; then
while IFS= read -r -d '' FD; do
(( FD_MAX++ ))
echo $FD_MAX > "${FD}"
done < <(find /tmp/mod/etc/s6-overlay/s6-rc.d -type f -name 'notification-fd' -print0)
fi
shopt -s dotglob
cp -R /tmp/mod/* /
shopt -u dotglob
Expand Down