{"id":19211621,"url":"https://github.com/marcusg/pg_backup","last_synced_at":"2025-05-12T20:10:51.262Z","repository":{"id":43714051,"uuid":"42875406","full_name":"marcusg/pg_backup","owner":"marcusg","description":"Create, restore, download and upload postgres dumps locally and on remote servers using capistrano","archived":false,"fork":false,"pushed_at":"2022-12-21T14:27:59.000Z","size":32,"stargazers_count":5,"open_issues_count":5,"forks_count":3,"subscribers_count":1,"default_branch":"master","last_synced_at":"2024-04-26T01:02:01.131Z","etag":null,"topics":["capistrano","database","dump","dumps","postgresql","rails","restore","restoring-postgres-dumps","ruby","sync","synchronization"],"latest_commit_sha":null,"homepage":"https://github.com/marcusg/pg_backup","language":"Ruby","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/marcusg.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2015-09-21T15:32:38.000Z","updated_at":"2022-12-21T14:28:03.000Z","dependencies_parsed_at":"2023-01-30T04:00:35.438Z","dependency_job_id":null,"html_url":"https://github.com/marcusg/pg_backup","commit_stats":null,"previous_names":[],"tags_count":8,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/marcusg%2Fpg_backup","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/marcusg%2Fpg_backup/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/marcusg%2Fpg_backup/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/marcusg%2Fpg_backup/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/marcusg","download_url":"https://codeload.github.com/marcusg/pg_backup/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":223835418,"owners_count":17211158,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["capistrano","database","dump","dumps","postgresql","rails","restore","restoring-postgres-dumps","ruby","sync","synchronization"],"created_at":"2024-11-09T13:43:08.057Z","updated_at":"2024-11-09T13:43:08.733Z","avatar_url":"https://github.com/marcusg.png","language":"Ruby","funding_links":[],"categories":[],"sub_categories":[],"readme":"# pg_backup\n\n## create and restore postgres dumps with capistrano\n\n[![Gem Version](https://badge.fury.io/rb/pg_backup.svg)](http://badge.fury.io/rb/pg_backup)\n\nThis gem adds rake tasks to your rails application for creating and restoring postgres dumps. The dumps are created with ```pg_dump``` and restored with ```pg_restore``` - these tools are included in a full postgres installation, but also available as standalone binaries (needed if your db is not located in the application server).\n\n## Requirements\n- rails \u003e= 3\n- capistrano (optional)\n- postgresql with ```pg_dump``` and ```pg_restore``` binaries\n\n## Installation\n\nAdd this line to your application's Gemfile:\n\n```ruby\n# Gemfile\ngem 'pg_backup'\n```\n\nAnd then execute:\n\n    $ bundle\n\n## Usage\n\n```\nrake pg_backup:dump:create # create a dump from local db and save it locally\nrake pg_backup:dump:load   # import latest dump from local file into local db\n```\n\nIf you want to create or load a dump file from a different directory or file name, use the ``` PG_DUMP_DIR ``` and/or ```PG_DUMP_FILE``` (relative to dump directory) env vars:\n```\nrake PG_DUMP_DIR=/my/dump/dir PG_DUMP_FILE=mydump.backup pg_backup:dump:create\nrake PG_DUMP_DIR=/my/dump/dir PG_DUMP_FILE=mydump.backup pg_backup:dump:load\n```\n\n### Capistrano integration\n(https://github.com/capistrano/capistrano)\n\nadd to your ```Capfile```\n```ruby\n# Capfile\nrequire \"pg_backup/integration/capistrano\"\n```\nthis adds some capistrano tasks\n```\ncap \u003cenv\u003e pg_backup:dump:create    # creates remote dump (from remote db) in remote dir\ncap \u003cenv\u003e pg_backup:dump:load      # imports latest remote dump into remote db\ncap \u003cenv\u003e pg_backup:dump:download  # downloads latest remote dump to local dir\ncap \u003cenv\u003e pg_backup:dump:upload    # uploads latest local dump to remote dir\ncap \u003cenv\u003e pg_backup:dump:list      # shows list of dumps in remote dir\n```\n\n**NOTE:** Ensure environment variable set in capistrano files (needed for pg_backup to use correct database).\n```ruby\n# staging.rb\nset :environment, 'staging'\n```\n\nTo overwrite dump directories in capistrano, place something like this in your ```deploy.rb``` or ```\u003cstage\u003e.rb```\n```ruby\nset :pg_backup_local_dump_dir, '/my/dump/dir'\nset :pg_backup_remote_dump_dir, '/my/dump/dir'\n```\n\n### deploy-mate integration\n(https://github.com/hanseventures/deploy-mate)\n\nadd to your ```Capfile```\n\n```ruby\n# Capfile\nrequire \"pg_backup/integration/deploy_mate\"\n```\n\n## Example usage\n\nCreate a dump on production server, download it, upload the dump to staging and load it into staging database\n\n```\nbundle exec cap production pg_backup:dump:create\nbundle exec cap production pg_backup:dump:download\nbundle exec cap staging pg_backup:dump:upload\nbundle exec cap staging pg_backup:dump:load\n```\n\n**PRO TIP:** Use the simple **sync** task, which runs exactly the same commands:\n```\nbundle exec rake pg_backup:sync PG_DUMP_SOURCE=production PG_DUMP_TARGET=staging\n```\n\n## Credits\nhttps://gist.github.com/hopsoft/56ba6f55fe48ad7f8b90\n\n## Contributing\n\n1. Fork it ( https://github.com/marcusg/pg_backup/fork )\n2. Create your feature branch (`git checkout -b my-new-feature`)\n3. Commit your changes (`git commit -am 'Add some feature'`)\n4. Push to the branch (`git push origin my-new-feature`)\n5. Create a new Pull Request\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmarcusg%2Fpg_backup","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmarcusg%2Fpg_backup","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmarcusg%2Fpg_backup/lists"}