add dumping / backup restoring / setup

Bug #538765 reported by Dan MacNeil
12
This bug affects 1 person
Affects Status Importance Assigned to Milestone
MVHub
Confirmed
Low
Unassigned

Bug Description

##############
version #1 notes
##############

There is a backup procedure for databases running on csl-db-02

However, it is a bit of a kludge, works only for CSL hosted sites, is insufficiently documented and is not stored in version control.

The existing bash script is pasted at bottom of this bug report.

We are done when:

invoking:

   app-mvhub/bin/mv_backup

puts a database dump based on existing bash script in:

         $backup_dir

mv_backup should use

   MVHub::Utils::ConfigSimple::create_config_from($ENV{MV_SETUP_FILE});

to get:
    the database password / host / user and $backup_dir

and should use system() call to pg_dump

files to modify:

  # to create /var/www/mvhub/$USER/backups/
     app-mvhub/project_tools/bin/mv_setup

 # RELATIVE_PATH.backup_dir= backups
 app-mvhub/project-tools/templates/template.conf
 /var/www/mvhub/$USER/conf/nsp.conf
 /var/www/mvhub/$USER/conf/mvh.conf

# add a cron entry
./app-mvhub/setup/etc/cron.d/mvhub-cron

# update to run backup daily for each site
/app-mvhub/setup/etc/cron.d/mvhub-cron

##############
version #1a notes
##############

Also include images and .css files in the backup

##############
version #2 notes
##############

See also:

538143 export to our data CSV

397162 [f] schema and meta data loader / updater & separate data from
schema creation

538763 IRS / NTEE codes / categories for data sharing

...these are overlapping but different

Dump user created data and meta data as csv, so instead of a raw database dump, just the relivant tables.

It should be possible to restore the database from the backup and the
schema setup.

##############

#!/bin/bash

export PGPASSWORD='password'
export NOW=` date +%Y-%m-%d-%H_%M-%a`
export MVH_DUMP_FILE="/var/backups/postgres/${NOW}_mvh_production_db"
export NSP_DUMP_FILE="/var/backups/postgres/${NOW}_nsp_production_db"

pg_dump \
 --format=c \
 --file $MVH_DUMP_FILE.dump \
 -h localhost \
 -d production.mvh \
 -U production

pg_dump \
 --format=p \
 --file $MVH_DUMP_FILE.sql \
 --no-owner \
 --clean \
 --no-acl \
 -h localhost \
 -d production.mvh \
 -U production

pg_dump \
 --format=c \
 --file $NSP_DUMP_FILE.dump \
 -h localhost \
 -d production.nsp \
 -U production

pg_dump \
 --format=p \
 --file $NSP_DUMP_FILE.sql \
 --no-owner \
 --clean \
 --no-acl \
 -h localhost \
 -d production.nsp \

Dan MacNeil (omacneil)
description: updated
description: updated
Dan MacNeil (omacneil)
description: updated
Dan MacNeil (omacneil)
description: updated
Dan MacNeil (omacneil)
tags: added: time-40+hrs
removed: 40-plus-hours
Dan MacNeil (omacneil)
description: updated
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Duplicates of this bug

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.