[INIT-001] Initial project setup with Clean Architecture (feat)
Some checks failed
CD - Build & Deploy / build-and-push (push) Has been cancelled
CD - Build & Deploy / package-helm (push) Has been cancelled
CD - Build & Deploy / deploy-staging (push) Has been cancelled
CD - Build & Deploy / deploy-production (push) Has been cancelled
CD - Build & Deploy / release (push) Has been cancelled
CI / test (3.11) (push) Has been cancelled
CI / test (3.12) (push) Has been cancelled
CI / security (push) Has been cancelled
Some checks failed
CD - Build & Deploy / build-and-push (push) Has been cancelled
CD - Build & Deploy / package-helm (push) Has been cancelled
CD - Build & Deploy / deploy-staging (push) Has been cancelled
CD - Build & Deploy / deploy-production (push) Has been cancelled
CD - Build & Deploy / release (push) Has been cancelled
CI / test (3.11) (push) Has been cancelled
CI / test (3.12) (push) Has been cancelled
CI / security (push) Has been cancelled
- Implemented Clean Architecture with Domain, Application, Infrastructure, Presentation layers - Added comprehensive project structure following SOLID principles - Created Kubernetes deployment with Helm charts (HPA, PDB, NetworkPolicy) - Configured ArgoCD for automated deployment (production + staging) - Implemented CI/CD pipeline with GitHub Actions - Added comprehensive documentation (handbook, architecture, coding standards) - Configured PostgreSQL, Redis, Celery for backend services - Created modern landing page with Persian fonts (Vazirmatn) - Added Docker multi-stage build for production - Configured development tools (pytest, black, flake8, mypy, isort) - Added pre-commit hooks for code quality - Implemented Makefile for common operations
This commit is contained in:
154
argocd/README.md
Normal file
154
argocd/README.md
Normal file
@@ -0,0 +1,154 @@
|
||||
# ArgoCD Deployment
|
||||
|
||||
This directory contains ArgoCD Application manifests for deploying Peikarband to Kubernetes.
|
||||
|
||||
## Files
|
||||
|
||||
- `application.yaml`: Production deployment (main branch → peikarband namespace)
|
||||
- `application-staging.yaml`: Staging deployment (develop branch → peikarband-staging namespace)
|
||||
|
||||
## Prerequisites
|
||||
|
||||
1. ArgoCD installed in your cluster
|
||||
2. Git repository access configured in ArgoCD
|
||||
3. Docker registry credentials (if using private registry)
|
||||
|
||||
## Deployment
|
||||
|
||||
### 1. Add Git Repository to ArgoCD
|
||||
|
||||
```bash
|
||||
# For SSH
|
||||
argocd repo add git@git.peikarband.ir:ehsan-minadd/peikarband.git \
|
||||
--ssh-private-key-path ~/.ssh/id_rsa \
|
||||
--insecure-skip-server-verification
|
||||
|
||||
# Or using argocd UI: Settings → Repositories → Connect Repo
|
||||
```
|
||||
|
||||
### 2. Deploy Production
|
||||
|
||||
```bash
|
||||
kubectl apply -f argocd/application.yaml
|
||||
```
|
||||
|
||||
### 3. Deploy Staging
|
||||
|
||||
```bash
|
||||
kubectl apply -f argocd/application-staging.yaml
|
||||
```
|
||||
|
||||
## Sync Policy
|
||||
|
||||
Both applications use **automatic sync** with:
|
||||
- **Auto-prune**: Remove resources deleted from Git
|
||||
- **Self-heal**: Automatically sync when cluster state differs from Git
|
||||
- **Retry logic**: 5 attempts with exponential backoff
|
||||
|
||||
## Monitoring
|
||||
|
||||
```bash
|
||||
# Check application status
|
||||
argocd app get peikarband
|
||||
argocd app get peikarband-staging
|
||||
|
||||
# Watch sync progress
|
||||
argocd app sync peikarband --watch
|
||||
|
||||
# View logs
|
||||
argocd app logs peikarband
|
||||
```
|
||||
|
||||
## Manual Sync
|
||||
|
||||
```bash
|
||||
# Force sync
|
||||
argocd app sync peikarband --force
|
||||
|
||||
# Sync with prune
|
||||
argocd app sync peikarband --prune
|
||||
```
|
||||
|
||||
## Rollback
|
||||
|
||||
```bash
|
||||
# List history
|
||||
argocd app history peikarband
|
||||
|
||||
# Rollback to specific revision
|
||||
argocd app rollback peikarband <REVISION>
|
||||
```
|
||||
|
||||
## Architecture
|
||||
|
||||
```
|
||||
┌─────────────────────────────────────────────────┐
|
||||
│ ArgoCD │
|
||||
│ ┌───────────────────┐ ┌──────────────────┐ │
|
||||
│ │ Production App │ │ Staging App │ │
|
||||
│ │ (main branch) │ │ (develop branch) │ │
|
||||
│ └─────────┬─────────┘ └────────┬─────────┘ │
|
||||
└────────────┼─────────────────────┼──────────────┘
|
||||
│ │
|
||||
▼ ▼
|
||||
┌────────────────┐ ┌─────────────────┐
|
||||
│ namespace: │ │ namespace: │
|
||||
│ peikarband │ │ peikarband-stg │
|
||||
└────────────────┘ └─────────────────┘
|
||||
```
|
||||
|
||||
## Environment Variables
|
||||
|
||||
Override via Helm values:
|
||||
|
||||
```yaml
|
||||
# In values-production.yaml or values-staging.yaml
|
||||
env:
|
||||
- name: DATABASE_URL
|
||||
value: "postgresql://..."
|
||||
- name: REDIS_URL
|
||||
value: "redis://..."
|
||||
```
|
||||
|
||||
## Secrets Management
|
||||
|
||||
Secrets should be managed outside Git:
|
||||
|
||||
```bash
|
||||
# Using kubectl
|
||||
kubectl create secret generic peikarband-secrets \
|
||||
--from-literal=database-password=xxx \
|
||||
--namespace=peikarband
|
||||
|
||||
# Or using Sealed Secrets, External Secrets Operator, etc.
|
||||
```
|
||||
|
||||
## Troubleshooting
|
||||
|
||||
### Application Out of Sync
|
||||
|
||||
```bash
|
||||
argocd app sync peikarband --force
|
||||
```
|
||||
|
||||
### Image Pull Errors
|
||||
|
||||
Check registry credentials:
|
||||
```bash
|
||||
kubectl get secret regcred -n peikarband -o yaml
|
||||
```
|
||||
|
||||
### Health Check Failing
|
||||
|
||||
View pod logs:
|
||||
```bash
|
||||
kubectl logs -n peikarband -l app=peikarband --tail=100
|
||||
```
|
||||
|
||||
### Helm Values Override Not Working
|
||||
|
||||
Verify values file path in Application manifest:
|
||||
```bash
|
||||
argocd app manifests peikarband | grep valueFiles
|
||||
```
|
||||
|
||||
Reference in New Issue
Block a user