Project

pg_utils

0.0
No commit activity in last 3 years
No release in over 3 years
PG_Utils is a simple PostgreSQL utility gem. It provides a command line interface to backup the datavase from a remote server, restore a backup locally and kill existing sessions.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

~> 1.14
~> 1.2
~> 4.1.0
~> 10.0
~> 3.0
~> 0.4
 Project Readme

PgUtils

Easily backup and download your remote PostgreSQL database. Restore the backup in your local database.

Installation

Add this line to your application's Gemfile:

gem 'pg_utils'

And then execute:

$ bundle install

Or install it yourself as:

$ gem install pg_utils

Usage

Add your config file in config/pg_utils.yml

ssh_host: '3.3.3.3'
ssh_user: 'jack'
ssh_port: '33'
ssh_password: '33'
remote_backup_folder: '/my/app/public/backups'
remote_database_name: 'my_database'
remote_database_username: 'user'
remote_database_password: '333'
local_folder: '/my/backup/folder'
local_database: 'my_dev_database'
local_database_username: 'dev'
local_database_password: '555'

Backup

Download your database from the remote server using:

pg_utils backup

The above command generates a backup in the remote machine and saves it in the remote_backup_folder.

It also downloads the backup file to your local machine local_folder.

Restore

You can also restore the most recent backup in your local machine using:

pg_utils restore

The restore command gets the most recent backup in the local_folder and runs a restore command targeting the local_database.

Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/juniorjp/pg_utils. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the Contributor Covenant code of conduct.

License

The gem is available as open source under the terms of the MIT License.