Disable debug set -x
Mute compose config test Update logic for onlining stack
This commit is contained in:
parent
9a439caf3f
commit
f16b702108
@ -1,5 +1,5 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
set -x
|
#set -x # debugging flag
|
||||||
|
|
||||||
# Check for network mounted devices
|
# Check for network mounted devices
|
||||||
# NAS SMB
|
# NAS SMB
|
||||||
@ -25,7 +25,7 @@ fi
|
|||||||
|
|
||||||
for stack in /home/admin/homelab/fighter/config/*; do
|
for stack in /home/admin/homelab/fighter/config/*; do
|
||||||
cd $stack
|
cd $stack
|
||||||
if ! docker compose config; then
|
if ! docker compose config > /dev/null; then
|
||||||
echo " ==== Invalid compose config: $stack"
|
echo " ==== Invalid compose config: $stack"
|
||||||
fi
|
fi
|
||||||
COMPOSE_CONFIG_TEXT=$(docker compose config)
|
COMPOSE_CONFIG_TEXT=$(docker compose config)
|
||||||
@ -37,17 +37,21 @@ for stack in /home/admin/homelab/fighter/config/*; do
|
|||||||
# need the one that must be offline.
|
# need the one that must be offline.
|
||||||
# If all of those fail, we know the stack is dependent on an offline service
|
# If all of those fail, we know the stack is dependent on an offline service
|
||||||
# So we just skip the stack.
|
# So we just skip the stack.
|
||||||
if $SMB_ONLINE && $ISCSI_ONLINE; then
|
if ! ( echo $COMPOSE_CONFIG_TEXT | grep -q /mnt/iscsi ) && ! ( echo $COMPOSE_CONFIG_TEXT | grep -q /mnt/nas); then
|
||||||
|
echo " ==== Stack not dependent on NAS services"
|
||||||
echo " ==== Bringing up $stack"
|
echo " ==== Bringing up $stack"
|
||||||
docker compose up -d
|
docker compose up -d
|
||||||
|
elif $SMB_ONLINE && $ISCSI_ONLINE; then
|
||||||
|
echo " ==== Bringing up $stack (all NAS services online)"
|
||||||
|
docker compose up -d
|
||||||
elif $ISCSI_ONLINE && ! ( echo $COMPOSE_CONFIG_TEXT | grep -q /mnt/nas ); then
|
elif $ISCSI_ONLINE && ! ( echo $COMPOSE_CONFIG_TEXT | grep -q /mnt/nas ); then
|
||||||
echo " ==== Bringing up $stack"
|
echo " ==== Bringing up $stack (iSCSI online, not dependent on SMB)"
|
||||||
docker compose up -d
|
docker compose up -d
|
||||||
elif $SMB_ONLINE && ! ( echo $COMPOSE_CONFIG_TEXT | grep -q /mnt/iscsi ); then
|
elif $SMB_ONLINE && ! ( echo $COMPOSE_CONFIG_TEXT | grep -q /mnt/iscsi ); then
|
||||||
echo " ==== Bringing up $stack"
|
echo " ==== Bringing up $stack (SMB online, not dependent on iSCSI)"
|
||||||
docker compose up -d
|
docker compose up -d
|
||||||
else
|
else
|
||||||
echo " ==== Skipping stack $stack"
|
echo " ==== Skipping stack $stack (Dependent NAS service offline)"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
cd /home/admin/homelab/fighter/config/
|
cd /home/admin/homelab/fighter/config/
|
||||||
|
Loading…
Reference in New Issue
Block a user