mirror of
https://github.com/Ocelot-Social-Community/Ocelot-Social.git
synced 2025-12-13 07:46:06 +00:00
Refactor backup script by using new 'cluster.neo4j.sh'
This commit is contained in:
parent
fd7e39e959
commit
8d68537e32
@ -19,15 +19,8 @@ BACKUP_FOLDER=${BACKUP_FOLDER:-${SCRIPT_DIR}/../configurations/${CONFIGURATION}/
|
|||||||
mkdir -p ${BACKUP_FOLDER}
|
mkdir -p ${BACKUP_FOLDER}
|
||||||
|
|
||||||
# maintenance mode on
|
# maintenance mode on
|
||||||
${SCRIPT_DIR}/cluster.maintenance.sh on
|
# set Neo4j in offline mode (maintenance)
|
||||||
|
${SCRIPT_DIR}/cluster.neo4j.sh offline-mode
|
||||||
# shutdown database
|
|
||||||
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
|
|
||||||
|
|
||||||
# database backup
|
# database backup
|
||||||
kubectl --kubeconfig=${KUBECONFIG} -n default exec -it \
|
kubectl --kubeconfig=${KUBECONFIG} -n default exec -it \
|
||||||
@ -40,13 +33,6 @@ kubectl --kubeconfig=${KUBECONFIG} cp \
|
|||||||
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
|
default/$(kubectl --kubeconfig=${KUBECONFIG} -n default get pods | grep ocelot-backend |awk '{ print $1 }'):/app/public/uploads $BACKUP_FOLDER/public-uploads
|
||||||
|
|
||||||
# restart database
|
# 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
|
|
||||||
|
|
||||||
# maintenance mode off
|
# maintenance mode off
|
||||||
${SCRIPT_DIR}/cluster.maintenance.sh off
|
${SCRIPT_DIR}/cluster.neo4j.sh online-mode
|
||||||
Loading…
x
Reference in New Issue
Block a user