chore(other): add script to set neo4j in offline-mode and back in online-mode
Created by: Tirokk

Pullrequest

Add script to set neo4j in offline-mode and back in online-mode.
Issues
- fixes #6179
Todo
-
None
Merge request reports
Activity
Filter activity
19 19 mkdir -p ${BACKUP_FOLDER} 20 20 21 21 # maintenance mode on 22 ${SCRIPT_DIR}/cluster.maintenance.sh on 23 24 # shutdown database 25 kubectl --kubeconfig=${KUBECONFIG} get deployment ocelot-neo4j -o json \ 26 | jq '.spec.template.spec.containers[] += {"command": ["tail", "-f", "/dev/null"]}' \ 27 | kubectl --kubeconfig=${KUBECONFIG} apply -f - 28 29 # wait for the container to restart 30 sleep 60 22 # set Neo4j in offline mode (maintenance) 23 ${SCRIPT_DIR}/cluster.neo4j.sh offline-mode 2 3 # base setup 4 SCRIPT_PATH=$(realpath $0) 5 SCRIPT_DIR=$(dirname $SCRIPT_PATH) 6 7 # check CONFIGURATION 8 if [ -z ${CONFIGURATION} ]; then 9 echo "You must provide a `CONFIGURATION` via environment variable" 10 exit 1 11 fi 12 13 # configuration 14 KUBECONFIG=${KUBECONFIG:-${SCRIPT_DIR}/../configurations/${CONFIGURATION}/kubeconfig.yaml} 15 16 case $1 in 17 offline-mode) 14 KUBECONFIG=${KUBECONFIG:-${SCRIPT_DIR}/../configurations/${CONFIGURATION}/kubeconfig.yaml} 15 16 case $1 in 17 offline-mode) 18 # maintenance mode on 19 ${SCRIPT_DIR}/cluster.maintenance.sh on 20 21 # set Neo4j in offline mode (maintenance) 22 kubectl --kubeconfig=${KUBECONFIG} get deployment ocelot-neo4j -o json \ 23 | jq '.spec.template.spec.containers[] += {"command": ["tail", "-f", "/dev/null"]}' \ 24 | kubectl --kubeconfig=${KUBECONFIG} apply -f - 25 26 # wait for the container to restart 27 sleep 60 28 ;; 29 online-mode) 40 33 kubectl --kubeconfig=${KUBECONFIG} cp \ 41 34 default/$(kubectl --kubeconfig=${KUBECONFIG} -n default get pods | grep ocelot-backend |awk '{ print $1 }'):/app/public/uploads $BACKUP_FOLDER/public-uploads 42 35 43 # restart database 44 kubectl --kubeconfig=${KUBECONFIG} get deployment ocelot-neo4j -o json \ 45 | jq 'del(.spec.template.spec.containers[].command)' \ 46 | kubectl --kubeconfig=${KUBECONFIG} apply -f - 47 48 # wait for the container to restart 49 sleep 60 50 36 # set Neo4j in online mode 51 37 # maintenance mode off
Please register or sign in to reply