update
This commit is contained in:
@@ -1,6 +1,6 @@
|
|||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
VERS='4.7.130-06212023'
|
VERS='4.7.131-06212023'
|
||||||
|
|
||||||
# NODETYPES=WEB
|
# NODETYPES=WEB
|
||||||
NODETYPES=LB,LPD,MM,MYSQL,NC,PW,WPD,WM,WEB
|
NODETYPES=LB,LPD,MM,MYSQL,NC,PW,WPD,WM,WEB
|
||||||
@@ -36,6 +36,9 @@ WMDOCKER=uptime-kuma
|
|||||||
PWDOCKER=uptime-kuma
|
PWDOCKER=uptime-kuma
|
||||||
#LBDOCKER=nginx-proxy_manager
|
#LBDOCKER=nginx-proxy_manager
|
||||||
|
|
||||||
|
SINGLESERVICES=gitea
|
||||||
|
SINGLEDOCKERS=vaultwarden,heimdall,authelia
|
||||||
|
|
||||||
LB_NGINX_SITES='/opt/lb-data/nginx/sites-enabled'
|
LB_NGINX_SITES='/opt/lb-data/nginx/sites-enabled'
|
||||||
WEB_NGINX_SITES='/mnt/web-data/nginx/sites-enabled'
|
WEB_NGINX_SITES='/mnt/web-data/nginx/sites-enabled'
|
||||||
|
|
||||||
@@ -120,6 +123,9 @@ LB_DOCKER=(${LBDOCKER})
|
|||||||
WM_DOCKER=(${WMDOCKER})
|
WM_DOCKER=(${WMDOCKER})
|
||||||
PW_DOCKER=(${PWDOCKER})
|
PW_DOCKER=(${PWDOCKER})
|
||||||
|
|
||||||
|
SINGLE_SERVICES=(${SINGLESERVICES})
|
||||||
|
SINGLE_DOCKERS=(${SINGLEDOCKERS})
|
||||||
|
|
||||||
unset IFS
|
unset IFS
|
||||||
|
|
||||||
declare -A NM_NODETYPES
|
declare -A NM_NODETYPES
|
||||||
|
|||||||
@@ -729,9 +729,6 @@ HAPROXY-CONFIG() {
|
|||||||
SINGLE_SERVER_SERVICE_CHECK(){
|
SINGLE_SERVER_SERVICE_CHECK(){
|
||||||
if [ "${1}" = "web" ]; then
|
if [ "${1}" = "web" ]; then
|
||||||
# servicestocheck=gitea,pdnsadmin
|
# servicestocheck=gitea,pdnsadmin
|
||||||
servicestocheck=gitea
|
|
||||||
dockerstocheck=( heimdall vaultwarden authelia )
|
|
||||||
IFS=,; services_to_check=(${servicestocheck}); unset IFS
|
|
||||||
|
|
||||||
local_ips=$(ip addr show $(ip route | awk '/default/ { print $5 }') | grep "inet" | awk '/inet/ {print $2}' | cut -d'/' -f1);
|
local_ips=$(ip addr show $(ip route | awk '/default/ { print $5 }') | grep "inet" | awk '/inet/ {print $2}' | cut -d'/' -f1);
|
||||||
# local_ips=$(ip addr show $(ip route | awk '/default/ { print $5 }') | grep "inet" | head -n 1 | awk '/inet/ {print $2}' | cut -d'/' -f1);
|
# local_ips=$(ip addr show $(ip route | awk '/default/ { print $5 }') | grep "inet" | head -n 1 | awk '/inet/ {print $2}' | cut -d'/' -f1);
|
||||||
@@ -742,7 +739,8 @@ SINGLE_SERVER_SERVICE_CHECK(){
|
|||||||
sleep 5s
|
sleep 5s
|
||||||
fi
|
fi
|
||||||
if [ -f /mnt/web-data/mounted ]; then
|
if [ -f /mnt/web-data/mounted ]; then
|
||||||
for stc in "${services_to_check[@]}"; do
|
for stc in "${SINGLE_SERVICES[@]}"; do
|
||||||
|
echo "SERVICE: $stc"
|
||||||
if [ "$(systemctl is-active ${stc}.service)" != "active" ]; then
|
if [ "$(systemctl is-active ${stc}.service)" != "active" ]; then
|
||||||
SENDNOTICE "Node-Balancing Notice" "Starting ${stc} on ${NM_NODETYPES["WEB"]}-Node${local_ip: -1} (${local_ip}), stopping on the other Nodes"
|
SENDNOTICE "Node-Balancing Notice" "Starting ${stc} on ${NM_NODETYPES["WEB"]}-Node${local_ip: -1} (${local_ip}), stopping on the other Nodes"
|
||||||
echo "$(date) - ${NM_NODETYPES["WEB"]}-Node${local_ip: -1} - Starting ${stc} on ${local_ip}, stopping on the other Nodes" >> ${LOGFILE}
|
echo "$(date) - ${NM_NODETYPES["WEB"]}-Node${local_ip: -1} - Starting ${stc} on ${local_ip}, stopping on the other Nodes" >> ${LOGFILE}
|
||||||
@@ -757,8 +755,8 @@ SINGLE_SERVER_SERVICE_CHECK(){
|
|||||||
/bin/systemctl start ${stc} &
|
/bin/systemctl start ${stc} &
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
for docker in "${dockerstocheck[@]}"; do
|
for docker in "${SINGLE_DOCKERS[@]}"; do
|
||||||
# echo "DOCKER: $docker"
|
echo "DOCKER: $docker"
|
||||||
for nip in "${WEB_HOSTS[@]}"; do
|
for nip in "${WEB_HOSTS[@]}"; do
|
||||||
if [[ "${local_ip}" = *"${nip}"* ]]; then
|
if [[ "${local_ip}" = *"${nip}"* ]]; then
|
||||||
[ ! "$(/usr/bin/docker ps -q -f name=${docker})" ] && /usr/bin/docker start ${docker} & >/dev/null 2>&1
|
[ ! "$(/usr/bin/docker ps -q -f name=${docker})" ] && /usr/bin/docker start ${docker} & >/dev/null 2>&1
|
||||||
@@ -779,7 +777,7 @@ SINGLE_SERVER_SERVICE_CHECK(){
|
|||||||
[ "${stc}" = "pdnsadmin" ] && stc="pdnsadmin.socket pdnsadmin.service"
|
[ "${stc}" = "pdnsadmin" ] && stc="pdnsadmin.socket pdnsadmin.service"
|
||||||
/bin/systemctl stop ${stc} &
|
/bin/systemctl stop ${stc} &
|
||||||
done
|
done
|
||||||
for docker in "${dockerstocheck[@]}"; do
|
for docker in "${SINGLE_DOCKERS[@]}"; do
|
||||||
# echo "DOCKER: $docker"
|
# echo "DOCKER: $docker"
|
||||||
[ "$(/usr/bin/docker ps -q -f name=${docker})" ] && /usr/bin/docker stop ${docker} & >/dev/null 2>&1
|
[ "$(/usr/bin/docker ps -q -f name=${docker})" ] && /usr/bin/docker stop ${docker} & >/dev/null 2>&1
|
||||||
# [ "$(/usr/bin/docker ps -q -f name=${docker})" ] && echo "stopping" || echo "already stopped"
|
# [ "$(/usr/bin/docker ps -q -f name=${docker})" ] && echo "stopping" || echo "already stopped"
|
||||||
|
|||||||
Reference in New Issue
Block a user