This repository has been archived by the owner on Dec 8, 2017. It is now read-only.
forked from DanKottke/midas
-
Notifications
You must be signed in to change notification settings - Fork 4
Cloud Foundry Manual Migration Checklist
Sarah Allen edited this page May 18, 2016
·
6 revisions
- Verify your Cloud Foundry Target organization and space.
cf target
- Changing targets is easily done with the
-o
and-s
flags. Just provide the-o <ORG_NAME>
and the-s <SPACE_NAME>
when runningcf target
.
- Changing targets is easily done with the
- Connect to the production database using the
cf-ssh
tool. This can take a while to properly connect, so be patient.- Once connected you should be in a shared
tmate
session.
- Once connected you should be in a shared
- Download the
psql
binaries, using the Cloud.gov documentation.- Running this command with download the
psql
binaries and then put them in your path
- Running this command with download the
curl https://s3.amazonaws.com/18f-cf-cli/psql-9.4.4-ubuntu-14.04.tar.gz | tar xvz
PATH="`pwd`/psql/bin:$PATH"
- To dump the database to a
sql
file, type the following command:pg_dump $DATABASE_URL > ./backup.sql
. This will save the database to your current working directory. - Connect to the server from your local terminal with the
cf files
command. Make sure you are targeting the*-ssh
application when usecf files
. The file path starts from the root of the application user's home directory and every CF instance has your pushed files within anapp
directory. An example for the file created in the previous step would be:cf files openopps-ssh app/backup.sql
- to load the database locally:
dropdb midas
createdb midas
npm run migrate
psql midas < ../backup.sql
set $PROD to be the production database credentials
cf target -s prod
export PROD=`cf env openopps | grep "postgres://" | cut -d "\"" -f 4`
echo $PROD
then use cf-ssh on staging to copy the production database
cf target -s staging
export PROD= <paste from above>
pg_dump $PROD > ./prod.sql
psql $DATABASE_URL < prod.sql
Welcome to the Open Opportunities Wiki
- Getting Started