mirror of
https://github.com/Ocelot-Social-Community/Ocelot-Social.git
synced 2025-12-12 23:35:58 +00:00
Add more detailed logs for the scripts
- Ignore 'backup-cron-job.log' files.
This commit is contained in:
parent
b95b036265
commit
c240fe32ad
1
.gitignore
vendored
1
.gitignore
vendored
@ -8,6 +8,7 @@ yarn-error.log*
|
|||||||
.yarn-integrity
|
.yarn-integrity
|
||||||
.eslintcache
|
.eslintcache
|
||||||
kubeconfig.yaml
|
kubeconfig.yaml
|
||||||
|
backup-cron-job.log
|
||||||
|
|
||||||
node_modules/
|
node_modules/
|
||||||
cypress/videos
|
cypress/videos
|
||||||
|
|||||||
@ -27,13 +27,16 @@ mkdir -p ${BACKUP_FOLDER}
|
|||||||
${SCRIPT_DIR}/cluster.neo4j.sh maintenance on
|
${SCRIPT_DIR}/cluster.neo4j.sh maintenance on
|
||||||
|
|
||||||
# database backup
|
# database backup
|
||||||
|
echo "Dumping database ..."
|
||||||
kubectl --kubeconfig=${KUBECONFIG} -n default exec -it \
|
kubectl --kubeconfig=${KUBECONFIG} -n default exec -it \
|
||||||
$(kubectl --kubeconfig=${KUBECONFIG} -n default get pods | grep ocelot-neo4j | awk '{ print $1 }') \
|
$(kubectl --kubeconfig=${KUBECONFIG} -n default get pods | grep ocelot-neo4j | awk '{ print $1 }') \
|
||||||
-- neo4j-admin dump --database=neo4j --to=/var/lib/neo4j/$BACKUP_DATE-neo4j-dump
|
-- neo4j-admin dump --database=neo4j --to=/var/lib/neo4j/$BACKUP_DATE-neo4j-dump
|
||||||
# copy neo4j backup to local drive
|
# copy neo4j backup to local drive
|
||||||
|
echo "Coping database ..."
|
||||||
kubectl --kubeconfig=${KUBECONFIG} cp \
|
kubectl --kubeconfig=${KUBECONFIG} cp \
|
||||||
default/$(kubectl --kubeconfig=${KUBECONFIG} -n default get pods | grep ocelot-neo4j |awk '{ print $1 }'):/var/lib/neo4j/$BACKUP_DATE-neo4j-dump $BACKUP_FOLDER/neo4j-dump
|
default/$(kubectl --kubeconfig=${KUBECONFIG} -n default get pods | grep ocelot-neo4j |awk '{ print $1 }'):/var/lib/neo4j/$BACKUP_DATE-neo4j-dump $BACKUP_FOLDER/neo4j-dump
|
||||||
# copy image data
|
# copy image data
|
||||||
|
echo "Coping public uploads ..."
|
||||||
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
|
||||||
|
|
||||||
|
|||||||
@ -16,9 +16,11 @@ KUBECONFIG=${KUBECONFIG:-${SCRIPT_DIR}/../configurations/${CONFIGURATION}/kubeco
|
|||||||
|
|
||||||
case $1 in
|
case $1 in
|
||||||
on)
|
on)
|
||||||
|
echo "Network maintenance: on"
|
||||||
kubectl --kubeconfig=${KUBECONFIG} patch ingress ingress-ocelot-webapp --type merge --patch-file ${SCRIPT_DIR}/../src/kubernetes/patches/patch.ingress.maintenance.on.yaml
|
kubectl --kubeconfig=${KUBECONFIG} patch ingress ingress-ocelot-webapp --type merge --patch-file ${SCRIPT_DIR}/../src/kubernetes/patches/patch.ingress.maintenance.on.yaml
|
||||||
;;
|
;;
|
||||||
off)
|
off)
|
||||||
|
echo "Network maintenance: off"
|
||||||
kubectl --kubeconfig=${KUBECONFIG} patch ingress ingress-ocelot-webapp --type merge --patch-file ${SCRIPT_DIR}/../src/kubernetes/patches/patch.ingress.maintenance.off.yaml
|
kubectl --kubeconfig=${KUBECONFIG} patch ingress ingress-ocelot-webapp --type merge --patch-file ${SCRIPT_DIR}/../src/kubernetes/patches/patch.ingress.maintenance.off.yaml
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
|
|||||||
@ -21,20 +21,24 @@ case $1 in
|
|||||||
${SCRIPT_DIR}/cluster.maintenance.sh on
|
${SCRIPT_DIR}/cluster.maintenance.sh on
|
||||||
|
|
||||||
# set Neo4j in offline mode (maintenance)
|
# set Neo4j in offline mode (maintenance)
|
||||||
|
echo "Neo4j maintenance: on"
|
||||||
kubectl --kubeconfig=${KUBECONFIG} get deployment ocelot-neo4j -o json \
|
kubectl --kubeconfig=${KUBECONFIG} get deployment ocelot-neo4j -o json \
|
||||||
| jq '.spec.template.spec.containers[] += {"command": ["tail", "-f", "/dev/null"]}' \
|
| jq '.spec.template.spec.containers[] += {"command": ["tail", "-f", "/dev/null"]}' \
|
||||||
| kubectl --kubeconfig=${KUBECONFIG} apply -f -
|
| kubectl --kubeconfig=${KUBECONFIG} apply -f -
|
||||||
|
|
||||||
# wait for the container to restart
|
# wait for the container to restart
|
||||||
|
echo "Wait 60s ..."
|
||||||
sleep 60
|
sleep 60
|
||||||
;;
|
;;
|
||||||
off)
|
off)
|
||||||
# set Neo4j in online mode
|
# set Neo4j in online mode
|
||||||
|
echo "Neo4j maintenance: off"
|
||||||
kubectl --kubeconfig=${KUBECONFIG} get deployment ocelot-neo4j -o json \
|
kubectl --kubeconfig=${KUBECONFIG} get deployment ocelot-neo4j -o json \
|
||||||
| jq 'del(.spec.template.spec.containers[].command)' \
|
| jq 'del(.spec.template.spec.containers[].command)' \
|
||||||
| kubectl --kubeconfig=${KUBECONFIG} apply -f -
|
| kubectl --kubeconfig=${KUBECONFIG} apply -f -
|
||||||
|
|
||||||
# wait for the container to restart
|
# wait for the container to restart
|
||||||
|
echo "Wait 60s ..."
|
||||||
sleep 60
|
sleep 60
|
||||||
|
|
||||||
# maintenance mode off
|
# maintenance mode off
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user