mirror of
https://github.com/TrezOne/docker-mods-uptime-kuma-timeout-fix.git
synced 2026-07-13 07:01:23 -04:00
Merge pull request #503 from linuxserver/swag-auto-reload-standard-base
Adjust for compatibility with standard-base
This commit is contained in:
@@ -1,15 +1,6 @@
|
|||||||
# Auto-reload - Docker mod for Nginx based images
|
# Auto-reload - Docker mod for Nginx based images
|
||||||
|
|
||||||
This mod allows Nginx to be reloaded automatically whenever there are valid changes to the following files and folders:
|
This mod allows Nginx to be reloaded automatically whenever there are new files, or valid changes to the files in `/config/nginx`.
|
||||||
- /config/nginx/authelia-location.conf
|
|
||||||
- /config/nginx/authelia-server.conf
|
|
||||||
- /config/nginx/geoip2.conf
|
|
||||||
- /config/nginx/ldap.conf
|
|
||||||
- /config/nginx/nginx.conf
|
|
||||||
- /config/nginx/proxy-confs
|
|
||||||
- /config/nginx/proxy.conf
|
|
||||||
- /config/nginx/site-confs
|
|
||||||
- /config/nginx/ssl.conf
|
|
||||||
|
|
||||||
In the container's docker arguments, set an environment variable `DOCKER_MODS=linuxserver/mods:swag-auto-reload`
|
In the container's docker arguments, set an environment variable `DOCKER_MODS=linuxserver/mods:swag-auto-reload`
|
||||||
|
|
||||||
|
|||||||
@@ -1,45 +1,32 @@
|
|||||||
#!/usr/bin/with-contenv bash
|
#!/usr/bin/with-contenv bash
|
||||||
|
# shellcheck shell=bash
|
||||||
|
|
||||||
DEFAULT_WATCH=( \
|
echo "MOD Auto-reload: Watching the following files/folders for changes (excluding .sample and .md files):"
|
||||||
/config/nginx/authelia-location.conf \
|
echo "/config/nginx"
|
||||||
/config/nginx/authelia-server.conf \
|
ACTIVE_WATCH=("/config/nginx")
|
||||||
/config/nginx/geoip2.conf \
|
for i in $(echo "${WATCHLIST}" | tr "|" " "); do
|
||||||
/config/nginx/ldap.conf \
|
|
||||||
/config/nginx/nginx.conf \
|
|
||||||
/config/nginx/proxy-confs \
|
|
||||||
/config/nginx/proxy.conf \
|
|
||||||
/config/nginx/site-confs \
|
|
||||||
/config/nginx/ssl.conf \
|
|
||||||
)
|
|
||||||
|
|
||||||
echo "MOD Auto-reload: Watching the following files/folders for changes"
|
|
||||||
for i in ${DEFAULT_WATCH[@]}; do
|
|
||||||
if [ -f "${i}" ] || [ -d "${i}" ]; then
|
if [ -f "${i}" ] || [ -d "${i}" ]; then
|
||||||
echo "${i}"
|
echo "${i}"
|
||||||
ACTIVE_WATCH="${ACTIVE_WATCH} ${i}"
|
ACTIVE_WATCH+=("${i}")
|
||||||
fi
|
|
||||||
done
|
|
||||||
for i in $(echo "$WATCHLIST" | tr "|" " "); do
|
|
||||||
if [ -f "${i}" ] || [ -d "${i}" ]; then
|
|
||||||
echo "${i}"
|
|
||||||
ACTIVE_WATCH="${ACTIVE_WATCH} ${i}"
|
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
function wait_for_changes {
|
function wait_for_changes {
|
||||||
inotifywait -rq \
|
inotifywait -rq \
|
||||||
--event modify,move,create,delete \
|
--event modify,move,create,delete \
|
||||||
${ACTIVE_WATCH}
|
--excludei '\.(sample|md)' \
|
||||||
|
"${ACTIVE_WATCH[@]}"
|
||||||
}
|
}
|
||||||
|
|
||||||
while wait_for_changes; do
|
while wait_for_changes; do
|
||||||
if ! cat /etc/nginx/nginx.conf | grep "/config/nginx/nginx.conf"; then
|
NGINX_CONF=()
|
||||||
export NGINX_CONF="-c /config/nginx/nginx.conf"
|
if ! grep -q "/config/nginx/nginx.conf" /etc/nginx/nginx.conf; then
|
||||||
|
NGINX_CONF=("-c" "/config/nginx/nginx.conf")
|
||||||
fi
|
fi
|
||||||
if /usr/sbin/nginx ${NGINX_CONF} -t; then
|
if /usr/sbin/nginx "${NGINX_CONF[@]}" -t; then
|
||||||
echo "Changes to nginx config detected and the changes are valid, reloading nginx"
|
echo "Changes to nginx config detected and the changes are valid, reloading nginx"
|
||||||
/usr/sbin/nginx ${NGINX_CONF} -s reload
|
/usr/sbin/nginx "${NGINX_CONF[@]}" -s reload
|
||||||
else
|
else
|
||||||
echo "Changes to nginx config detected but the changes are not valid, skipping nginx reload. Please fix your config."
|
echo "Changes to nginx config detected but the changes are not valid, skipping nginx reload. Please fix your config."
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|||||||
@@ -1,42 +1,32 @@
|
|||||||
#!/usr/bin/with-contenv bash
|
#!/usr/bin/with-contenv bash
|
||||||
|
# shellcheck shell=bash
|
||||||
|
|
||||||
DEFAULT_WATCH=( \
|
echo "MOD Auto-reload: Watching the following files/folders for changes (excluding .sample and .md files):"
|
||||||
/config/nginx/authelia-location.conf \
|
echo "/config/nginx"
|
||||||
/config/nginx/authelia-server.conf \
|
ACTIVE_WATCH=("/config/nginx")
|
||||||
/config/nginx/geoip2.conf \
|
for i in $(echo "${WATCHLIST}" | tr "|" " "); do
|
||||||
/config/nginx/ldap.conf \
|
|
||||||
/config/nginx/nginx.conf \
|
|
||||||
/config/nginx/proxy-confs \
|
|
||||||
/config/nginx/proxy.conf \
|
|
||||||
/config/nginx/site-confs \
|
|
||||||
/config/nginx/ssl.conf \
|
|
||||||
)
|
|
||||||
|
|
||||||
echo "MOD Auto-reload: Watching the following files/folders for changes"
|
|
||||||
for i in ${DEFAULT_WATCH[@]}; do
|
|
||||||
if [ -f "${i}" ] || [ -d "${i}" ]; then
|
if [ -f "${i}" ] || [ -d "${i}" ]; then
|
||||||
echo "${i}"
|
echo "${i}"
|
||||||
ACTIVE_WATCH="${ACTIVE_WATCH} ${i}"
|
ACTIVE_WATCH+=("${i}")
|
||||||
fi
|
|
||||||
done
|
|
||||||
for i in $(echo "$WATCHLIST" | tr "|" " "); do
|
|
||||||
if [ -f "${i}" ] || [ -d "${i}" ]; then
|
|
||||||
echo "${i}"
|
|
||||||
ACTIVE_WATCH="${ACTIVE_WATCH} ${i}"
|
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
function wait_for_changes {
|
function wait_for_changes {
|
||||||
inotifywait -rq \
|
inotifywait -rq \
|
||||||
--event modify,move,create,delete \
|
--event modify,move,create,delete \
|
||||||
${ACTIVE_WATCH}
|
--excludei '\.(sample|md)' \
|
||||||
|
"${ACTIVE_WATCH[@]}"
|
||||||
}
|
}
|
||||||
|
|
||||||
while wait_for_changes; do
|
while wait_for_changes; do
|
||||||
if /usr/sbin/nginx -c /config/nginx/nginx.conf -t; then
|
NGINX_CONF=()
|
||||||
|
if ! grep -q "/config/nginx/nginx.conf" /etc/nginx/nginx.conf; then
|
||||||
|
NGINX_CONF=("-c" "/config/nginx/nginx.conf")
|
||||||
|
fi
|
||||||
|
if /usr/sbin/nginx "${NGINX_CONF[@]}" -t; then
|
||||||
echo "Changes to nginx config detected and the changes are valid, reloading nginx"
|
echo "Changes to nginx config detected and the changes are valid, reloading nginx"
|
||||||
/usr/sbin/nginx -c /config/nginx/nginx.conf -s reload
|
/usr/sbin/nginx "${NGINX_CONF[@]}" -s reload
|
||||||
else
|
else
|
||||||
echo "Changes to nginx config detected but the changes are not valid, skipping nginx reload. Please fix your config."
|
echo "Changes to nginx config detected but the changes are not valid, skipping nginx reload. Please fix your config."
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|||||||
Reference in New Issue
Block a user