CLI interface for backup of remote PostgreSQL DB to either local storage or S3. This was created as part of a learning exercise.
- Ensure
pipandpipenvare installed. - Clone the git repo:
git clone git@github.com:thehackadmin/pgbackup cdinto the cloned repo.- Fetch development dependencies:
make install - Activate python virtualenv:
pipenv shell
- Pass in:
- the full DB URL that is to be backed up
- the storage driver
- the destination
S3 example w/ bucket name:
$ pgbackup postgres://bob@example.com:5432/db_one --driver s3 backups
Local example:
$ pgbackup postgres://bob@example.com:5432/db_one --driver local /var/local/db_one/backups/dump.sql
Run tests locally using make if the virtualenv is active:
$ make
If the virtualenv is not active then:
$ pipenv run make