ACED-IDP / gen3-helm

Helm charts for Gen3 Deployments
Apache License 2.0
1 stars 0 forks source link

Add way to quickly empty RDS database #10

Closed lbeckman314 closed 6 months ago

lbeckman314 commented 1 year ago

Previously PostgreSQL databases would be deleted when the deployment was brought down. With persistent storage through RDS it can be challenging and time intensive to manually delete the databases and users that were created during development cycles.

One option to solve this might be to add a Kubernetes job that could be run that would automate the required deletion steps:

# Databases
DROP DATABASE arborist_local;
DROP DATABASE audit_local;
DROP DATABASE fence_local;
DROP DATABASE indexd_local;
DROP DATABASE metadata_local;
DROP DATABASE peregrine_local;
DROP DATABASE requestor_local;
DROP DATABASE sheepdog_local;
DROP DATABASE wts_local;

# Users
DROP USER arborist_local;
DROP USER audit_local;
DROP USER fence_local;
DROP USER indexd_local;
DROP USER metadata_local;
DROP USER peregrine_local;

This job would need to have access to the RDS password passed to it either in a Configmap or environmental variable.

This should be included in the make clean target as well.

lbeckman314 commented 6 months ago

Largely resolved for local deployments with the make clean command in the Makefile. This deletes the Postgres pod and all associated tables.

This likely isn't wanted for non-local deployments as data persistence is required.