From a79eedc99e44cdd512ddb5b0baa923485f57f860 Mon Sep 17 00:00:00 2001 From: Ulf Gebhardt Date: Sun, 8 Dec 2024 06:08:34 +0100 Subject: [PATCH] removed scripts & patches --- patches/patch.ingress.maintenance.off.yaml | 12 -------- patches/patch.ingress.maintenance.on.yaml | 12 -------- scripts/maintenance.sh | 20 ------------- scripts/neo4j.sh | 34 --------------------- scripts/restore.sh | 35 ---------------------- 5 files changed, 113 deletions(-) delete mode 100644 patches/patch.ingress.maintenance.off.yaml delete mode 100644 patches/patch.ingress.maintenance.on.yaml delete mode 100755 scripts/maintenance.sh delete mode 100755 scripts/neo4j.sh delete mode 100755 scripts/restore.sh diff --git a/patches/patch.ingress.maintenance.off.yaml b/patches/patch.ingress.maintenance.off.yaml deleted file mode 100644 index cb144f0..0000000 --- a/patches/patch.ingress.maintenance.off.yaml +++ /dev/null @@ -1,12 +0,0 @@ -spec: - rules: - - host: - http: - paths: - - path: / - pathType: ImplementationSpecific - backend: - service: - name: wir-social-webapp - port: - number: 3000 \ No newline at end of file diff --git a/patches/patch.ingress.maintenance.on.yaml b/patches/patch.ingress.maintenance.on.yaml deleted file mode 100644 index 0aebd57..0000000 --- a/patches/patch.ingress.maintenance.on.yaml +++ /dev/null @@ -1,12 +0,0 @@ -spec: - rules: - - host: - http: - paths: - - path: / - pathType: ImplementationSpecific - backend: - service: - name: wir-social-maintenance - port: - number: 80 \ No newline at end of file diff --git a/scripts/maintenance.sh b/scripts/maintenance.sh deleted file mode 100755 index a676626..0000000 --- a/scripts/maintenance.sh +++ /dev/null @@ -1,20 +0,0 @@ -#!/bin/sh - -# base setup -SCRIPT_PATH=$(realpath $0) -SCRIPT_DIR=$(dirname $SCRIPT_PATH) - -case $1 in - on) - echo "Network maintenance: on" - kubectl patch --namespace=wir-social-ocelot-production ingress wir-social --type merge --patch-file ${SCRIPT_DIR}/../patches/patch.ingress.maintenance.on.yaml - ;; - off) - echo "Network maintenance: off" - kubectl patch --namespace=wir-social-ocelot-production ingress wir-social --type merge --patch-file ${SCRIPT_DIR}/../patches/patch.ingress.maintenance.off.yaml - ;; - *) - echo -e "Run this script with first argument either 'on' or 'off'" - exit - ;; -esac \ No newline at end of file diff --git a/scripts/neo4j.sh b/scripts/neo4j.sh deleted file mode 100755 index cc34aef..0000000 --- a/scripts/neo4j.sh +++ /dev/null @@ -1,34 +0,0 @@ -#!/bin/bash - -# base setup -SCRIPT_PATH=$(realpath $0) -SCRIPT_DIR=$(dirname $SCRIPT_PATH) - -case $1 in - on) - # set Neo4j in offline mode (maintenance) - echo "Neo4j maintenance: on" - kubectl get --namespace=wir-social-ocelot-production statefulset ocelot-neo4j-neo4j -o json \ - | jq '.spec.template.spec.containers[] += {"command": ["tail", "-f", "/dev/null"]}' \ - | kubectl apply -f - - - # wait for the container to restart - echo "Wait 60s ..." - sleep 60 - ;; - off) - # set Neo4j in online mode - echo "Neo4j maintenance: off" - kubectl get --namespace=wir-social-ocelot-production statefulset ocelot-neo4j-neo4j -o json \ - | jq 'del(.spec.template.spec.containers[].command)' \ - | kubectl apply -f - - - # wait for the container to restart - echo "Wait 60s ..." - sleep 60 - ;; - *) - echo -e "Run this script with first argument either 'off' or 'on'" - exit - ;; -esac diff --git a/scripts/restore.sh b/scripts/restore.sh deleted file mode 100755 index 5492c61..0000000 --- a/scripts/restore.sh +++ /dev/null @@ -1,35 +0,0 @@ -#!/bin/sh - -# base setup -SCRIPT_PATH=$(realpath $0) -SCRIPT_DIR=$(dirname $SCRIPT_PATH) - -# configuration -BACKUP_DATE="2024-12-04_09-39-10" -BACKUP_FOLDER=${BACKUP_FOLDER:-${SCRIPT_DIR}/../backup/${BACKUP_DATE}} - -printf "Backup folder: %s\n" $BACKUP_FOLDER - -${SCRIPT_DIR}/maintenance.sh on -${SCRIPT_DIR}/neo4j.sh on - -# copy neo4j backup from local drive -echo "Copying database from local file system ..." -kubectl cp \ - $BACKUP_FOLDER/neo4j-dump \ - wir-social-ocelot-production/$(kubectl --namespace=wir-social-ocelot-production get pods | grep ocelot-neo4j |awk '{ print $1 }'):/var/lib/neo4j/$BACKUP_DATE-neo4j-dump - -# copy image data -echo "Copying public uploads to local file system ..." -kubectl cp \ - $BACKUP_FOLDER/public-uploads/. \ - wir-social-ocelot-production/$(kubectl --namespace=wir-social-ocelot-production get pods | grep wir-social-backend |awk '{ print $1 }'):/app/public/uploads/ - -# restore database -echo "Restoring Database ..." -kubectl --namespace=wir-social-ocelot-production exec -it \ - $(kubectl --namespace=wir-social-ocelot-production get pods | grep ocelot-neo4j | awk '{ print $1 }') \ - -- neo4j-admin load --from=/var/lib/neo4j/$BACKUP_DATE-neo4j-dump --force - -${SCRIPT_DIR}/neo4j.sh off -${SCRIPT_DIR}/maintenance.sh off \ No newline at end of file