Complete Q3: CI/CD Pipeline
هذا الالتزام موجود في:
@@ -1,43 +1,74 @@
|
|||||||
# CI/CD Documentation
|
# CI/CD Pipeline Documentation
|
||||||
|
|
||||||
## Staging vs Production
|
## 1. Staging Environment
|
||||||
|
|
||||||
### Staging Environment
|
The staging environment is used to test new application versions before releasing them to users.
|
||||||
|
|
||||||
- Used for testing new releases before production.
|
Characteristics:
|
||||||
|
|
||||||
|
- Used by developers and testers.
|
||||||
- Contains test data.
|
- Contains test data.
|
||||||
- Developers and testers verify application functionality.
|
- Safe for debugging.
|
||||||
- Failures do not affect real users.
|
- Frequent deployments are allowed.
|
||||||
|
|
||||||
### Production Environment
|
|
||||||
|
|
||||||
- Used by real users.
|
|
||||||
- Contains live data.
|
|
||||||
- High availability and stability are required.
|
|
||||||
- Every deployment should be approved before release.
|
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
## Ghaymah CLI Integration
|
## 2. Production Environment
|
||||||
|
|
||||||
Example deployment workflow:
|
The production environment is the live environment used by real users.
|
||||||
|
|
||||||
1. Install the Ghaymah CLI.
|
Characteristics:
|
||||||
2. Authenticate using your account credentials.
|
|
||||||
3. Login to the Ghaymah Container Registry.
|
|
||||||
4. Push the Docker image.
|
|
||||||
5. Deploy the latest image to the production environment.
|
|
||||||
|
|
||||||
Example commands:
|
- Contains real user data.
|
||||||
|
- High availability is required.
|
||||||
|
- Stable and secure.
|
||||||
|
- Every deployment requires manual approval.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 3. Staging vs Production
|
||||||
|
|
||||||
|
| Staging | Production |
|
||||||
|
|----------|------------|
|
||||||
|
| Testing environment | Live environment |
|
||||||
|
| Test data | Real data |
|
||||||
|
| Developers/Testers | End users |
|
||||||
|
| Frequent changes | Controlled releases |
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 4. Ghaymah CLI Integration
|
||||||
|
|
||||||
|
Example deployment steps:
|
||||||
|
|
||||||
|
### Login
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
ghaymah login
|
ghaymah login
|
||||||
|
|
||||||
ghaymah registry login
|
|
||||||
|
|
||||||
docker push ghaymah.systems/my-api:latest
|
|
||||||
|
|
||||||
ghaymah deploy
|
|
||||||
```
|
```
|
||||||
|
|
||||||
> Note: The exact commands may vary depending on the installed version of the Ghaymah CLI.
|
### Login to Container Registry
|
||||||
|
|
||||||
|
```bash
|
||||||
|
ghaymah registry login
|
||||||
|
```
|
||||||
|
|
||||||
|
### Build Docker Image
|
||||||
|
|
||||||
|
```bash
|
||||||
|
docker build -t my-api .
|
||||||
|
```
|
||||||
|
|
||||||
|
### Push Docker Image
|
||||||
|
|
||||||
|
```bash
|
||||||
|
docker push registry.ghaymah.systems/my-api:latest
|
||||||
|
```
|
||||||
|
|
||||||
|
### Deploy Application
|
||||||
|
|
||||||
|
```bash
|
||||||
|
ghaymah deploy my-api
|
||||||
|
```
|
||||||
|
|
||||||
|
> Note: The exact CLI commands may vary depending on the installed version of the Ghaymah CLI.
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
name: Build and Deploy
|
name: Build and Deploy Docker Image
|
||||||
|
|
||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
@@ -15,28 +15,20 @@ jobs:
|
|||||||
|
|
||||||
- name: Login to Ghaymah Container Registry
|
- name: Login to Ghaymah Container Registry
|
||||||
run: |
|
run: |
|
||||||
echo "${{ secrets.GHAYMAH_TOKEN }}" | docker login ghaymah.systems -u ${{ secrets.GHAYMAH_USERNAME }} --password-stdin
|
echo "${{ secrets.GHAYMAH_PASSWORD }}" | docker login registry.ghaymah.systems \
|
||||||
|
-u "${{ secrets.GHAYMAH_USERNAME }}" \
|
||||||
|
--password-stdin
|
||||||
|
|
||||||
- name: Build Docker Image
|
- name: Build Docker Image
|
||||||
run: |
|
run: |
|
||||||
docker build -t ghaymah.systems/my-api:${{ github.sha }} .
|
docker build -t registry.ghaymah.systems/my-api:${{ github.sha }} .
|
||||||
|
|
||||||
- name: Push Docker Image
|
- name: Push Docker Image
|
||||||
run: |
|
run: |
|
||||||
docker push ghaymah.systems/my-api:${{ github.sha }}
|
docker push registry.ghaymah.systems/my-api:${{ github.sha }}
|
||||||
|
|
||||||
deploy-staging:
|
|
||||||
needs: build
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
|
|
||||||
steps:
|
|
||||||
- name: Deploy to Staging
|
|
||||||
run: |
|
|
||||||
echo "Deploying application to Staging environment..."
|
|
||||||
|
|
||||||
deploy-production:
|
deploy-production:
|
||||||
needs: deploy-staging
|
needs: build
|
||||||
|
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
environment:
|
environment:
|
||||||
@@ -45,4 +37,4 @@ jobs:
|
|||||||
steps:
|
steps:
|
||||||
- name: Deploy to Production
|
- name: Deploy to Production
|
||||||
run: |
|
run: |
|
||||||
echo "Deploying application to Production..."
|
echo "Deploying application to production..."
|
||||||
|
|||||||
المرجع في مشكلة جديدة
حظر مستخدم