[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

- 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:
Ehsan.Asadi
2025-12-26 15:52:50 +03:30
commit 8a924f6091
135 changed files with 8637 additions and 0 deletions

154
argocd/README.md Normal file
View 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
```

View File

@@ -0,0 +1,47 @@
apiVersion: argoproj.io/v1alpha1
kind: Application
metadata:
name: peikarband-staging
namespace: argocd
finalizers:
- resources-finalizer.argocd.argoproj.io
spec:
project: default
source:
repoURL: git@git.peikarband.ir:ehsan-minadd/peikarband.git
targetRevision: develop
path: helm/peikarband
helm:
releaseName: peikarband-staging
valueFiles:
- values-staging.yaml
destination:
server: https://kubernetes.default.svc
namespace: peikarband-staging
syncPolicy:
automated:
prune: true
selfHeal: true
allowEmpty: false
syncOptions:
- CreateNamespace=true
- PrunePropagationPolicy=foreground
- PruneLast=true
retry:
limit: 5
backoff:
duration: 5s
factor: 2
maxDuration: 3m
revisionHistoryLimit: 10
ignoreDifferences:
- group: apps
kind: Deployment
jsonPointers:
- /spec/replicas

47
argocd/application.yaml Normal file
View File

@@ -0,0 +1,47 @@
apiVersion: argoproj.io/v1alpha1
kind: Application
metadata:
name: peikarband
namespace: argocd
finalizers:
- resources-finalizer.argocd.argoproj.io
spec:
project: default
source:
repoURL: git@git.peikarband.ir:ehsan-minadd/peikarband.git
targetRevision: HEAD
path: helm/peikarband
helm:
releaseName: peikarband
valueFiles:
- values-production.yaml
destination:
server: https://kubernetes.default.svc
namespace: peikarband
syncPolicy:
automated:
prune: true
selfHeal: true
allowEmpty: false
syncOptions:
- CreateNamespace=true
- PrunePropagationPolicy=foreground
- PruneLast=true
retry:
limit: 5
backoff:
duration: 5s
factor: 2
maxDuration: 3m
revisionHistoryLimit: 10
ignoreDifferences:
- group: apps
kind: Deployment
jsonPointers:
- /spec/replicas