proudcity / wp-proudcity

The ProudCity WordPress platform
https://proudcity.com
Other
21 stars 9 forks source link

Add Santa Ana DB Export to pc kube commands #2545

Closed curtismchale closed 2 months ago

curtismchale commented 2 months ago

Source

Currently if you use pc kube db-export prod santaanaca you get an old version of the SA database on the old SQL server that everyone shares. Santa Ana's current db is on it's own instance called proudcity-santanaaca.

We need to modify the db-export command so that we can specify the instance we should be downloading from as long term we will likely have other customers on their own DB instance and we'll need to support it anyway.

Current Command

pc kube db-export $namespace $app $prefix $return $bucket

New Command

pc kube db-export $namespace $app $instance $prefix $return $bucket

There is already $instance defined in the base configuration we just need to allow custom definitions of it if the parameter is specified. So the SA command would be:

pc kube db-export prod santaanaca proudcity-santanaaca which defines the SQL instance to use and then the rest of the automation should continue as it does now.

This should build a direct query something like

gcloud sql export sql $instance gs://proudcity-backups/prod/santaanaca/$export-name.sql.gz

This file should be downloaded to your local computer.

curtismchale commented 2 months ago

@jlyon @aschmoe the command pc kube db-export prod santaanaca will now get the proper SQL instance without needing to define the command via gcloud commands.