Use python3 as base
[releng.git] / jjb / laas / shell / backup-dashboard.sh
1 #!/bin/bash -eux
2 ##############################################################################
3 # Copyright (c) 2018 Linux Foundation and others.
4 #
5 # All rights reserved. This program and the accompanying materials
6 # are made available under the terms of the Apache License, Version 2.0
7 # which accompanies this distribution, and is available at
8 # http://www.apache.org/licenses/LICENSE-2.0
9 ##############################################################################
10
11 BACKUP_DIR=$HOME/backups
12 DATE=$(date +%Y%m%d)
13 TAR_FILE=laas-dashboard-db-$DATE.tar.tz
14
15 mkdir -p $BACKUP_DIR
16 echo "-- $DATE --"
17 echo "--> Backing up Lab as a Service Dashboard"
18
19 docker run --rm \
20   -v laas-data:/laas-data:ro \
21   -v $BACKUP_DIR:/backup \
22   alpine \
23   tar -czf /backup/$TAR_FILE -C /laas-data ./
24
25 /usr/local/bin/gsutil cp $BACKUP_DIR/$TAR_FILE \
26   gs://opnfv-backups/laas-dashboard/ && rm $BACKUP_DIR/$TAR_FILE
27
28 echo "--> LAAS dashboard backup complete"