{"id":21644119,"url":"https://github.com/blaur/terraform-nodejs-react-gke","last_synced_at":"2026-04-10T07:12:24.571Z","repository":{"id":192753811,"uuid":"687333383","full_name":"blaur/terraform-nodejs-react-gke","owner":"blaur","description":"A basic sample deployment of React web app and Node backend on Google Kubernetes Engine","archived":false,"fork":false,"pushed_at":"2023-09-05T07:32:04.000Z","size":214,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-19T08:49:27.771Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","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/blaur.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":"2023-09-05T06:31:16.000Z","updated_at":"2024-01-24T10:52:33.000Z","dependencies_parsed_at":null,"dependency_job_id":"f68de7e6-b593-47e2-ab60-9d21cde6a989","html_url":"https://github.com/blaur/terraform-nodejs-react-gke","commit_stats":null,"previous_names":["blaur/terraform-nodejs-react-gke"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/blaur/terraform-nodejs-react-gke","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/blaur%2Fterraform-nodejs-react-gke","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/blaur%2Fterraform-nodejs-react-gke/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/blaur%2Fterraform-nodejs-react-gke/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/blaur%2Fterraform-nodejs-react-gke/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/blaur","download_url":"https://codeload.github.com/blaur/terraform-nodejs-react-gke/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/blaur%2Fterraform-nodejs-react-gke/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":266287824,"owners_count":23905461,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","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-11-25T05:38:08.545Z","updated_at":"2025-10-24T01:19:06.635Z","avatar_url":"https://github.com/blaur.png","language":"HCL","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Introduction\nThis project is a simple example of how to deploy a node backend and react frontend on GKE using terraform.\n\nThe infrastructure consists of the following\n- GKE cluster running auto-pilot\n- Cloud Storage for assets\n- Cloud SQL Postgress\n- Backend and frontend workloads\n- Ingress for both workloads\n\n## Backend\nSimple node backend using TypeScript. It expose a GraphQL API using Apollo which use Cloud SQL (and TypeORM) for persistence. \n\nBuild your docker image. The terraform will define the URL pattern for the image in the container registry (google_container_registry_image -\u003e stooks-gke-${var.env}) which wil lbe output as the project name.\n\n1. `docker build . -t gcr.io/${PROJECT_ID}/{project_name}:v1`\n2. `gcloud builds submit --tag gcr.io/${PROJECT_ID}/{project_name}:v1 .`\n\nIf you wish to run it locally, then go to: Read more [here](./apps/backend/README.md). Requirements is to have postgres database running locally.\n\n# Frontend\nSimple react frontend using TypeScript. It communicates with the backend using GraphQL. As with the backend, the terraform defines will output the image url to use.\n\n1. `docker build . -t gcr.io/${PROJECT_ID}/{project_name}-frontend:v1`\n2. `gcloud builds submit --tag gcr.io/${PROJECT_ID}/{project_name}-frontend:v1 .`\n\nIf you wish to run it locally, then go to: Read more [here](./apps/frontend/README.md).\n\n# Deployment\n\n## Requirements\n1. Create a Google Cloud Project\n2. Enable all the necessary Google Cloud APIs such as compute, container registry, cloud sql and storage. Google will let you know if you forgot anything so don't worry.\n\n## How-to Deploy to GKE\n\nIn the project directory, you can run:\n\n1. Install all necessary tools: terraform, gcloud and kubectl\n2. Authenticate with Google Cloud: gcloud auth application-default login\n3. Create the infrastructure with terraform: \n    - `cd terraform/dev \u0026\u0026 terraform init \u0026\u0026 terraform apply`\n4. Follow the guides for Frontend and Backend above to build and push docker images.\n    - `cd apps/frontend and apps/backend`\n    - `docker build -t gcr.io/${PROJECT_ID}/.....:v1 .`\n    - `gcloud docker -- push gcr.io/${PROJECT_ID}/......`\n5. Authenticate kubectl: `gcloud container clusters get-credentials $(terraform output cluster_name) --zone=$(terraform output cluster_zone)`\n\n### Deploy backend\n1. Render Kubernetes config template: `terraform output k8s_rendered_template_backend \u003e backendk8s.yml`\n2. Update Kubernetes resources: `kubectl apply -f backendk8s.yml`\n3. Get direct ip address with: `kubectl get ingress stooks-gke-dev-ingress`\n\n### Deploy frontend \n1. Render Kubernetes config template: `terraform output k8s_rendered_template_frontend \u003e frontendk8s.yml`\n2. Update Kubernetes resources: `kubectl apply -f frontendk8s.yml`\n3. Get direct ip address with: `kubectl get ingress stooks-gke-dev-frontend-ingress`\n\nTo get direct IP addresses:\n1. `kubectl get ingress stooks-gke-dev-ingress`\n2. `kubectl get ingress stooks-gke-frontend-dev`\n\n## Inspiration\n\nInspired by examples https://github.com/hashicorp/learn-terraform-provision-gke-cluster and https://github.com/epiphone/gke-terraform-example.","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fblaur%2Fterraform-nodejs-react-gke","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fblaur%2Fterraform-nodejs-react-gke","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fblaur%2Fterraform-nodejs-react-gke/lists"}