Service url: https://app-oehs-qs4uvgfbba-uc.a.run.app
Go v1.17.3 The main http service is coded in Go.
Google Cloud Platform - GCP For infrastructure:
- Cloud Build for CI/CD
- Cloud Run for running the service
- Artifact Registry for storing container images
- Kaniko for building container images via Cloud Build
Terraform For infrastructure provisioning on GCP
Dockerfile For packaging app into container
/cmd Main code for this project.
/build Packaging and Cloud Build file for CI/CD
/deployments Terraform files
You can read more about the structure here
- Create a project on GCP
- Enable Cloud Resource Manager API
- Create a service account on GCP (IAM) and download json auth keys for this account (make sure to give it the right permissions- Editor, Project IAM Admin)
- Move the json auth file to the root path of this project
- Connect repository to the Cloud Build > trigger
- Create
deployments/terraform.tfvars
file and make sure to configure these variables: artifact_registry, project, organization, credentials_file usedeployments/variables.tf
as a reference - Update
./build/cloudbuild_on_push.yaml
substitutions _REPO_NAME, _URL correctly - Run terraform apply
- Run Cloud Build trigger (via GUI or git push event)
To run tests
go test ./cmd/server/
To run the service
go run ./cmd/server/
GET https://app-oehs-qs4uvgfbba-uc.a.run.app/1/data
# expected {"accountId":1,"timestamp":"2021-12-07T10:04:12.942215649Z","data":"Something new"}
GET https://app-oehs-qs4uvgfbba-uc.a.run.app/
# expected "Hello"
GET https://app-oehs-qs4uvgfbba-uc.a.run.app/testing/data
# expected "Couldn't parse the accountId, make sure it's an integer!"