项目作者: Peter554

项目描述 :
GCP Cloud Run example with Cloud SQL
高级语言: Go
项目地址: git://github.com/Peter554/gcp-cloud-run-contacts.git
创建时间: 2021-06-20T14:27:18Z
项目社区:https://github.com/Peter554/gcp-cloud-run-contacts

开源协议:

下载


gcp-cloud-run-contacts

CI

An example app using GCP Cloud Run with Cloud SQL.

Project ID

  • Set the GitHub actions secret GCP_PROJECT_ID

Database preparations

https://cloud.google.com/sql/docs/postgres/connect-run

  • Create a Cloud SQL postgres instance.
  • Connect to the instance (gcloud sql connect) and create the contacts table:
  1. create table if not exists contacts (
  2. id serial primary key,
  3. name varchar(100),
  4. email varchar(100)
  5. );
  • Obtain the INSTANCE_CONNECTION_NAME (gcloud sql instances describe).
  • Set the GitHub actions secret GCP_SQL_CONNECTION_NAME.
  • Determine the postgres Data Source Name (DSN): user=postgres password=<password> database=postgres host=/cloudsql/<INSTANCE_CONNECTION_NAME>
  • Set the GitHub actions secret GCP_SQL_DSN.

Service account