fecgov / fec-cms

The content management system (CMS) for the new Federal Election Commission website.
https://www.fec.gov
Other
93 stars 38 forks source link

Change feature space CMS db from `shared-psql` to `micro-psql` #5189

Closed patphongs closed 2 years ago

patphongs commented 2 years ago

Summary

What we're after: Shared-psql will be deprecated on cloud.gov by August 2022. We need to convert the feature space db to use the micro-psql plan.

We also need to update the retention policy to 35 days.

cf create-service aws-rds micro-psql ${NEW_SERVICE_NAME} -c '{"backup_retention_period": 35}'

Try upgrading using the service command:

cf update-service ${SERVICE_NAME} -p ${NEW_SERVICE_PLAN_NAME}

Related issues

List any relevant related issue(s)

Completion criteria

cnlucas commented 2 years ago

Attempted to update using the above command and it failed.

https://cloudgov.statuspage.io/incidents/0v1nwyybb0fs https://cloud.gov/2021/04/02/shared-db-deprecation-notice/ https://github.com/cloud-gov/product/issues/1367#issuecomment-658555642

"At this time, customers who are currently running shared database server instances will need to begin planning a migration to a dedicated instance plan. To perform a migration, a customer must export their existing database and restore it into a new instance created with a dedicated service plan."

patphongs commented 2 years ago

@cnlucas These are sample instructions to create a new DB service and delete the old one:

https://github.com/fecgov/fec-cms/issues/3907#issuecomment-662510125

cnlucas commented 2 years ago

For Future Reference:

  1. cf create-service aws-rds micro-psql fec-feature-cms-micro -c '{"version": "11","backup_retention_period": 35}'
  2. waited for creation to finish (check with cf services)
  3. cf unbind-service cms fec-feature-cms
  4. cf bind-service cms fec-feature-cms-micro
  5. In new terminal SSH into tunnel (several steps) (https://github.com/fecgov/fec-cms/wiki/Backup-or-Restore-Wagtail-PostgreSQL-database-in-dev,-staging,-or-production)
  6. pg_restore --dbname postgres://$creds@localhost:5432/$dbname --no-acl --no-owner <path of the dump file>.dump
  7. cf restage cms
  8. restart last feature deploy in circleci

Going to wait for @patphongs to confirm I can delete shared-psql service.

Screen Shot 2022-07-01 at 9 16 14 AM
cnlucas commented 2 years ago

Shared space was deleted.