[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[taler-grid5k] 22/189: add automatic backup script
From: |
gnunet |
Subject: |
[taler-grid5k] 22/189: add automatic backup script |
Date: |
Thu, 28 Apr 2022 10:46:32 +0200 |
This is an automated email from the git hooks/post-receive script.
marco-boss pushed a commit to branch master
in repository grid5k.
commit 608cd8b758674e65f8826e5a14f82740cc02ad75
Author: Boss Marco <bossm8@bfh.ch>
AuthorDate: Tue Feb 22 16:24:51 2022 +0100
add automatic backup script
---
.gitignore | 1 +
additional/README.md | 7 ++++++
additional/persist.sh | 51 +++++++++++++++++++++++++++++++++++++++++
experiment/scripts/.run.sh.swp | Bin 12288 -> 0 bytes
experiment/scripts/database.sh | 18 ++++++++-------
experiment/scripts/run.sh | 3 ++-
6 files changed, 71 insertions(+), 9 deletions(-)
diff --git a/.gitignore b/.gitignore
index 4c49bd7..19ace02 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1 +1,2 @@
.env
+.swp
diff --git a/additional/README.md b/additional/README.md
index 25919f3..e63078e 100644
--- a/additional/README.md
+++ b/additional/README.md
@@ -1,5 +1,12 @@
# Additional Resources for Experiments
+## persist.sh
+
+Backup Grid'5000 shares which were created by an experiment.
+Contains all logs and the node configuration.
+
+Simply use with `./persist.sh`.
+
## plots
### plot.sh
diff --git a/additional/persist.sh b/additional/persist.sh
new file mode 100755
index 0000000..a510253
--- /dev/null
+++ b/additional/persist.sh
@@ -0,0 +1,51 @@
+#!/bin/bash
+
+# Script to automatically fetch and clean data on the Grid'5000 shares
+# Params:
+# 1: Name for the experiment
+# 2: Additional plot tar to include (see ./plots)
+
+set -e
+
+echo "
+Make sure that:
+
+- Your ssh key to access the grid is added to the ssh-agent with 'ssh-add
<KEY>'
+- The config to access the grid is setup as described in:
+
https://www.grid5000.fr/w/SSH#Using_SSH_ProxyCommand_feature_to_ease_the_access_to_hosts_inside_Grid.275000
+"
+
+if [ -z ${1} ]; then
+ echo "Missing experiment name"
+ exit 1
+elif [ -z ${2} ]; then
+ echo "No plots will be included"
+fi
+
+if [[ $(ssh-add -L | wc -l) == "0" ]]; then
+ echo "No ssh key added, aborting"
+ exit 1
+fi
+
+# Slugify the name
+NAME=$(\
+ echo "$1" | \
+ sed -r s/[~\^]+//g | \
+ sed -r s/[^a-zA-Z0-9]+/-/g | \
+ sed -r s/^-+\|-+$//g | \
+ tr A-Z a-z \
+)
+BACKUP_NAME="${NAME}-$(date +%d-%m-%y).tar.gz"
+
+G5K_BACKUP="g5k-$(date +%s).tar.gz"
+
+ssh g5k 'tar -czvf grenoble/g5k.tar.gz $(find . -type l -exec echo
"{}/taler-logs/" \;)'
+scp g5k:~/grenoble/g5k.tar.gz ${G5K_BACKUP}
+ssh g5k 'rm grenoble/g5k.tar.gz && $(find . -type l -exec rm -rf
"{}/taler-logs/" \;)'
+
+echo "Creating Backup Tar ${BACKUP_NAME}"
+
+tar -czvf ${BACKUP_NAME} ${G5K_BACKUP} ${2}
+
+rm ${G5K_BACKUP}
+
diff --git a/experiment/scripts/.run.sh.swp b/experiment/scripts/.run.sh.swp
deleted file mode 100644
index 3bb9928..0000000
Binary files a/experiment/scripts/.run.sh.swp and /dev/null differ
diff --git a/experiment/scripts/database.sh b/experiment/scripts/database.sh
index 57541b3..2b2fbd6 100755
--- a/experiment/scripts/database.sh
+++ b/experiment/scripts/database.sh
@@ -15,13 +15,15 @@ cd /tmp
function setup_disks() {
if [[ "$(hostname)" =~ "dahu" ]]; then
- mkdir /mnt/sdb || true
- mount /dev/sdb /mnt/sdb || true
- if [ ! -L /var/lib/postgresql/${POSTGRES_VERSION}/main/pg_xlog ]; then
- rm -rf /mnt/sdb/pg_xlog || true
- mv /var/lib/postgresql/${POSTGRES_VERSION}/main/pg_xlog/ /mnt/sdb
- ln -s /mnt/sdb/pg_xlog
/var/lib/postgresql/${POSTGRES_VERSION}/main/pg_xlog
- chown -R postgres:postgres
/var/lib/postgresql/${POSTGRES_VERSION}/main/pg_xlog
+ echo 'start=2048, type=83' | sfdisk /dev/disk1 || true
+ yes | mkfs.ext4 -m 0 /dev/disk1 || true
+ mkdir /mnt/disk || true
+ mount /dev/disk1 /mnt/disk || true
+ if [ ! -L /var/lib/postgresql/${POSTGRES_VERSION}/main/pg_wal ]; then
+ rm -rf /mnt/disk/pg_wal || true
+ mv /var/lib/postgresql/${POSTGRES_VERSION}/main/pg_wal/ /mnt/disk
+ ln -s /mnt/disk/pg_wal
/var/lib/postgresql/${POSTGRES_VERSION}/main/pg_wal
+ chown -R postgres:postgres
/var/lib/postgresql/${POSTGRES_VERSION}/main/pg_wal
fi
fi
}
@@ -246,7 +248,7 @@ EOF
case ${1} in
init)
setup_config
- # setup_disks
+ setup_disks
# setup_ram_storage
init_db
setup_pgbouncer
diff --git a/experiment/scripts/run.sh b/experiment/scripts/run.sh
index 7298cd7..a2979d5 100644
--- a/experiment/scripts/run.sh
+++ b/experiment/scripts/run.sh
@@ -56,7 +56,8 @@ elif [[ "${HOSTNAME}" =~ ${PROXY_HOSTS} ]]; then
exec ~/scripts/proxy.sh init
elif [[ "${HOSTNAME}" =~ ${DNS_HOSTS} ]]; then
set_host dns
- setup_log
+ # backup used nodes for experiment
+ cp ~/nodes.json ${LOG_DIR}/nodes.json
else
set_host wallet
set_ddn "${WALLET_DOMAIN//\*/${HOST}}"
--
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.
- [taler-grid5k] 13/189: fix comments, (continued)
- [taler-grid5k] 13/189: fix comments, gnunet, 2022/04/28
- [taler-grid5k] 31/189: try with explicit analyze as nested does not work, gnunet, 2022/04/28
- [taler-grid5k] 61/189: fix, gnunet, 2022/04/28
- [taler-grid5k] 32/189: undo explain, gnunet, 2022/04/28
- [taler-grid5k] 45/189: ramdom 0-20 deposit, dont log uri params in nginx, disable seqscan, gnunet, 2022/04/28
- [taler-grid5k] 35/189: add index on known_coins to try to fix recoup_by_reserve, gnunet, 2022/04/28
- [taler-grid5k] 49/189: keepalive in nginx, gnunet, 2022/04/28
- [taler-grid5k] 46/189: add request size to nginx, gnunet, 2022/04/28
- [taler-grid5k] 12/189: don't shard wire_out, gnunet, 2022/04/28
- [taler-grid5k] 17/189: still not working with aggregator, gnunet, 2022/04/28
- [taler-grid5k] 22/189: add automatic backup script,
gnunet <=
- [taler-grid5k] 48/189: fix, gnunet, 2022/04/28
- [taler-grid5k] 52/189: update merchant conf, gnunet, 2022/04/28
- [taler-grid5k] 58/189: try --unsafe-perm, gnunet, 2022/04/28
- [taler-grid5k] 54/189: coin lookahead sign 2 weeks only, -O2, gnunet, 2022/04/28
- [taler-grid5k] 11/189: update permissions for db, gnunet, 2022/04/28
- [taler-grid5k] 36/189: updated deployed image, gnunet, 2022/04/28
- [taler-grid5k] 40/189: include partition logic of taler, gnunet, 2022/04/28
- [taler-grid5k] 50/189: add offloaded processes, gnunet, 2022/04/28
- [taler-grid5k] 104/189: fix, gnunet, 2022/04/28
- [taler-grid5k] 122/189: support for multiple merchant nodes, gnunet, 2022/04/28