zkt25/sk1/README.md

2.5 KiB
Executable File

Nudges.works — GKE Deployment on GCP

What it does

A service marketplace application that connects users with service providers. Users can search for professionals like plumbers, electricians, or gardeners in their area and view their profiles, including contact information and rates.

Architecture

  • GKE cluster (3 nodes) running on Google Cloud
  • Google-managed TLS certificate for HTTPS
  • Ingress controller for traffic routing
  • 2 Deployments & Services: frontend (React/Vite), backend (Express)
  • MongoDB hosted on Atlas (external persistent database)
  • Docker images stored in Google Container Registry (GCR)

Files

  • backend/Dockerfile - Containerizes the Express backend
  • frontend/Dockerfile - Containerizes the React frontend
  • frontend/nginx.conf - Nginx configuration for serving frontend and proxying API requests
  • k8s/ - Kubernetes manifests:
    • mongo-secret.yml - Secret for MongoDB credentials and API keys
    • backend-deployment.yml.tpl - Backend deployment template
    • backend-service.yml - Backend service
    • backend-config.yml - Health check configuration for backend
    • frontend-deployment.yml.tpl - Frontend deployment template
    • frontend-service.yml - Frontend service
    • managed-cert.yml - GCP-managed TLS certificate
    • ingress.yml - Ingress configuration for routing
  • prepare-app.sh - Script to deploy everything
  • remove-app.sh - Script to tear down the deployment
  • README.md - This documentation

Prerequisites

  • Google Cloud SDK + billing enabled
  • Install the GKE auth plugin:
    gcloud components install gke-gcloud-auth-plugin
    
  • Ensure your shell sees the Linux gcloud, kubectl and npm, not Windows versions
  • gcloud init & set project
  • Enable APIs: Container, Compute, Cloud Build

DNS setup

  1. After ./prepare-app.sh finishes you'll see the ingress external IP
  2. In your DNS provider, set A-record for nudges.works → your GKE Ingress EXTERNAL-IP.
  3. (Optional) CNAME wwwnudges.works.

Deploy

chmod +x prepare-app.sh remove-app.sh
./prepare-app.sh

Wait until ManagedCertificateActive. Then browse
https://nudges.works

Note on Certificate Provisioning

  • The managed certificate can take 30-60 minutes to provision
  • Your application will be accessible via HTTP immediately, but HTTPS requires waiting for certificate activation
  • You can check certificate status with: kubectl get managedcertificates -n sk1

Teardown

./remove-app.sh