This project is a simple Time API built with Node.js and Express, deployed on Google Cloud Platform (GCP) using Terraform and Kubernetes.
- Provides current time information
- Deployed on GKE (Google Kubernetes Engine)
- CI/CD pipeline using GitHub Actions
- Infrastructure as Code with Terraform
- Backend: Node.js with Express
- Deployment: Docker, Kubernetes
- Cloud Provider: Google Cloud Platform
- IaC: Terraform
- CI/CD: GitHub Actions
time_api/
: Contains the Node.js applicationterraform/
: Terraform configuration for GCP resources.github/workflows/
: CI/CD pipeline configuration
- Set up GCP project and credentials
- Configure Terraform variables in
terraform/terraform.tfvars
- Set up GitHub Secrets for GCP credentials and Docker Hub token
- Push to the main branch to trigger the CI/CD pipeline
- The Terraform state file is stored remotely in a GCS bucket to enable collaboration and maintain state consistency.
- Module structure:
modules/
: Contains reusable Terraform modulesgke/
: Google Kubernetes Engine cluster configurationvpc/
: Virtual Private Cloud network setupgcs/
: Google Cloud Storage bucket for Terraform state
main.tf
: Main Terraform configuration filevariables.tf
: Input variables declarationoutputs.tf
: Output values definitionterraform.tfvars
: Variable values
The API provides a single endpoint: GET /time
Basic monitoring is set up using GCP's monitoring services.
To run the project locally:
- Navigate to the
time_api
directory - Install dependencies:
npm install
- Start the server:
npm run nodemon