Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adds note for copying dbs, using maintenance mode #92

Merged
merged 1 commit into from
Apr 28, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 14 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ npx sequelize db:migrate
At this point you should be ready to go!

The app is compiled into a bundle and pushed to Heroku, which
serves it at commonwealthapp.herokuapp.com. **Migrations are
serves it at <app>.herokuapp.com. **Migrations are
automatically executed.** If migrations do not complete successfully,
the new backend does not get served.

Expand All @@ -64,6 +64,18 @@ NODE_ENV=production yarn build
NODE_ENV=production yarn start
```

To copy the production database to the staging database for testing purposes, ensuring migrations will work:
```
# turn off the web dynos in staging
heroku maintenance:on -a <STAGING_APP>
# backup the staging database in case of an error
heroku pg:backups capture -a <STAGING_APP>
# copy db from production app database url to staging url
heroku pg:copy <PRODUCTION_APP>::<PRODUCTION_DB_URL> <STAGING_DB_URL> -a <STAGING_APP>
# turn on the web dynos in staging
heroku maintenance:off -a <STAGING_APP>
```

## Environment Variables

You should create a `.env` file in the root of the repository
Expand Down Expand Up @@ -113,7 +125,7 @@ brew tap heroku/brew && brew install heroku
Setting up a server environment:

```
heroku git:remote --app commonwealthapp
heroku git:remote --app <PRODUCTION_APP>
heroku config:set [Set up session secrets, API keys, OAuth tokens, etc.]
yarn deploy
```
Expand Down