{"id":22131118,"url":"https://github.com/slamdev/gcp-serverless","last_synced_at":"2026-03-19T21:52:57.795Z","repository":{"id":39274503,"uuid":"230465898","full_name":"slamdev/gcp-serverless","owner":"slamdev","description":"Serverless app on GCP","archived":false,"fork":false,"pushed_at":"2023-12-15T14:58:10.000Z","size":1098,"stargazers_count":0,"open_issues_count":27,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-06-14T19:09:11.507Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"HCL","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/slamdev.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2019-12-27T15:19:34.000Z","updated_at":"2020-11-11T09:40:44.000Z","dependencies_parsed_at":"2024-12-01T18:42:02.315Z","dependency_job_id":null,"html_url":"https://github.com/slamdev/gcp-serverless","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/slamdev/gcp-serverless","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/slamdev%2Fgcp-serverless","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/slamdev%2Fgcp-serverless/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/slamdev%2Fgcp-serverless/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/slamdev%2Fgcp-serverless/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/slamdev","download_url":"https://codeload.github.com/slamdev/gcp-serverless/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/slamdev%2Fgcp-serverless/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28956938,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-31T18:30:42.805Z","status":"ssl_error","status_checked_at":"2026-01-31T18:30:19.593Z","response_time":128,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-12-01T18:30:04.444Z","updated_at":"2026-01-31T22:03:48.500Z","avatar_url":"https://github.com/slamdev.png","language":"HCL","funding_links":[],"categories":[],"sub_categories":[],"readme":"# GCP Serverless [![Build Status](https://github.com/slamdev/gcp-serverless/workflows/deploy/badge.svg)](https://github.com/slamdev/gcp-serverless/actions?query=workflow%3Adeploy) [![Instance](https://img.shields.io/uptimerobot/status/m784066675-cecccf2199b268abfefca2c4?label=website)](https://dev.gcp-serverless.slamdev.net)\n\n## Project AIM\n\nBuild a globally distributed application using serverless approach on Google Cloud platform.\n\n### Result\n\n- GCP **Cloud Firestore** is not globally distributed\n  * workaround: switch database to FaunaDB\n- GCP **Global Load Balancer** doesn't support **Cloud Functions** and **Cloud Storage**\n  * workaround: deploy **Envoy Proxy** in each region and put GLB in front; proxy requests to functions\\buckets to the corresponding region\n\n## Landscape overview \n\n![diagram](/etc/diagram.png?raw=true \"Diagram\")\n\n## Development\n\n### Prerequisites\n\nCreate projects for terraform state and a project per environment. [setup.sh](/etc/setup.sh) script covers all the setup.\n\n#### Necessary tools\n\n- [terraform](https://github.com/hashicorp/terraform)\n- [terragrunt](https://github.com/gruntwork-io/terragrunt)\n- [go](https://golang.org/doc/install)\n- [gcloud](https://cloud.google.com/sdk/gcloud/)\n\nmacOS:\n```shell script\nbrew install terraform terragrunt go\nbrew cask install google-cloud-sdk\n```\n\n### Build/Deploy\n\nAll the interaction with project is implemented via [Makefile](Makefile)\n\nBy default all make targets are executed for **dev** environment. It can be changed by providing **TF_VAR_env** variable, e.g.:\n```shell script\nTF_VAR_env=prod make plan \n```\n\n**make init**|**make plan**|**make apply**|**make destroy** executes corresponding command for all the components in parallel\n\n**make init/{COMPONENT_NAME}**|**make plan/{COMPONENT_NAME}**|**make apply/{COMPONENT_NAME}**|**make destroy/{COMPONENT_NAME}** executes corresponding command for a specified component, e.g.:\n```shell script\nmake plan/backend/functions-bucket\n```\n\n**make clean-local-state** target removes local state files from all the projects\n\n**make lint** target does a static validation for all the terraform files (at the moment it validates only code style rules according to the terraform conventions)\n\n**make format** formats all the terraform files according to the terraform conventions\n\n**make unlock/{COMPONENT_NAME}** command unlocks the remote terraform state for a component, e.g.:\n```shell script\nmake unlock/backend/functions-bucket LOCK_ID=123456789\n```\n\n#### Remark about **make init**\n\nTerragrunt suppose to do auto-init so in most cases there is no need to invoke this command manually, but some times it fails to do it. There is an open issue about it: https://github.com/gruntwork-io/terragrunt/issues/388\n\n#### Remark about **make clean-local-state**\n\nIf there was a deploy to dev, terraform will fail to deploy to prod, because it has a state from dev locally. So it will try to migrate a dev state to prod and this is not a desire behavior.\n\nSubj make target will clean all the local state files so deploy to prod will succeed.\n\n### CI/CD\n\nFlow:\n- if a user pushes to **master** branch then the pipeline will apply changes to the **DEV** environment (by executing `TF_VAR_env=DEV make apply`)\n- if a user pushes to **production** branch then the pipeline will apply changes to the **PROD** environment (by executing `TF_VAR_env=PROD make apply`)\n- if a user pushes to an arbitrary branch then the pipeline will:\n  * lint all the files in the project (by executing `make lint`)\n  * do **plan** on **dev** environment (by executing `TF_VAR_env=dev make plan`)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fslamdev%2Fgcp-serverless","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fslamdev%2Fgcp-serverless","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fslamdev%2Fgcp-serverless/lists"}