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.
هذا الالتزام موجود في:
2026-07-27 23:08:39 +03:00
الأصل c3368b9124
التزام 439a31ba93
16 ملفات معدلة مع 1753 إضافات و0 حذوفات

149
Q3-CICD/README.md Normal file
عرض الملف

@@ -0,0 +1,149 @@
# Ghaymah CLI Integration & Environment Strategy
This document outlines the deployment environment strategy and provides comprehensive documentation for installing, configuring, and authenticating with the **Ghaymah Command Line Interface (CLI)**.
---
# Table of Contents
- [Environment Strategy](#environment-strategy)
- [Staging Environment](#staging-environment)
- [Production Environment](#production-environment)
- [Ghaymah CLI](#ghaymah-cli)
- [Prerequisites](#prerequisites)
- [Installation](#installation)
- [Authentication](#authentication)
- [Core Commands](#core-commands)
---
# Environment Strategy
To ensure reliable deployments and stable software releases, Ghaymah uses separate environments for testing and production workloads.
| Feature | Staging | Production |
|----------|----------|------------|
| **Purpose** | Final testing, QA, and integration validation. Mirrors production configuration as closely as possible. | Live customer-facing environment with maximum stability and availability. |
| **Users** | Developers, QA engineers, and internal stakeholders. | End users and customers. |
| **Data** | Mock, seeded, or anonymized datasets. | Real production data. |
| **Deployment** | Automatic deployment after merging into the staging branch (Continuous Deployment). | Manual approval with version tracking (release tags or commit SHA). |
| **Resources** | Lower CPU and memory allocation to reduce infrastructure costs. | High availability, load balancing, monitoring, and autoscaling. |
---
# Ghaymah CLI
The **Ghaymah CLI** allows developers and CI/CD pipelines to interact with the platform directly from the terminal.
It can be used to:
- Authenticate with the platform
- Manage applications
- Deploy services
- View running applications
- Integrate deployments into CI/CD workflows
---
## Prerequisites
Before using the CLI, you must generate a **Personal Access Token**.
1. Log in to the **Ghaymah Web Console**.
2. Navigate to:
```
Account Settings
└── Developer Settings
```
3. Generate a new **Personal Access Token**.
4. Copy the token immediately.
> **Note**
>
> The token is displayed only once. Store it securely.
---
## Installation
### Linux (Debian/Ubuntu/Linux Mint)
Install the CLI using:
```bash
curl -sL https://cli.ghaymah.systems/install.sh | sudo bash
```
Verify the installation:
```bash
ghaymah --version
```
---
## Authentication
For local development or automated CI/CD pipelines, authenticate using your Personal Access Token.
### Step 1 — Export the Token
```bash
export GHAYMAH_TOKEN="your_personal_access_token_here"
```
### Step 2 — Login
```bash
ghaymah login --token "$GHAYMAH_TOKEN"
```
If authentication succeeds, the CLI is ready to use.
---
# Core Commands
## List Applications
Display all deployed applications and their current health status.
```bash
ghaymah apps list
```
Example output:
```text
NAME STATUS REGION
frontend Running eu-central
backend Running eu-central
database Running eu-central
```
---
## Check CLI Version
```bash
ghaymah --version
```
---
## Display Help
```bash
ghaymah --help
```
---
# Environment Summary
| Environment | Deployment | Data | Approval |
|-------------|------------|------|----------|
| **Staging** | Automatic | Test/Mock | Not Required |
| **Production** | Manual | Live | Required |

112
Q3-CICD/workflow.yml Normal file
عرض الملف

@@ -0,0 +1,112 @@
name: CI/CD Pipeline to Ghyamah
on:
push:
branches:
- main
pull_request:
branches:
- main
env:
GHYAMAH_REGISTRY: app.gitpasha.com
GHYAMAH_USERNAME: ${{ github.actor }}
ImageName: ${{ env.GHYAMAH_USERNAME }}/my-app
jobs:
###############################
# Test App Code Job
#################################
test:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Set up Node.js
uses: actions/setup-node@v3
with:
node-version: '16'
- name: Install dependencies
run: npm install
- name: Run tests
run: npm test
- name: Build project
run: npm run build
########################################
# build and push docker image to ghyamah registry
########################################
BuildAndPush:
runs-on: ubuntu-latest
needs: test
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Log in to Ghyamah Docker registry
uses: docker/login-action@v2
with:
registry: ${{ env.GHYAMAH_REGISTRY }}
username: ${{ env.GHYAMAH_USERNAME }}
password: ${{ secrets.GHYAMAH_PASSWORD }}
- name: Build and Push Docker Image
uses: docker/build-push-action@v5
with:
context: .
push: true
tags: |
${{ env.GHYAMAH_REGISTRY }}/${{ env.ImageName }}:${{ github.sha }}
${{ env.GHYAMAH_REGISTRY }}/${{ env.ImageName }}:latest
#################################
# Deploy to Staging and Production Jobs
#################################
deploy-staging:
runs-on: ubuntu-latest
needs: BuildAndPush
steps:
- name: Install Ghyamah CLI
run: |
curl -sSL https://get.ghaymah.systems/cli/install.sh | sh
echo "$HOME/.ghaymah/bin" >> $GITHUB_PATH
- name: Log in to Ghyamah
run: |
ghyamah login --username ${{ env.GHYAMAH_USERNAME }} --password ${{ secrets.GHYAMAH_PASSWORD }}
- name: Deploy to Staging
env:
GHYAMAH_TOKEN: ${{ secrets.GHYAMAH_PASSWORD }}
run: |
ghayamah app update my-staging-app --image ${{ env.GHYAMAH_REGISTRY }}/${{ env.ImageName }}:latest
#######################################
# Deploy to Production Job with Manual Approval
#######################################
deploy-production:
runs-on: ubuntu-latest
needs: BuildAndPush
steps:
- name: Wait for Manual Approval
uses: trstringer/manual-approval@v1
with:
secret: ${{ secrets.GHYAMAH_PASSWORD }}
issue-title: "Approval Required for Deployment to Production"
issue-body: "Please review the changes and approve the deployment to production."
- name: Install Ghyamah CLI
run: |
curl -sSL https://get.ghaymah.systems/cli/install.sh | sh
echo "$HOME/.ghaymah/bin" >> $GITHUB_PATH
- name: Log in to Ghyamah
run: |
ghyamah login --username ${{ env.GHYAMAH_USERNAME }} --password ${{ secrets.GHYAMAH_PASSWORD }}
- name: Deploy to Production
env:
GHYAMAH_TOKEN: ${{ secrets.GHYAMAH_PASSWORD }}
run: |
ghayamah app update my-production-app --image ${{ env.GHYAMAH_REGISTRY }}/${{ env.ImageName }}:latest