Skip to content
Snippets Groups Projects

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

Created by: Tirokk

:cake: Pullrequest

Add script to set neo4j in offline-mode and back in online-mode.

Issues

Todo

  • None

Merge request reports

Approval is optional
Ready to merge by members who can write to the target branch.
  • The source branch is 1491 commits behind the target branch.
  • 2 commits and 1 merge commit will be added to master.
  • Source branch will not be deleted.

Activity

Filter activity
  • Approvals
  • Assignees & reviewers
  • Comments (from bots)
  • Comments (from users)
  • Commits & branches
  • Edits
  • Labels
  • Lock status
  • Mentions
  • Merge request status
  • Tracking
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
  • Hannes Heine
    Hannes Heine @Elweyn started a thread on commit 8d68537e
  • 38 ${SCRIPT_DIR}/cluster.neo4j.sh online-mode
  • Hannes Heine
    Hannes Heine @Elweyn started a thread on commit 8d68537e
  • 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)
  • Hannes Heine
    Hannes Heine @Elweyn started a thread on commit 8d68537e
  • 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)
  • Hannes Heine
    Hannes Heine @Elweyn started a thread on commit 8d68537e
  • 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
  • Hannes Heine
    Hannes Heine @Elweyn started a thread on commit 8d68537e
  • 19 19 mkdir -p ${BACKUP_FOLDER}
    20 20
    21 21 # maintenance mode on
    Please register or sign in to reply
    Loading