Skip to main content

Cloud SQL : PostgreSQL on GCP

Introduction#

To deploy the GitGuardian app, a PostgreSQL instance is required. This page is dedicated to helping you setup a PostgreSQL on GCP using Cloud SQL.

Note: The GitGuardian application is bundled with a basic PostgreSQL. This PostgreSQL can be used for testing but is not meant to be production-ready.

High-Availability#

GCP handles failover and redirects the traffic by itself. As long as your Cloud SQL is set up to be highly available, upgrades and single node issues will not cause an outage.

Installation#

From the Google Cloud Console#

To create a PostgreSQL from the Google Cloud Console, we recommend following the official documentation.

To customize the database name, please follow Create and manage databases.

To customize the user used to access the database, please follow Create and manage users.

You need to ensure that the Availability mode is set to Multiple zones (Highly available).

Using Terraform#

To create a PostgreSQL instance using TF, you need the following resources:

In addition to the fields required by Terraform, we require the following fields to be set on the google_sql_database_instance:

  • availability_type="REGIONAL" - The availability type of the Cloud SQL instance, high availability (REGIONAL) or single zone (ZONAL).