Created
August 19, 2016 15:17
-
-
Save pkarman/20f4a4a022a2c59e49bd96675e8101c3 to your computer and use it in GitHub Desktop.
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
* note existing DATABASE_URL for historical notes | |
* comment out the *-db service in manifest.yml (it does not yet exist) | |
* create the new db service: e.g. | |
cf create-service rds shared-psql c2-staging-db | |
OR | |
cf create-service rds medium-psql c2-prod-db | |
* dump the existing db to a file | |
cssh c2-staging | |
curl https://s3.amazonaws.com/18f-cf-cli/psql-9.4.4-ubuntu-14.04.tar.gz | tar xvz | |
psql/bin/pg_dump $DATABASE_URL | gzip > c2-staging-2016-04-25.sql.gz | |
[leave terminal window open for next step] | |
* fetch the db dump and push it to a new cf-ssh instance | |
[different terminal window] | |
cffetch c2-staging-ssh c2-staging-2016-04-25.sql.gz | |
cf push c2-staging-worker | |
* load the dump into the new db service | |
cssh c2-staging-worker | |
curl https://s3.amazonaws.com/18f-cf-cli/psql-9.4.4-ubuntu-14.04.tar.gz | tar xvz | |
zcat c2-staging-2016-04-25.sql.gz | psql/bin/psql $DATABASE_URL | |
* comment in the *-db service in manifest.yml | |
* unset DATABASE_URL and re-deploy using service | |
cf unset-env c2-staging DATABASE_URL | |
cf unset-env c2-staging MAINTENANCE_MODE | |
cf push c2-staging | |
cf push c2-staging-worker |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
cffetch and cssh scripts are at https://github.com/pkarman/my-toolbox