FredHutch/lf-backup

Name: lf-backup

Owner: Fred Hutchinson Cancer Research Center

Description: lf-backup (aka large file backup) takes a list of filenames from a csv file or sql and copies the files to a swift objectstore

Created: 2016-10-25 23:59:44.0

Updated: 2016-10-26 00:59:00.0

Pushed: 2017-01-31 06:18:22.0

Homepage:

Size: 57

Language: Python

GitHub Committers

UserMost Recent Commit# Commits

Other Committers

UserEmailMost Recent Commit# Commits

README

LF Backup

LF Backup stands for large file backup.

Installation

RHEL / CentOS:

 yum -y install epel-release
 yum -y install python34 python34-setuptools python34-devel gcc postgresql-devel
 easy_install-3.4 pip

Debian/Ubuntu:

 apt-get install -y python3-dev libpq-dev

and then install lf-backup

 pip3 install --upgrade pip
 pip3 install lf-backup
Configuration

create a new swift container called “large-file-backup”

add the export statements for variables starting with ST_ and the postgres authentication to config file .lf-backuprc and set the permissions to 600. Optionally export PGSQL to override the built-in SQL query.

no ~/.lf-backuprc
mod 600 ~/.lf-backuprc
t ~/.lf-backuprc
rt ST_AUTH=https://swiftcluster.domain.org/auth/v1.0
rt ST_USER=swift_account
rt ST_KEY=RshBXXXXXXXXXXXXXXXXXXXXX
rt PGHOST=pgdb.domain.org
rt PGPORT=32048
rt PGDATABASE=storcrawldb
rt PGUSER=xxxxxxxx
rt PGPASSWORD= 

create a cron job /etc/cron.d/ running as root starting ca 7pm:

t /etc/cron.d/lf-backup
nabled on hostname xxx on 11-01-2016
8 * * * root /usr/local/bin/lf-backup --prefix /fh/fast \
       --container large-file-backup-fast --sql >> /var/tmp/lf-backup-fast 2>&1
Examples
ackup -C frobozz -c filelist.csv

Read list of files from 1st column of 'filename.csv' and backup to Swift container 'frobozz' using environment for authentication.

ackup -C grue -s

Query the database specified in the environment for the files and backup to Swift container 'grue' using environment for authentication.

ackup -C flathead -r 7 --prefix /fh/fast/restore42

Restore all objects in Swift container 'flathead' newer than 7 days back to current environment. The optional –prefix parameter specifies a destination path where objects will be restored.

Test & Dev

For modifications and change testing install a new system and install from local git folder

t clone https://github.com/FredHutch/lf-backup
 -rf /usr/local/lib/python3.5/dist-packages/*; rm -rf /usr/local/bin/*
p3 install -e ./lf-backup

 changes in lf-backup and run again:

 -rf /usr/local/lib/python3.5/dist-packages/*; rm -rf /usr/local/bin/*
p3 install -e ./lf-backup

The script had the following original feature requests:


This work is supported by the National Institutes of Health's National Center for Advancing Translational Sciences, Grant Number U24TR002306. This work is solely the responsibility of the creators and does not necessarily represent the official views of the National Institutes of Health.