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.
|
||||
- Developers and testers verify application functionality.
|
||||
- Failures do not affect real users.
|
||||
|
||||
### Production Environment
|
||||
|
||||
- Used by real users.
|
||||
- Contains live data.
|
||||
- High availability and stability are required.
|
||||
- Every deployment should be approved before release.
|
||||
- Safe for debugging.
|
||||
- Frequent deployments are allowed.
|
||||
|
||||
---
|
||||
|
||||
## 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.
|
||||
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.
|
||||
Characteristics:
|
||||
|
||||
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
|
||||
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:
|
||||
push:
|
||||
@@ -13,30 +13,22 @@ jobs:
|
||||
- name: Checkout Repository
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Log in to Ghaymah Container Registry
|
||||
- name: Login to Ghaymah Container Registry
|
||||
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
|
||||
run: |
|
||||
docker build -t ghaymah.systems/my-api:${{ github.sha }} .
|
||||
docker build -t registry.ghaymah.systems/my-api:${{ github.sha }} .
|
||||
|
||||
- name: Push Docker Image
|
||||
run: |
|
||||
docker push 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..."
|
||||
docker push registry.ghaymah.systems/my-api:${{ github.sha }}
|
||||
|
||||
deploy-production:
|
||||
needs: deploy-staging
|
||||
|
||||
needs: build
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
environment:
|
||||
@@ -45,4 +37,4 @@ jobs:
|
||||
steps:
|
||||
- name: Deploy to Production
|
||||
run: |
|
||||
echo "Deploying application to Production..."
|
||||
echo "Deploying application to production..."
|
||||
|
||||
المرجع في مشكلة جديدة
حظر مستخدم