CloudSQL: Add Postgres support (fails with "driver: bad connection")
MarckK opened this issue · 1 comments
I've deployed an instance of triage-party to CloudRun without a persistent backend, and that worked fine.
Then, I deployed a Cloud SQL instance (postgres) and created a user and database. Then, based on minikube-deploy.sh example, I tried to deploy a new revision with CloudSQL by setting the environment variables PERSIST_BACKEND and PERSIST_PATH and that failed.
F0511 19:55:08.934229 1 main.go:94] unable to create persistence layer: new from cloudsql: USER:PASSWORD@tcp(PROJECT/us-central1/jx-teaparty)/tp: driver: bad connection
Advice/tips appreciated.
Hey @MarckK -
Triage Party currently makes an incorrect assumption that the CloudSQL backend is MySQL. Here is where it goes wrong:
triage-party/pkg/persist/cloudsql.go
Line 27 in f6fbba2
I haven't yet tried Postgres on CloudSQL, but I'm not sure how to auto-detect the backend. If it isn't possible, two workaround are:
- Splitting the
cloudsql
handler intocloudsql-mysql
andcloudsql-postgres
- Try once with MySQL and falling back to Postgres
Thoughts?