Configuring the cloud database

In the local development environment, we were spinning up a Postgres database every time we started our application with docker-compose up. This won't be our approach when we deploy the application to the Kubernetes cluster because we'll use the Cloud SQL database solution provided by Google.

Use gcloud sql to create a new database instance (it will take a few minutes):

$ gcloud sql instances create elixir-drip-production --database-version=POSTGRES_9_6# ...$ gcloud sql instances listNAME DATABASE_VERSION LOCATION TIER ADDRESS STATUSelixir-drip-production POSTGRES_9_6 europe-west1-b db-custom-1-3840 35.195.47.137 RUNNABLE

Let's now create the postgres database user that our application will use:

$ gcloud sql ...

Get Mastering Elixir now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.