Setting up DB to be pushed and deployed easy peasy
Log in to Google Cloud console
- Bearjam commerce project
- Database instance can have multiple databases
- so we don't have to pay for multiple users
Set up Cloud SQL proxy PostgreSQL
- Quickstart for local testing
- Cloud SQL Viewer
- Use a Postgres client to connect to localhost
- Set password for Postgres user
- Postgres interface in terminal
Three environments
- Development
- Staging
- Production aka Master
(a bit like github)
Deploy to app enginge, w/o worrying about the DB Create a build trigger that deploys the code to app engine on push to master/staging There are two files we need to add to our code at this point
- add app.yaml and cloudbuild.yaml
Create trigger in Gcloud Base Cloud build config file
- File type - cloud build yaml or json - cloudbuild.yaml
- Follow documentation for permissions, etc.
- Once created, run the trigger
staging.app.yaml staging.cloudbuild.yaml master.app.yaml master.cloudbuild.yaml
steps:
- name: gcr.io/cloud-builders/gcloud
entrypoint: "bash"
args: [
"-c",
"gcloud secrets versions access latest --secret=$REPO_NAME-app-yaml-$BRANCH_NAME
--format='get(payload.data)' | tr '_-' '/+' | base64 -d > app.yaml",
]