mirror of
https://github.com/Ocelot-Social-Community/Ocelot-Social.git
synced 2025-12-12 23:35:58 +00:00
Change 'cluster.neo4j.sh' commands to 'maintenance on' and 'maintenance off'
This commit is contained in:
parent
16ce5673a3
commit
85e6b5fc48
@ -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
|
||||
@ -14,32 +14,40 @@ fi
|
||||
KUBECONFIG=${KUBECONFIG:-${SCRIPT_DIR}/../configurations/${CONFIGURATION}/kubeconfig.yaml}
|
||||
|
||||
case $1 in
|
||||
off)
|
||||
# maintenance mode on
|
||||
${SCRIPT_DIR}/cluster.maintenance.sh on
|
||||
maintenance)
|
||||
case $2 in
|
||||
on)
|
||||
# maintenance mode on
|
||||
${SCRIPT_DIR}/cluster.maintenance.sh on
|
||||
|
||||
# set Neo4j in offline mode (maintenance)
|
||||
kubectl --kubeconfig=${KUBECONFIG} get deployment ocelot-neo4j -o json \
|
||||
| jq '.spec.template.spec.containers[] += {"command": ["tail", "-f", "/dev/null"]}' \
|
||||
| kubectl --kubeconfig=${KUBECONFIG} apply -f -
|
||||
# set Neo4j in offline mode (maintenance)
|
||||
kubectl --kubeconfig=${KUBECONFIG} get deployment ocelot-neo4j -o json \
|
||||
| jq '.spec.template.spec.containers[] += {"command": ["tail", "-f", "/dev/null"]}' \
|
||||
| kubectl --kubeconfig=${KUBECONFIG} apply -f -
|
||||
|
||||
# wait for the container to restart
|
||||
sleep 60
|
||||
;;
|
||||
on)
|
||||
# set Neo4j in online mode
|
||||
kubectl --kubeconfig=${KUBECONFIG} get deployment ocelot-neo4j -o json \
|
||||
| jq 'del(.spec.template.spec.containers[].command)' \
|
||||
| kubectl --kubeconfig=${KUBECONFIG} apply -f -
|
||||
# wait for the container to restart
|
||||
sleep 60
|
||||
;;
|
||||
off)
|
||||
# set Neo4j in online mode
|
||||
kubectl --kubeconfig=${KUBECONFIG} get deployment ocelot-neo4j -o json \
|
||||
| jq 'del(.spec.template.spec.containers[].command)' \
|
||||
| kubectl --kubeconfig=${KUBECONFIG} apply -f -
|
||||
|
||||
# wait for the container to restart
|
||||
sleep 60
|
||||
# wait for the container to restart
|
||||
sleep 60
|
||||
|
||||
# maintenance mode off
|
||||
${SCRIPT_DIR}/cluster.maintenance.sh off
|
||||
# maintenance mode off
|
||||
${SCRIPT_DIR}/cluster.maintenance.sh off
|
||||
;;
|
||||
*)
|
||||
echo -e "Run this script with first argument either 'off' or 'on'"
|
||||
exit
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
*)
|
||||
echo -e "Run this script with first argument either 'off' or 'on'"
|
||||
echo -e "Run this script with first argument 'maintenance'"
|
||||
exit
|
||||
;;
|
||||
esac
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user