-
Notifications
You must be signed in to change notification settings - Fork 40
Create staging database
Kuan Fan edited this page Sep 17, 2019
·
11 revisions
page owner: TFRS Developer
- Login prod postgresql96 pod and run command "pg_dump tfrs | gzip > /postgresql-backup/SQLDump/prod/tfrs-[DateTime].gz"
- Copy the above database dump to local drive "oc rsync [pod name]:[path to the dump file] [local drive]"
- Create secret tfrs-postgresql-staging which contains same content as prod secret tfrs-postgresql
- Create postgresql96-staging-cns storage
- Create DC/postgresql96-stagin, mount ostgresql96-staging-cns and bk-mem-tfrs-test-f2f7inx0x1ba
- Use the secret tfrs-postgresql-staging for environment variable
- oc rsync [local drive] [pod name]:/postgresql-backup/SQLDump/prod
- Test either has same release deployed as prod, or one or a couple ahead.
- If we don't run deployment on test, only duplicate prod database to test, there should be no migration happening.
- Further verification may be needed.
psql tfrs
DROP SCHEMA public CASCADE;
CREATE SCHEMA public;
GRANT ALL ON SCHEMA public TO postgres;
GRANT ALL ON SCHEMA public TO public;
DROP SCHEMA tfrs_audit CASCADE;
CREATE SCHEMA tfrs_audit;
GRANT ALL ON SCHEMA tfrs_audit TO postgres;
GRANT ALL ON SCHEMA tfrs_audit TO public;
\q
run command
gunzip -c /postgresql-backup/SQLDump/prod/tfrs-[DateTime].gz | psql tfrs