This project aims to deploy a Kubernetes cluster on Google Cloud Platform (GCP) using Terraform. The infrastructure will include a load balancer for ingress, instances, and instance groups. Additionally, it will showcase the integration of a basic Next.js application, containerized with a small program rendering the Cohere logo on page load.
Requirements
TOOL | VERSION |
Terraform | v1.7.4 |
Python | 3.12.2 |
GCloud | Google Cloud SDK 466.0.0 |
Node | v20.11.1 |
.
├── terraform/
│ ├── environments
│ | └── dev
│ | ├── main.tf
│ | ├── provider.tf
│ | ├── variables.tf
│ | ├── state.tf
│ | └── versions.tf
│ └── modules
│ ├── compute
│ └── network
├─ k8s
│ ├── charts
| | └── cohere-app
│ └── manifests
│ └── postgress.yaml
├── ci/
│ ├── configs
│ └── scripts
├── app/
│ ├── Dockerfile
│ └── cohere-app
│ ├── package.json
│ ├── package-lock.json
│ └── ...
├── README.md
└── ...
$ chmod +x ci/scripts/build-and-push-app.sh
$ python3 ci/scripts/build-and-push-all.py --config ci/configs/pipeline-config.json --gitsha [GIT SHA] --registry gcr.io/[PROJECT_ID]
The App is a simple nextjs app for k8s cluster access testing purposes.
- npm install
This command builds the app for production
$ npm run build
This command launches app with build configuration and files
$ npm run dev # runs in development mode and does not require pre-build
$ npm run start
IaC is setup with Terraform. resouce modules are build in the terraform/modules
directory and consumed when building each sub environment in environment/[env]
$ python3 ci/scripts/execute-terraform.py --command plan --config ci/configs/pipeline-config.json --env dev
$ python3 ci/scripts/execute-terraform.py --command apply --config ci/configs/pipeline-config.json --env dev