https://github.com/peter554/gcp-app-engine-contacts
GCP App Engine example with Cloud SQL
https://github.com/peter554/gcp-app-engine-contacts
gcp gcp-appengine-std gcp-cloud-sql golang
Last synced: 12 months ago
JSON representation
GCP App Engine example with Cloud SQL
- Host: GitHub
- URL: https://github.com/peter554/gcp-app-engine-contacts
- Owner: Peter554
- Created: 2021-06-19T05:25:14.000Z (almost 5 years ago)
- Default Branch: master
- Last Pushed: 2021-06-20T15:00:08.000Z (almost 5 years ago)
- Last Synced: 2024-10-19T11:28:54.207Z (over 1 year ago)
- Topics: gcp, gcp-appengine-std, gcp-cloud-sql, golang
- Language: Go
- Homepage:
- Size: 4.88 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# gcp-app-engine-contacts
[](https://github.com/Peter554/gcp-app-engine-contacts/actions/workflows/ci.yml)
An example app using GCP App Engine with Cloud SQL.
## Database preparations
https://cloud.google.com/sql/docs/postgres/connect-app-engine-standard#go
- Create a Cloud SQL postgres instance.
- Connect to the instance (`gcloud sql connect`) and create the contacts table:
```sql
create table if not exists contacts (
id serial primary key,
name varchar(100),
email varchar(100)
);
```
- Obtain the `INSTANCE_CONNECTION_NAME` (`gcloud sql instances describe`).
- Determine the postgres Data Source Name (DSN): `user=postgres password= database=postgres host=/cloudsql/`
- Set the GitHub actions secret `GCP_SQL_DSN`.
## Service account
- Create a service account and obtain a JSON key (https://github.com/google-github-actions/deploy-appengine)
- Set the GitHub actions secret `GCP_CREDENTIALS`.