90 lines
3.1 KiB
Markdown
90 lines
3.1 KiB
Markdown
# Contact List Application
|
|
|
|
A simple web-based contact list application deployed on Google Kubernetes Engine (GKE) with automated HTTPS certificate provisioning.
|
|
|
|
## Description
|
|
|
|
This application allows users to create, view, update, and delete contacts in a persistent MongoDB database. It features a clean, responsive interface and is deployed as a containerized application on Google Cloud Platform using Kubernetes.
|
|
|
|
## Technologies Used
|
|
|
|
- **Frontend**: HTML, CSS, JavaScript
|
|
- **Backend**: Node.js with Express
|
|
- **Database**: MongoDB
|
|
- **Containerization**: Docker
|
|
- **Orchestration**: Google Kubernetes Engine (GKE)
|
|
- **Load Balancing & HTTPS**: GKE Ingress with Google-managed certificates
|
|
- **Domain**: Dynamic domain using nip.io DNS service
|
|
|
|
## Architecture
|
|
|
|
The application consists of multiple containers:
|
|
|
|
1. **Contact App**: Node.js application serving the web interface and API
|
|
2. **MongoDB**: NoSQL database for storing contact information
|
|
3. **Ingress Controller**: Manages external access to the services
|
|
4. **Load Balancer**: Distributes incoming traffic
|
|
|
|
## Key Features
|
|
|
|
- Responsive web interface
|
|
- RESTful API for contact management
|
|
- Persistent data storage using MongoDB with PersistentVolumeClaims
|
|
- Automatic HTTPS certificate provisioning
|
|
- Automatic application restart on failure
|
|
- Scalable architecture
|
|
|
|
## Deployment Files
|
|
|
|
The application includes the following configuration files:
|
|
|
|
- **Dockerfile**: Containerizes the Node.js application
|
|
- **k8s/**: Kubernetes configuration directory
|
|
- **app-deployment.yaml**: Deployment for the Node.js application
|
|
- **app-service.yaml**: Service for the Node.js application
|
|
- **contact-app-lb.yaml**: LoadBalancer service for obtaining external IP
|
|
- **ingress.yaml**: Template for Ingress configuration
|
|
- **mongo-deployment.yaml**: Deployment for MongoDB
|
|
- **mongo-service.yaml**: Service for MongoDB
|
|
- **mongo-pvc.yaml**: PersistentVolumeClaim for MongoDB data
|
|
- **namespace.yaml**: Namespace for application resources
|
|
|
|
## Deployment Scripts
|
|
|
|
### prepare-app.sh
|
|
|
|
This script handles the entire deployment process:
|
|
|
|
1. Builds and pushes the Docker image to Google Container Registry
|
|
2. Creates a GKE cluster if one doesn't exist
|
|
3. Deploys MongoDB with persistent storage
|
|
4. Deploys the Contact App application
|
|
5. Creates a LoadBalancer service to obtain an external IP
|
|
6. Configures Ingress with a dynamic domain using nip.io
|
|
7. Sets up HTTPS with Google-managed certificates
|
|
|
|
### remove-app.sh
|
|
|
|
This script removes all resources created by the application:
|
|
|
|
1. Deletes Ingress and certificates
|
|
2. Deletes application deployments and services
|
|
3. Deletes MongoDB deployment, service, and PVC
|
|
4. Removes the Kubernetes namespace
|
|
|
|
## Usage Instructions
|
|
|
|
### Prerequisites
|
|
|
|
1. Google Cloud Platform account with billing enabled
|
|
2. Google Cloud SDK installed and configured
|
|
3. kubectl installed
|
|
4. Docker installed
|
|
|
|
### Deployment
|
|
|
|
1. Clone the repository
|
|
2. Navigate to the project directory
|
|
3. Make the scripts executable:
|
|
```bash
|
|
chmod +x prepare-app.sh remove-app.sh |