Change 'cluster.neo4j.sh' commands to 'maintenance on' and 'maintenance off'

This commit is contained in:
Wolfgang Huß 2023-10-25 13:56:14 +02:00
parent 16ce5673a3
commit 85e6b5fc48
2 changed files with 32 additions and 26 deletions

View File

@ -18,9 +18,8 @@ BACKUP_FOLDER=${BACKUP_FOLDER:-${SCRIPT_DIR}/../configurations/${CONFIGURATION}/
# create backup fodler
mkdir -p ${BACKUP_FOLDER}
# maintenance mode on
# set Neo4j in offline mode (maintenance)
${SCRIPT_DIR}/cluster.neo4j.sh off
# cluster maintenance mode on && Neo4j maintenance mode on
${SCRIPT_DIR}/cluster.neo4j.sh maintenance on
# database backup
kubectl --kubeconfig=${KUBECONFIG} -n default exec -it \
@ -33,6 +32,5 @@ kubectl --kubeconfig=${KUBECONFIG} cp \
kubectl --kubeconfig=${KUBECONFIG} cp \
default/$(kubectl --kubeconfig=${KUBECONFIG} -n default get pods | grep ocelot-backend |awk '{ print $1 }'):/app/public/uploads $BACKUP_FOLDER/public-uploads
# set Neo4j in online mode
# maintenance mode off
${SCRIPT_DIR}/cluster.neo4j.sh on
# Neo4j maintenance mode off && cluster maintenance mode off
${SCRIPT_DIR}/cluster.neo4j.sh maintenance off

View File

@ -14,7 +14,9 @@ fi
KUBECONFIG=${KUBECONFIG:-${SCRIPT_DIR}/../configurations/${CONFIGURATION}/kubeconfig.yaml}
case $1 in
off)
maintenance)
case $2 in
on)
# maintenance mode on
${SCRIPT_DIR}/cluster.maintenance.sh on
@ -26,7 +28,7 @@ case $1 in
# wait for the container to restart
sleep 60
;;
on)
off)
# set Neo4j in online mode
kubectl --kubeconfig=${KUBECONFIG} get deployment ocelot-neo4j -o json \
| jq 'del(.spec.template.spec.containers[].command)' \
@ -42,4 +44,10 @@ case $1 in
echo -e "Run this script with first argument either 'off' or 'on'"
exit
;;
esac
;;
*)
echo -e "Run this script with first argument 'maintenance'"
exit
;;
esac