Created
April 4, 2013 01:43
-
-
Save satomixx/5307032 to your computer and use it in GitHub Desktop.
Easy usage of postgresql on heroku ref: http://qiita.com/items/1f63e0993ed15d19f5fe
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Check available addons | |
% heroku addons:list | |
// Install postgres | |
% heroku addons:add heroku-postgresql | |
// Check addons in your repository | |
% heroku addons | |
=== hogehogehogehoge Configured Add-ons | |
heroku-postgresql:dev HEROKU_POSTGRESQL_TEAL |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
% heroku config === hogehogehogehoge Config Vars | |
FACEBOOK_APP_ID: 000000000000000 | |
FACEBOOK_SECRET: 000000000000000000 | |
HEROKU_POSTGRESQL_TEAL_URL: postgres://userhoge:passwordfuga@servernamefunya:portgowa/dbnamechowa |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
% curl -o heroku.dump 'https://s3.amazonaws.com/hkpgbackups/hogehoge@heroku.com/b001.dump?AWSAccessKeyId=fugafuga&Expires=hunyahunya&Signature=wachawacha' % Total % Received % Xferd Average Speed Time Time Time Current | |
Dload Upload Total Spent Left Speed | |
100 1416 100 1416 0 0 988 0 0:00:01 0:00:01 --:--:-- 1931 | |
% ls | |
heroku.dump <- this!! |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
% pg_restore --verbose --clean --no-acl --no-owner -h localhost -U [username] -d [dbname] [backup file name] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
% heroku addons:add pgbackups | |
Adding pgbackups on powerful-castle-8258... done, v12 (free) | |
You can now use "pgbackups" to backup your databases or import an external backup. | |
Use `heroku addons:docs pgbackups` to view documentation. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
% heroku addons:docs pgbackups | |
Opening pgbackups docs... done |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
% heroku addons:docs heroku-postgresql | |
Opening heroku-postgresql docs... done |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
% heroku pgbackups:capture | |
! Unknown database. Valid options are: HEROKU_POSTGRESQL_TEAL_URL |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
% heroku pgbackups:capture HEROKU_POSTGRESQL_TEAL_URL | |
HEROKU_POSTGRESQL_TEAL_URL ----backup---> b001 | |
Capturing... done | |
Storing... done |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
% heroku pgbackups | |
ID Backup Time Status Size Database | |
---- ------------------- ------------------------------ ----- -------------------------- | |
b001 2013/04/04 00:49.18 Finished @ 2013/04/04 00:49.25 1.4KB HEROKU_POSTGRESQL_TEAL_URL |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
% heroku pgbackups:restore HEROKU_POSTGRESQL_TEAL_URL b001HEROKU_POSTGRESQL_TEAL_URL <---restore--- b001 | |
HEROKU_POSTGRESQL_TEAL_URL | |
2013/04/04 00:49.18 | |
1.4KB | |
! WARNING: Destructive Action | |
! This command will affect the app: powerful-castle-8258 | |
! To proceed, type "appidhoge" or re-run this command with --confirm appidhoge | |
> appidhoge | |
Retrieving... done | |
Restoring… done |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
% heroku pgbackups:url b001 "https://s3.amazonaws.com/hkpgbackups/hogehoge@heroku.com/b001.dump?AWSAccessKeyId=fugafuga&Expires=hunyahunya&Signature=wachawacha" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment