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.
هذا الالتزام موجود في:
40
Q5/Dockerfile
Normal file
40
Q5/Dockerfile
Normal file
@@ -0,0 +1,40 @@
|
||||
# syntax=docker/dockerfile:1
|
||||
|
||||
FROM python:3.12-alpine
|
||||
|
||||
# Standard-library only — no requirements.txt needed. ca-certificates is
|
||||
# required so ssl.create_default_context() can validate the target's
|
||||
# certificate chain when checking SSL expiry.
|
||||
RUN apk add --no-cache ca-certificates && update-ca-certificates
|
||||
|
||||
# Run as a non-root user
|
||||
RUN addgroup -S monitor && adduser -S monitor -G monitor
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
COPY monitor.py /app/monitor.py
|
||||
COPY Entrypoint.sh /app/entrypoint.sh
|
||||
COPY index.html /app/web/index.html
|
||||
|
||||
RUN chmod +x /app/entrypoint.sh \
|
||||
&& mkdir -p /app/web/data \
|
||||
&& chown -R monitor:monitor /app
|
||||
|
||||
USER monitor
|
||||
|
||||
# Defaults — override any of these at `docker run` / platform deploy time.
|
||||
ENV TARGET_URL="https://mithal.space" \
|
||||
SEARCH_PATH="/search?q=test" \
|
||||
CHECK_INTERVAL=60 \
|
||||
RETENTION_HOURS=24 \
|
||||
REQUEST_TIMEOUT=10 \
|
||||
DATA_FILE="/app/web/data/metrics.json" \
|
||||
WEB_DIR="/app/web" \
|
||||
PORT=8080
|
||||
|
||||
EXPOSE 8080
|
||||
|
||||
HEALTHCHECK --interval=30s --timeout=5s --start-period=15s --retries=3 \
|
||||
CMD python3 -c "import urllib.request,sys; sys.exit(0) if urllib.request.urlopen('http://127.0.0.1:${PORT}/', timeout=3).status==200 else sys.exit(1)"
|
||||
|
||||
ENTRYPOINT ["/app/entrypoint.sh"]
|
||||
المرجع في مشكلة جديدة
حظر مستخدم