proudcity / wp-proudcity

The ProudCity WordPress platform

Home Page:https://proudcity.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Add Santa Ana DB Export to pc kube commands

curtismchale opened this issue · comments

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.

@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.