154 أسطر
2.6 KiB
Markdown
154 أسطر
2.6 KiB
Markdown
# Staging vs Production
|
|
|
|
## Staging Environment
|
|
|
|
The **staging** environment is a pre-production environment used for testing and validation before releasing changes to real users.
|
|
|
|
### Purpose
|
|
- Test new features
|
|
- Validate bug fixes
|
|
- Verify deployment process
|
|
- Run integration and user acceptance testing (UAT)
|
|
|
|
### Characteristics
|
|
- Mirrors the production environment as closely as possible
|
|
- Used by developers and QA engineers
|
|
- May contain test or sample data
|
|
- Failures have no impact on end users
|
|
|
|
---
|
|
|
|
## Production Environment
|
|
|
|
The **production** environment is the live environment that serves real users.
|
|
|
|
### Purpose
|
|
- Deliver the application to customers
|
|
- Provide stable and reliable service
|
|
|
|
### Characteristics
|
|
- Used by real users
|
|
- Contains production data
|
|
- Requires high availability and monitoring
|
|
- Deployments should be carefully reviewed and approved
|
|
|
|
---
|
|
|
|
## Comparison
|
|
|
|
| Feature | Staging | Production |
|
|
|---------|---------|------------|
|
|
| Users | Developers / QA | End Users |
|
|
| Data | Test Data | Production Data |
|
|
| Purpose | Testing & Validation | Live Service |
|
|
| Stability | Medium | High |
|
|
| Manual Approval | Optional | Recommended |
|
|
|
|
---
|
|
|
|
# Connecting to Ghaymah CLI
|
|
|
|
## Prerequisites
|
|
|
|
- Ghaymah Cloud account
|
|
- GitHub repository
|
|
- Dockerfile
|
|
- `.ghaymah.json` configuration file
|
|
|
|
---
|
|
|
|
## Step 1: Install Ghaymah CLI
|
|
|
|
```bash
|
|
curl -sSL https://cli.ghaymah.systems/install.sh | bash
|
|
```
|
|
|
|
---
|
|
|
|
## Step 2: Authenticate
|
|
|
|
```bash
|
|
$HOME/ghaymah/bin/gy auth login \
|
|
--email "YOUR_EMAIL" \
|
|
--password "YOUR_PASSWORD"
|
|
```
|
|
|
|
For GitHub Actions, store these credentials as repository secrets:
|
|
|
|
- `GHAYMAH_EMAIL`
|
|
- `GHAYMAH_PW`
|
|
|
|
---
|
|
|
|
## Step 3: Create `.ghaymah.json`
|
|
|
|
Example:
|
|
|
|
```json
|
|
{
|
|
"id": "<application-id>",
|
|
"projectId": "<project-id>",
|
|
"dockerFileName": "Dockerfile",
|
|
"resourceTier": "t1"
|
|
}
|
|
```
|
|
|
|
---
|
|
|
|
## Step 4: Deploy the Application
|
|
|
|
```bash
|
|
$HOME/ghaymah/bin/gy resource app launch
|
|
```
|
|
|
|
This command automatically:
|
|
|
|
1. Reads the `.ghaymah.json` configuration.
|
|
2. Builds the Docker image from the project's Dockerfile.
|
|
3. Pushes the image to Ghaymah Cloud's internal Container Registry.
|
|
4. Deploys the application.
|
|
|
|
---
|
|
|
|
## Step 5: Monitor Deployment
|
|
|
|
Deployment status can be checked using:
|
|
|
|
- GitHub Actions logs
|
|
- Ghaymah Dashboard
|
|
- Ghaymah CLI logs
|
|
|
|
Example:
|
|
|
|
```bash
|
|
gy app logs
|
|
```
|
|
|
|
---
|
|
|
|
## Deployment Workflow
|
|
|
|
```
|
|
Developer
|
|
│
|
|
▼
|
|
GitHub Actions
|
|
│
|
|
▼
|
|
Install Ghaymah CLI
|
|
│
|
|
▼
|
|
Authenticate
|
|
│
|
|
▼
|
|
Build Docker Image
|
|
│
|
|
▼
|
|
Push to Ghaymah Container Registry
|
|
│
|
|
▼
|
|
Deploy Application
|
|
│
|
|
▼
|
|
Application Running
|
|
``` |