mirror of
https://github.com/Ocelot-Social-Community/Ocelot-Social.git
synced 2025-12-13 07:46:06 +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
|
||||
.eslintcache
|
||||
kubeconfig.yaml
|
||||
backup-cron-job.log
|
||||
|
||||
node_modules/
|
||||
cypress/videos
|
||||
|
||||
@ -27,13 +27,16 @@ mkdir -p ${BACKUP_FOLDER}
|
||||
${SCRIPT_DIR}/cluster.neo4j.sh maintenance on
|
||||
|
||||
# database backup
|
||||
echo "Dumping database ..."
|
||||
kubectl --kubeconfig=${KUBECONFIG} -n default exec -it \
|
||||
$(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
|
||||
# copy neo4j backup to local drive
|
||||
echo "Coping database ..."
|
||||
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
|
||||
# copy image data
|
||||
echo "Coping public uploads ..."
|
||||
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
|
||||
|
||||
|
||||
@ -16,9 +16,11 @@ KUBECONFIG=${KUBECONFIG:-${SCRIPT_DIR}/../configurations/${CONFIGURATION}/kubeco
|
||||
|
||||
case $1 in
|
||||
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
|
||||
;;
|
||||
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
|
||||
;;
|
||||
*)
|
||||
|
||||
@ -21,20 +21,24 @@ case $1 in
|
||||
${SCRIPT_DIR}/cluster.maintenance.sh on
|
||||
|
||||
# set Neo4j in offline mode (maintenance)
|
||||
echo "Neo4j maintenance: on"
|
||||
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
|
||||
echo "Wait 60s ..."
|
||||
sleep 60
|
||||
;;
|
||||
off)
|
||||
# set Neo4j in online mode
|
||||
echo "Neo4j maintenance: off"
|
||||
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
|
||||
echo "Wait 60s ..."
|
||||
sleep 60
|
||||
|
||||
# maintenance mode off
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user