summaryrefslogtreecommitdiffstats
path: root/jjb/pharos/shell/backup-dashboard.sh
diff options
context:
space:
mode:
authorTrevor Bramwell <tbramwell@linuxfoundation.org>2018-11-01 18:51:18 +0000
committerGerrit Code Review <gerrit@opnfv.org>2018-11-01 18:51:18 +0000
commit896d1adf336fc0cafbbb8fe23a4e6c6d72338204 (patch)
tree9ba44cc60b77e6f217905abb0354f2da494171b5 /jjb/pharos/shell/backup-dashboard.sh
parentaa2b0e57b5578c0454c35dbe8abf6bd3cb1cb250 (diff)
parentbbafa00756c3c742d31caa33da98ac0731a6c0a9 (diff)
Merge "Update Pharos Dashboard Jobs"
Diffstat (limited to 'jjb/pharos/shell/backup-dashboard.sh')
-rw-r--r--jjb/pharos/shell/backup-dashboard.sh28
1 files changed, 28 insertions, 0 deletions
diff --git a/jjb/pharos/shell/backup-dashboard.sh b/jjb/pharos/shell/backup-dashboard.sh
new file mode 100644
index 000000000..4c1c01500
--- /dev/null
+++ b/jjb/pharos/shell/backup-dashboard.sh
@@ -0,0 +1,28 @@
+#!/bin/bash -eux
+##############################################################################
+# Copyright (c) 2018 Linux Foundation and others.
+#
+# All rights reserved. This program and the accompanying materials
+# are made available under the terms of the Apache License, Version 2.0
+# which accompanies this distribution, and is available at
+# http://www.apache.org/licenses/LICENSE-2.0
+##############################################################################
+
+BACKUP_DIR=$HOME/backups
+DATE=$(date +%Y%m%d)
+TAR_FILE=pharos-dashboard-db-$DATE.tar.tz
+
+mkdir -p $BACKUP_DIR
+echo "-- $DATE --"
+echo "--> Backing up Pharos Dashboard"
+
+docker run --rm \
+ -v pharos-data:/pharos-data:ro \
+ -v $BACKUP_DIR:/backup \
+ alpine \
+ tar -czf /backup/$TAR_FILE -C /pharos-data ./
+
+/usr/local/bin/gsutil cp $BACKUP_DIR/$TAR_FILE \
+ gs://opnfv-backups/pharos-dashboard/ && rm $BACKUP_DIR/$TAR_FILE
+
+echo "--> Pharos dashboard backup complete"