Add CI/CD pipeline, architecture documentation, and monitoring application
- Created a GitHub Actions workflow for CI/CD to deploy to Ghyamah, including testing, building, and pushing Docker images. - Added architecture design document for handling 15,000 requests per second, detailing system components, capacity planning, and cold start strategies. - Introduced a Python-based uptime/latency/SSL monitor with a static dashboard, utilizing standard libraries only. - Included Dockerfile and entrypoint script for the monitoring application, ensuring it runs as a non-root user and handles process management. - Added a .dockerignore file to exclude unnecessary files from the Docker build context. - Created an HTML dashboard for visualizing monitoring metrics, including uptime, latency, and SSL certificate status.
هذا الالتزام موجود في:
28
Q1/monitor.sh
Executable file
28
Q1/monitor.sh
Executable file
@@ -0,0 +1,28 @@
|
||||
#!/bin/bash
|
||||
|
||||
API_URL=$1
|
||||
|
||||
echo "Starting monitor script..."
|
||||
echo "API URL: $API_URL"
|
||||
echo "------------------------------------------------"
|
||||
|
||||
while true; do
|
||||
HTTP_STATUS=$(curl -o /dev/null -s -w "%{http_code}" -m 5 "$API_URL")
|
||||
|
||||
if [ "$HTTP_STATUS" -eq 200 ]; then
|
||||
response=$(curl -s -m 5 "$API_URL")
|
||||
|
||||
status=$(echo "$response" | jq -r '.status' 2>/dev/null)
|
||||
if [ -n "$status" ] && [ "$status" != "null" ]; then
|
||||
echo "Status: $status | Response Time: ${response_time}ms"
|
||||
else
|
||||
echo "HTTP 200 OK, but invalid JSON format received."
|
||||
fi
|
||||
elif [ "$HTTP_STATUS" -eq 000 ]; then
|
||||
echo "Application is Offline or unreachable (Timeout)."
|
||||
else
|
||||
echo "Application is unhealthy. HTTP Status: $HTTP_STATUS"
|
||||
fi
|
||||
|
||||
sleep 30
|
||||
done
|
||||
المرجع في مشكلة جديدة
حظر مستخدم