Ghaymah Cloud Container Deployment & Monitoring
A lightweight, production-ready Go REST API deployed on ghaymah.systems containers platform, featuring an automated Bash health monitoring daemon and a modern web-based SRE monitoring dashboard.
📌 Project Overview
This repository fulfills the SRE Container Deployment and Monitoring technical requirements:
- REST API Service (
app/main.go): Built in Go, offering/,/health, and/metricsendpoints with CORS enabled. - Containerization (
app/Dockerfile): Optimized multi-stage Docker build utilizing Alpine Linux and running under a non-root security context. - Cloud Deployment: Deployed on
ghaymah.systemscontainer platform at:- Live Health Endpoint:
https://gheyma-app-2b88268529f9.hosted.ghaymah.systems/health - Live Metrics Endpoint:
https://gheyma-app-2b88268529f9.hosted.ghaymah.systems/metrics
- Live Health Endpoint:
- Automated Monitoring Daemon (
health-check.sh): Bash script executing periodic health probes every 30 seconds, measuring response time, HTTP status, and logging results tomonitor.log. - SRE Live Dashboard (
dashboard/): Single-page frontend dashboard built with HTML, CSS, and Vanilla JavaScript displaying live service health status, real-time latency graphs, total API request counts, and uptime timeline.
🏗️ Architecture & Directory Structure
.
├── app/ # Application backend files
│ ├── main.go # Go API server source code
│ ├── go.mod # Go module specification
│ ├── Dockerfile # Multi-stage Dockerfile for Go API
│ └── .dockerignore # Docker ignore rules
├── dashboard/ # Monitoring Web Dashboard
│ ├── Dockerfile # Nginx Dockerfile for static frontend serving
│ ├── index.html # Main dashboard UI structure
│ ├── style.css # Custom styling (dark mode, glassmorphism, animations)
│ └── script.js # Frontend engine (live polling, canvas rendering, state tracking)
├── health-check.sh # Bash health check monitoring script (every 30s)
├── monitor.log # Output log generated by monitoring script
└── README.md # Project documentation
1. Go API Server (app/main.go)
- Endpoints:
GET /: Returns welcome payload{"message": "Hello, World!"}and increments request counter.GET /health: Returns service health status{"status": "healthy"}and increments request counter.GET /metrics: Exposes internal request metrics{"requests": <count>}without incrementing counter.
- CORS Support: Implements
Access-Control-Allow-Origin: *to enable browser-based dashboard monitoring across domains.
2. Multi-Stage Dockerfile (app/Dockerfile)
- Build Stage: Compiles the Go application binary using
golang:1.26-alpine. - Runtime Stage: Executes inside lightweight
alpine:3.20. - Security Context: Creates and executes under an unprivileged
appuser(non-root). - Port Exposure: Exposes port
8080.
3. Monitoring Script (health-check.sh)
- Probe Frequency: Every 30 seconds (
INTERVAL=30). - Target URL:
https://gheyma-app-2b88268529f9.hosted.ghaymah.systems/health. - Metrics Collected: HTTP Status Code and total response execution time (seconds).
- Log Format:
YYYY-MM-DD HH:MM:SS - STATUS_LEVEL - Detailsappended tomonitor.log.
4. Live SRE Dashboard (dashboard/)
- KPI Metrics:
- Service Status: Visual indicator (Healthy / Unhealthy).
- Response Time: Real-time round-trip latency in milliseconds + history canvas chart.
- Total Requests: Fetched live from
/metrics.
- Features:
- Auto-refresh interval (15s) with manual refresh option.
- Success ratio doughnut chart and interactive check timeline.
- Primary cloud endpoint monitoring with local fallback capability.
🚀 Getting Started & Local Usage
Running the API Server Locally
# Navigate to app directory and run Go service
cd app
go run main.go
The server will start listening on http://localhost:8080.
Building & Running with Docker
# Build the Docker image from root directory
docker build -t ghaymah-api-service ./app
# Run the container
docker run -d -p 8080:8080 --name ghaymah-api ghaymah-api-service
Running the Monitoring Script
# Grant execution permissions (Linux/macOS/Git Bash)
chmod +x health-check.sh
# Run the monitoring daemon
./health-check.sh
Viewing the Monitoring Dashboard
You can serve the dashboard/ directory using Nginx, Docker, or any static file server:
# Using Docker (Nginx)
cd dashboard
docker build -t ghaymah-dashboard .
docker run -d -p 80:80 ghaymah-dashboard
Or open dashboard/index.html directly in your web browser.
🔍 Verification & Health Checks
Verify the live cloud application using curl:
# Health endpoint check
curl -i https://gheyma-app-2b88268529f9.hosted.ghaymah.systems/health
# Expected output:
# HTTP/1.1 200 OK
# Content-Type: application/json
# {"status":"healthy"}
# Metrics endpoint check
curl -i https://gheyma-app-2b88268529f9.hosted.ghaymah.systems/metrics
# Expected output:
# HTTP/1.1 200 OK
# Content-Type: application/json
# {"requests":53}