Files
peikarband/deploy/argocd/README.md
Ehsan.Asadi 6820f0ee4f refactor: reorganize project structure for better maintainability
- Move Docker files to build/docker/
- Move CI/CD configs to build/ci/
- Move deployment configs to deploy/ (helm, k8s, argocd)
- Move config files to config/
- Move scripts to tools/
- Consolidate assets to assets/ (Reflex compatible)
- Add data/ directory for local data (gitignored)
- Update all path references in Makefile, Dockerfile, CI configs
- Add comprehensive README files for build/ and deploy/
- Update project documentation

Benefits:
- Clear separation of concerns
- Cleaner root directory
- Better developer experience
- Enterprise-grade structure
- Improved maintainability
2025-12-30 21:20:32 +03:30

155 lines
3.7 KiB
Markdown

# 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 HTTPS with token
argocd repo add https://git.peikarband.ir/ehsan-minadd/peikarband.git \
--username YOUR_USERNAME \
--password YOUR_ACCESS_TOKEN
# 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
```