diff --git a/.gitignore b/.gitignore index a704dd2..03f8355 100644 --- a/.gitignore +++ b/.gitignore @@ -27,7 +27,7 @@ env/ ENV/ # Local data directory -data/ +peikarband/data/ # Reflex .web/ diff --git a/build/ci/woodpecker.yml b/.woodpecker.yml similarity index 95% rename from build/ci/woodpecker.yml rename to .woodpecker.yml index 9424bc7..023965e 100644 --- a/build/ci/woodpecker.yml +++ b/.woodpecker.yml @@ -16,8 +16,8 @@ pipeline: - latest - ${CI_COMMIT_SHA:0:8} - dockerfile: build/docker/Dockerfile - context: . + dockerfile: docker/Dockerfile + context: peikarband/ platforms: linux/amd64 build_args: diff --git a/Makefile b/Makefile index b58541c..ec73638 100644 --- a/Makefile +++ b/Makefile @@ -44,7 +44,7 @@ install: pre-commit install dev: - python3 -m reflex run + cd peikarband && python3 -m reflex run kill-dev: @echo "Killing processes on ports 3000 and 8000..." @@ -78,12 +78,12 @@ clean: # Docker commands docker-build: DOCKER_BUILDKIT=$(DOCKER_BUILDKIT) docker build \ - -f build/docker/Dockerfile \ + -f docker/Dockerfile \ -t $(IMAGE_NAME):$(VERSION) \ -t $(IMAGE_NAME):latest \ --build-arg VERSION=$(VERSION) \ --build-arg BUILD_DATE=$(shell date -u +'%Y-%m-%dT%H:%M:%SZ') \ - . + peikarband/ docker-push: docker tag $(IMAGE_NAME):$(VERSION) $(REGISTRY)/$(IMAGE_NAME):$(VERSION) @@ -96,23 +96,23 @@ docker-login: @docker login $(REGISTRY) docker-up: - docker-compose -f build/docker/docker-compose.yml up -d + docker-compose -f docker/docker-compose.yml up -d docker-down: - docker-compose -f build/docker/docker-compose.yml down + docker-compose -f docker/docker-compose.yml down # Helm commands helm-lint: - helm lint deploy/helm/peikarband + helm lint helm/peikarband helm-template: - helm template $(HELM_RELEASE) deploy/helm/peikarband --debug + helm template $(HELM_RELEASE) helm/peikarband --debug helm-package: - helm package deploy/helm/peikarband --destination . + helm package helm/peikarband --destination . helm-install: - helm install $(HELM_RELEASE) deploy/helm/peikarband \ + helm install $(HELM_RELEASE) helm/peikarband \ --namespace $(NAMESPACE) \ --create-namespace \ --set image.repository=$(REGISTRY)/$(IMAGE_NAME) \ @@ -120,7 +120,7 @@ helm-install: --wait helm-upgrade: - helm upgrade --install $(HELM_RELEASE) deploy/helm/peikarband \ + helm upgrade --install $(HELM_RELEASE) helm/peikarband \ --namespace $(NAMESPACE) \ --set image.repository=$(REGISTRY)/$(IMAGE_NAME) \ --set image.tag=$(VERSION) \ @@ -136,8 +136,8 @@ k8s-deploy: docker-build docker-push helm-upgrade # Database migrate: - alembic -c config/alembic.ini upgrade head + cd peikarband && alembic -c config/alembic.ini upgrade head seed: - python3 tools/scripts/seed_database.py + cd peikarband && python3 tools/scripts/seed_database.py diff --git a/README.md b/README.md index 8e9c333..3820bff 100644 --- a/README.md +++ b/README.md @@ -1,222 +1,43 @@ -# پیکربند - پلتفرم جامع مدیریت هاستینگ و زیرساخت ابری +# Peikarband Landing Platform -## 📖 درباره پروژه +یک پلتفرم حرفه‌ای برای مدیریت هاستینگ، سرورهای ابری و خدمات DevOps. -پیکربند یک پلتفرم حرفه‌ای برای مدیریت هاستینگ، سرورهای ابری، دامین و خدمات DevOps است. این پلتفرم با الهام از سرویس‌هایی مانند Cloudways، DigitalOcean و پارس پک طراحی شده است. +## ساختار پروژه -## 🏗️ معماری - -این پروژه بر اساس **Clean Architecture** و اصول **SOLID** طراحی شده است: - -- **Domain Layer**: منطق کسب‌وکار اصلی -- **Application Layer**: موارد استفاده (Use Cases) -- **Infrastructure Layer**: پیاده‌سازی‌های فنی -- **Presentation Layer**: رابط کاربری (Reflex) - -## 🚀 تکنولوژی‌ها - -- **Frontend/Backend**: Python Reflex -- **Database**: PostgreSQL + SQLAlchemy -- **Cache**: Redis -- **Task Queue**: Celery -- **Testing**: pytest -- **Code Quality**: black, flake8, mypy, isort - -## 📋 پیش‌نیازها - -- Python 3.11+ -- PostgreSQL 14+ -- Redis 7+ -- Node.js 18+ (برای Reflex) - -## 🛠️ نصب و راه‌اندازی - -### 1. کلون کردن پروژه - -```bash -git clone https://github.com/yourusername/peikarband.git -cd peikarband +``` +landing/ +├── Makefile # Build و deployment commands +├── .gitignore +├── .woodpecker.yml # CI/CD pipeline +│ +├── helm/ # Kubernetes deployment +│ └── peikarband/ +│ +├── docker/ # Docker build configs +│ ├── Dockerfile +│ └── docker-compose.yml +│ +└── peikarband/ # Source code و مستندات + ├── README.md # مستندات کامل + ├── src/ # Application code + ├── tests/ # Tests + └── ... ``` -### 2. ایجاد محیط مجازی +## دستورات سریع ```bash -python -m venv venv -source venv/bin/activate # On Windows: venv\Scripts\activate -``` - -### 3. نصب وابستگی‌ها - -```bash -pip install -r requirements.txt -pip install -r requirements-dev.txt # برای توسعه -``` - -### 4. تنظیم Environment Variables - -```bash -cp .env.example .env -# ویرایش .env و تکمیل مقادیر -``` - -### 5. راه‌اندازی دیتابیس - -```bash -# ایجاد دیتابیس -createdb peikarband - -# اجرای migrations -alembic upgrade head -``` - -### 6. اجرای پروژه - -```bash -# توسعه -python -m reflex run - -# یا +# Development make dev + +# Docker build +make docker-build + +# Helm deploy +make helm-upgrade + +# برای اطلاعات بیشتر +cd peikarband/ +cat README.md ``` -## 🚢 Deployment - -### با Docker - -```bash -# Build -docker build -t peikarband:latest . - -# Run -docker-compose up -d -``` - -### با Kubernetes/Helm - -```bash -# Deploy -helm upgrade --install peikarband ./deploy/helm/peikarband \ - --namespace production \ - --set image.tag=0.1.0 - -# یا -make k8s-deploy -``` - -📖 [راهنمای کامل Deployment](docs/deployment/kubernetes.md) - -## 📁 ساختار پروژه - -``` -peikarband-landing/ -├── build/ # Build configs (Docker, CI/CD) -├── deploy/ # Deployment configs (Helm, K8s, ArgoCD) -├── config/ # Configuration files -├── tools/ # Scripts و ابزارها -├── assets/ # Static assets -├── src/ # Source code (Clean Architecture) -│ ├── config/ # تنظیمات -│ ├── core/ # هسته اصلی (Domain + Application) -│ ├── infrastructure/ # پیاده‌سازی‌های فنی -│ ├── presentation/ # رابط کاربری (Reflex) -│ └── shared/ # کدهای مشترک -├── tests/ # تست‌ها -├── docs/ # مستندات کامل -└── data/ # Local data (gitignored) -``` - -📖 [ساختار کامل پروژه](docs/PROJECT_STRUCTURE.md) - -## 🧪 تست - -```bash -# اجرای همه تست‌ها -pytest - -# با coverage -pytest --cov=src tests/ - -# تست‌های خاص -pytest tests/unit/ -pytest tests/integration/ -``` - -## 📝 کدنویسی - -### استانداردها - -- **PEP 8**: استاندارد کدنویسی Python -- **PEP 20**: Zen of Python -- **Type Hints**: همه جا استفاده شود -- **Docstrings**: Google Style - -### ابزارهای کیفیت کد - -```bash -# Format -black src/ - -# Linting -flake8 src/ - -# Type checking -mypy src/ - -# Import sorting -isort src/ -``` - -### Pre-commit Hooks - -```bash -pre-commit install -pre-commit run --all-files -``` - -## 📚 مستندات - -مستندات کامل در پوشه `docs/` موجود است: - -- [Handbook](docs/handbook.md): راهنمای جامع پروژه -- [Architecture](docs/architecture/): معماری سیستم -- [Development](docs/development/): راهنمای توسعه -- [API Reference](docs/api/): مستندات API - -## 🔐 امنیت - -- همه پسوردها با bcrypt hash می‌شوند -- استفاده از JWT برای authentication -- پشتیبانی از 2FA -- اطلاعات حساس رمزنگاری می‌شوند - -## 🤝 مشارکت - -برای مشارکت در پروژه: - -1. Fork کنید -2. Branch جدید بسازید (`git checkout -b feature/amazing-feature`) -3. Commit کنید (`git commit -m 'feat: add amazing feature'`) -4. Push کنید (`git push origin feature/amazing-feature`) -5. Pull Request بسازید - -## 📄 لایسنس - -این پروژه تحت لایسنس MIT منتشر شده است. - -## 👥 تیم - -- Lead Developer: [Your Name] -- Architecture: Clean Architecture -- Methodology: Agile/Scrum - -## 📞 تماس - -- Website: https://peikarband.ir -- Email: support@peikarband.ir -- Telegram: @peikarband - ---- - -**نسخه**: 0.1.0 -**آخرین بروزرسانی**: 2025-01-24 - diff --git a/banner-3.gif b/banner-3.gif deleted file mode 100644 index 93c2f3f..0000000 Binary files a/banner-3.gif and /dev/null differ diff --git a/deploy/README.md b/deploy/README.md deleted file mode 100644 index 7d69f76..0000000 --- a/deploy/README.md +++ /dev/null @@ -1,226 +0,0 @@ -# Deploy Directory - -این دایرکتوری شامل همه فایل‌های مربوط به **deployment** پروژه است. - -## 📁 ساختار - -``` -deploy/ -├── helm/ # Helm charts -│ └── peikarband/ -│ ├── Chart.yaml # Chart metadata -│ ├── values.yaml # Default values -│ ├── values-production.yaml -│ ├── values-staging.yaml -│ └── templates/ # K8s resource templates -├── kubernetes/ # Raw K8s manifests -│ └── secrets-template.yaml -└── argocd/ # ArgoCD GitOps - ├── application.yaml - ├── application-staging.yaml - └── README.md -``` - -## ⚓ Helm Charts - -### نصب با Helm - -**Staging:** -```bash -helm upgrade --install peikarband ./deploy/helm/peikarband \ - --namespace staging \ - --values deploy/helm/peikarband/values-staging.yaml \ - --create-namespace -``` - -**Production:** -```bash -helm upgrade --install peikarband ./deploy/helm/peikarband \ - --namespace production \ - --values deploy/helm/peikarband/values-production.yaml \ - --create-namespace -``` - -**یا استفاده از Makefile:** -```bash -make helm-upgrade NAMESPACE=production -``` - -### Values Files - -- **`values.yaml`**: Default values (برای development) -- **`values-staging.yaml`**: Staging overrides -- **`values-production.yaml`**: Production overrides - -**مهم‌ترین تنظیمات:** -```yaml -image: - repository: hub.peikarband.ir/peikarband/landing - tag: "latest" - -resources: - requests: - cpu: 500m - memory: 512Mi - limits: - cpu: 1000m - memory: 1Gi - -autoscaling: - enabled: true - minReplicas: 2 - maxReplicas: 10 -``` - -## ☸️ Kubernetes Manifests - -### Secrets -Template برای secrets: -```bash -kubectl create secret generic peikarband-secrets \ - --from-file=deploy/kubernetes/secrets-template.yaml \ - --namespace production -``` - -## 🔄 ArgoCD GitOps - -### Setup ArgoCD Application - -**Staging:** -```bash -kubectl apply -f deploy/argocd/application-staging.yaml -``` - -**Production:** -```bash -kubectl apply -f deploy/argocd/application.yaml -``` - -### Sync Policy -- **Auto-sync**: Enabled برای staging -- **Manual sync**: Required برای production - -### مانیتورینگ -```bash -argocd app get peikarband -argocd app sync peikarband -argocd app logs peikarband -``` - -## 🎯 Deployment Flow - -```mermaid -graph LR - A[Code Push] --> B[CI Build] - B --> C[Push Image] - C --> D{Environment} - D -->|Staging| E[ArgoCD Auto-Sync] - D -->|Production| F[Manual ArgoCD Sync] - E --> G[Deploy] - F --> G -``` - -### Staging Deployment -1. Push به branch `main` -2. CI builds & pushes image -3. ArgoCD auto-sync -4. Rolling update - -### Production Deployment -1. Tag release (e.g., `v1.0.0`) -2. CI builds & pushes image با tag -3. Update `values-production.yaml` با tag جدید -4. Manual ArgoCD sync یا `make helm-upgrade` -5. Rolling update با health checks - -## 🔍 Troubleshooting - -### Check Pod Status -```bash -kubectl get pods -n production -kubectl logs -f deployment/peikarband -n production -kubectl describe pod -n production -``` - -### Check Helm Release -```bash -helm list -n production -helm status peikarband -n production -helm history peikarband -n production -``` - -### Rollback -```bash -helm rollback peikarband -n production -# یا -kubectl rollout undo deployment/peikarband -n production -``` - -## 📊 Monitoring & Observability - -### Health Checks -- **Liveness**: `/ping` endpoint -- **Readiness**: `/health` endpoint -- **Startup**: 60s timeout - -### Metrics -- Prometheus metrics exposed on `/metrics` -- Grafana dashboards -- Alert rules - -### Logs -- Centralized logging with Loki -- Log aggregation -- Search & filtering - -## 🔐 Security - -### Secrets Management -- Kubernetes Secrets -- Sealed Secrets (recommended) -- External Secrets Operator - -### Network Policies -- Ingress rules defined -- Egress restrictions -- Service mesh (optional) - -### RBAC -- ServiceAccount per namespace -- Minimal permissions -- Pod Security Standards - -## 🎯 Best Practices - -1. **Versioning** - - Semantic versioning - - Tag images با versions - - Lock Helm chart versions - -2. **Resources** - - Set requests & limits - - Monitor usage - - Right-size pods - -3. **Autoscaling** - - HPA based on CPU/memory - - VPA for recommendations - - Cluster autoscaling - -4. **High Availability** - - Multiple replicas (min 2) - - Pod disruption budgets - - Anti-affinity rules - -5. **Updates** - - Rolling updates - - Health checks - - Gradual rollout - -## 📚 مستندات بیشتر - -- [Deployment Checklist](../docs/deployment/DEPLOYMENT_CHECKLIST.md) -- [Production Deployment Guide](../docs/deployment/PRODUCTION_DEPLOYMENT.md) -- [Quick Start](../docs/deployment/DEPLOYMENT_QUICK_START.md) -- [Kubernetes Guide](../docs/deployment/kubernetes.md) - diff --git a/deploy/argocd/README.md b/deploy/argocd/README.md deleted file mode 100644 index d5a25a2..0000000 --- a/deploy/argocd/README.md +++ /dev/null @@ -1,154 +0,0 @@ -# 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 -``` - -## 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 -``` - diff --git a/deploy/argocd/application-staging.yaml b/deploy/argocd/application-staging.yaml deleted file mode 100644 index 4b91852..0000000 --- a/deploy/argocd/application-staging.yaml +++ /dev/null @@ -1,58 +0,0 @@ -apiVersion: argoproj.io/v1alpha1 -kind: Application -metadata: - name: peikarband-staging - namespace: argocd - annotations: - notifications.argoproj.io/subscribe.on-deployed.telegram: "" - notifications.argoproj.io/subscribe.on-sync-failed.telegram: "" - finalizers: - - resources-finalizer.argocd.argoproj.io - labels: - app: peikarband - environment: staging -spec: - project: default - - source: - repoURL: https://git.peikarband.ir/ehsan-minadd/peikarband.git - targetRevision: develop - path: helm/peikarband - helm: - releaseName: peikarband-staging - valueFiles: - - values-staging.yaml - parameters: - - name: image.repository - value: harbor.peikarband.ir/peikarband/landing - - name: image.tag - value: develop - - 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 - diff --git a/deploy/argocd/application.yaml b/deploy/argocd/application.yaml deleted file mode 100644 index e2cc564..0000000 --- a/deploy/argocd/application.yaml +++ /dev/null @@ -1,64 +0,0 @@ -apiVersion: argoproj.io/v1alpha1 -kind: Application -metadata: - name: peikarband - namespace: argocd - annotations: - notifications.argoproj.io/subscribe.on-deployed.telegram: "" - notifications.argoproj.io/subscribe.on-health-degraded.telegram: "" - notifications.argoproj.io/subscribe.on-sync-failed.telegram: "" - finalizers: - - resources-finalizer.argocd.argoproj.io - labels: - app: peikarband - environment: production -spec: - project: default - - source: - repoURL: https://git.peikarband.ir/ehsan-minadd/peikarband.git - targetRevision: main - path: helm/peikarband - helm: - releaseName: peikarband - valueFiles: - - values-production.yaml - parameters: - - name: image.repository - value: harbor.peikarband.ir/peikarband/landing - - name: image.tag - value: latest # This will be updated by CI/CD - - destination: - server: https://kubernetes.default.svc - namespace: peikarband - - syncPolicy: - automated: - prune: true - selfHeal: true - allowEmpty: false - syncOptions: - - CreateNamespace=true - - PrunePropagationPolicy=foreground - - PruneLast=true - - ApplyOutOfSyncOnly=true - retry: - limit: 5 - backoff: - duration: 5s - factor: 2 - maxDuration: 3m - - revisionHistoryLimit: 10 - - ignoreDifferences: - - group: apps - kind: Deployment - jsonPointers: - - /spec/replicas - - group: apps - kind: StatefulSet - jsonPointers: - - /spec/replicas - diff --git a/deploy/helm/peikarband/.helmignore b/deploy/helm/peikarband/.helmignore deleted file mode 100644 index 898df48..0000000 --- a/deploy/helm/peikarband/.helmignore +++ /dev/null @@ -1,24 +0,0 @@ -# Patterns to ignore when building packages. -# This supports shell glob matching, relative path matching, and -# negation (prefixed with !). Only one pattern per line. -.DS_Store -# Common VCS dirs -.git/ -.gitignore -.bzr/ -.bzrignore -.hg/ -.hgignore -.svn/ -# Common backup files -*.swp -*.bak -*.tmp -*.orig -*~ -# Various IDEs -.project -.idea/ -*.tmproj -.vscode/ - diff --git a/build/docker/Dockerfile b/docker/Dockerfile similarity index 84% rename from build/docker/Dockerfile rename to docker/Dockerfile index 9b8ca68..8b0bbc5 100644 --- a/build/docker/Dockerfile +++ b/docker/Dockerfile @@ -39,7 +39,12 @@ RUN apt-get update && apt-get install -y --no-install-recommends \ # Install Node.js (required for Reflex) RUN curl -fsSL https://deb.nodesource.com/setup_${NODE_VERSION}.x | bash - \ && apt-get install -y --no-install-recommends nodejs \ - && rm -rf /var/lib/apt/lists/* + && rm -rf /var/lib/apt/lists/* \ + && npm config set fetch-retry-mintimeout 20000 \ + && npm config set fetch-retry-maxtimeout 120000 \ + && npm config set fetch-retries 5 \ + && npm config set fetch-timeout 300000 \ + && npm config set registry https://registry.npmjs.org/ # Install bun (required by Reflex for frontend build) # Retry mechanism for network issues @@ -65,8 +70,22 @@ COPY --chown=root:root . . # Build and export Reflex app for production # Note: API_URL will be updated at runtime from environment variable # Export creates .web directory with frontend static files -# bun is now pre-installed, so reflex export won't try to download it -RUN python -m reflex export --no-zip +# Retry mechanism for network issues +RUN set -ex && \ + echo "Starting Reflex export (attempt 1)..." && \ + python -m reflex export --no-zip --loglevel debug || \ + (echo "Attempt 1 failed, cleaning cache..." && \ + npm cache clean --force && \ + rm -rf node_modules .web && \ + sleep 15 && \ + echo "Retrying (attempt 2)..." && \ + python -m reflex export --no-zip --loglevel debug) || \ + (echo "Attempt 2 failed, final retry..." && \ + npm cache clean --force && \ + rm -rf node_modules .web && \ + sleep 20 && \ + echo "Final attempt (3)..." && \ + python -m reflex export --no-zip --loglevel debug) # Aggressive cleanup to reduce layer size # NOTE: Keep .web directory - it contains frontend static files @@ -129,7 +148,8 @@ COPY --from=builder /root/.local /home/peikarband/.local # Copy application code from builder COPY --from=builder /build /app -# Copy and set up runtime script +# Copy and set up runtime script +# Context is peikarband/, so paths are relative to that COPY --chown=peikarband:peikarband tools/scripts/update-env-json.sh /app/tools/scripts/update-env-json.sh RUN chmod +x /app/tools/scripts/update-env-json.sh diff --git a/build/docker/Dockerfile.base b/docker/Dockerfile.base similarity index 100% rename from build/docker/Dockerfile.base rename to docker/Dockerfile.base diff --git a/build/README.md b/docker/README.md similarity index 100% rename from build/README.md rename to docker/README.md diff --git a/build/docker/docker-compose.yml b/docker/docker-compose.yml similarity index 100% rename from build/docker/docker-compose.yml rename to docker/docker-compose.yml diff --git a/docs/deployment/CHANGELOG-DEPLOYMENT.md b/docs/deployment/CHANGELOG-DEPLOYMENT.md deleted file mode 100644 index 76667c3..0000000 --- a/docs/deployment/CHANGELOG-DEPLOYMENT.md +++ /dev/null @@ -1,239 +0,0 @@ -# Changelog - Production Deployment Setup - -تمام تغییرات مربوط به آماده‌سازی دیپلوی Production در این فایل ثبت می‌شود. - -## [1.0.0] - 2025-12-26 - ApprovalToken:PROD-001 - -### ✅ Added - -#### CI/CD Pipeline -- **woodpecker.yml**: پایپلاین کامل CI/CD با 11 stage - - Linting (Python & YAML) - - Unit & Integration Tests - - Security Scanning (Safety, Bandit, Trivy, Trufflehog) - - Docker Build & Push - - Helm Validation - - Database Migration Check - - Automated Deployment (Staging & Production) - - Post-Deployment Verification - - Notifications (Telegram & Slack) - -#### Docker & Registry -- **.dockerignore**: بهینه‌سازی Docker build با exclude کردن فایل‌های غیرضروری -- **Dockerfile** (بهبود یافته): - - Multi-stage build برای کاهش حجم image - - Security hardening (non-root user, tini init, minimal runtime) - - Build arguments برای versioning - - Health checks بهبود یافته - - Labels و metadata کامل - -#### Kubernetes & Helm -- **k8s/secrets-template.yaml**: Template کامل برای Kubernetes secrets - - Harbor registry credentials - - Application secrets (DB, Redis, JWT, etc.) - - External provider credentials - - CI/CD secrets - - مثال‌های External Secrets Operator - -#### Configuration Files -- **.env.example**: Template کامل environment variables (200+ configs) - - Application settings - - Database & Redis - - Security & JWT - - Cloud providers (DigitalOcean, Hetzner, OVH) - - Payment gateways (Zarinpal, IDPay) - - Notification services (Email, SMS, Telegram) - - Monitoring & logging - - Feature flags - -- **.yamllint.yml**: پیکربندی YAML linter برای validation - -#### Health Checks -- **src/presentation/api/routes/health.py**: Endpoints کامل health checking - - `/ping`: Basic health check - - `/health`: Detailed health with dependencies - - `/ready`: Readiness probe برای Kubernetes - - `/live`: Liveness probe - - `/metrics`: Basic metrics endpoint - -#### Documentation -- **docs/deployment/PRODUCTION_DEPLOYMENT.md**: راهنمای کامل 50+ صفحه‌ای - - تنظیمات Harbor Registry - - پیکربندی Kubernetes - - راه‌اندازی ArgoCD - - تنظیمات Woodpecker CI - - مراحل دیپلوی اولیه - - مانیتورینگ و logging - - عیب‌یابی مشکلات متداول - -- **DEPLOYMENT_QUICK_START.md**: راهنمای سریع 10 دقیقه‌ای - - Setup سریع در 5 مرحله - - Checklist production-ready - - دستورات مفید - - Pipeline flow diagram - -### 🔄 Modified - -#### Build & Deploy -- **Makefile**: آپدیت برای Harbor registry - - تغییر REGISTRY به `harbor.peikarband.ir` - - اضافه شدن DOCKER_BUILDKIT flag - - بهبود docker-build با build arguments - - اضافه شدن docker-login command - -#### Helm Charts -- **helm/peikarband/values.yaml**: - - آپدیت image repository به Harbor - - اضافه شدن imagePullSecrets - -#### ArgoCD Applications -- **argocd/application.yaml** (Production): - - اضافه شدن annotations برای notifications - - اضافه شدن labels - - تعیین targetRevision به `main` - - اضافه شدن Helm parameters برای image - - بهبود syncOptions - -- **argocd/application-staging.yaml** (Staging): - - اضافه شدن annotations و labels - - targetRevision: `develop` - - Helm parameters برای staging - -### 🏗️ Infrastructure Changes - -#### Registry Strategy -- **Before**: `registry.example.com` -- **After**: `harbor.peikarband.ir/peikarband/landing` -- **Authentication**: Robot account با محدودیت دسترسی - -#### Deployment Strategy -- **GitOps**: ArgoCD برای automated sync -- **CI/CD**: Woodpecker برای build و test -- **Environments**: - - Production: `main` branch → `peikarband.ir` - - Staging: `develop` branch → `staging.peikarband.ir` - -#### Security Improvements -- Image scanning با Trivy -- Secret scanning با Trufflehog -- Dependency scanning با Safety -- Code security با Bandit -- Non-root containers -- Network policies enabled -- Pod security contexts configured - -### 📊 Pipeline Metrics - -- **Total Stages**: 11 -- **Estimated Time**: 10-15 minutes -- **Parallelization**: Services (PostgreSQL, Redis) -- **Matrix Build**: Multi-arch support (amd64, arm64) - -### 🔐 Security Checklist - -- [x] Non-root user در Docker -- [x] Image vulnerability scanning -- [x] Secret management با Kubernetes -- [x] TLS/SSL با cert-manager -- [x] Network policies -- [x] Resource limits -- [x] Pod security contexts -- [x] Image pull secrets - -### 📝 Configuration Files Summary - -| File | Purpose | Status | -|------|---------|--------| -| woodpecker.yml | CI/CD Pipeline | ✅ Created | -| .dockerignore | Build optimization | ✅ Created | -| .env.example | Config template | ✅ Created | -| .yamllint.yml | YAML validation | ✅ Created | -| Dockerfile | Container image | ✅ Enhanced | -| Makefile | Build commands | ✅ Updated | -| k8s/secrets-template.yaml | K8s secrets | ✅ Created | -| argocd/application.yaml | Production GitOps | ✅ Updated | -| argocd/application-staging.yaml | Staging GitOps | ✅ Updated | -| helm/peikarband/values.yaml | Helm values | ✅ Updated | - -### 🎯 Prerequisites for Production - -1. **Kubernetes Cluster** - - Version: 1.24+ - - Nodes: 3+ workers - - Resources: 6 CPU cores, 6GB RAM minimum - -2. **External Services** - - Harbor Registry - - ArgoCD - - Woodpecker CI - - PostgreSQL 14+ - - Redis 7+ - -3. **DNS Configuration** - - peikarband.ir - - staging.peikarband.ir - - harbor.peikarband.ir - - argocd.peikarband.ir - -4. **Secrets Required** - - Harbor robot account - - Database credentials - - Redis password - - JWT secrets - - Cloud provider tokens - - Payment gateway keys - - Notification service tokens - -### 🚀 Deployment Steps - -1. Setup Harbor registry and create robot account -2. Create Kubernetes secrets -3. Install and configure ArgoCD -4. Configure Woodpecker CI secrets -5. Push code to trigger pipeline -6. Verify deployment with health checks - -### 📚 Documentation Structure - -``` -docs/ -├── deployment/ -│ ├── PRODUCTION_DEPLOYMENT.md (50+ pages, complete guide) -│ └── kubernetes.md (existing) -├── DEPLOYMENT_QUICK_START.md (Quick reference) -└── CHANGELOG-DEPLOYMENT.md (This file) -``` - -### 🔗 References - -- Harbor: https://goharbor.io -- ArgoCD: https://argo-cd.readthedocs.io -- Woodpecker: https://woodpecker-ci.org -- Kubernetes: https://kubernetes.io - -### ⚠️ Breaking Changes - -- Image repository path changed from `registry.example.com` to `harbor.peikarband.ir` -- Harbor authentication required -- Kubernetes secrets must be created before deployment -- Environment variables significantly expanded - -### 🎉 Impact - -این تغییرات پروژه را **کاملاً آماده برای دیپلوی Production** می‌کند با: -- ✅ Automated CI/CD pipeline -- ✅ Security scanning -- ✅ GitOps deployment -- ✅ Health monitoring -- ✅ Comprehensive documentation -- ✅ Production-grade Docker images -- ✅ Scalability support -- ✅ High availability configuration - ---- - -**Approved By**: #اکسپت ApprovalToken:PROD-001 -**Implementation Date**: 2025-12-26 -**Status**: ✅ Complete -**Next Steps**: Follow DEPLOYMENT_QUICK_START.md for deployment - diff --git a/docs/deployment/DEPLOYMENT_CHECKLIST.md b/docs/deployment/DEPLOYMENT_CHECKLIST.md deleted file mode 100644 index 7a8376e..0000000 --- a/docs/deployment/DEPLOYMENT_CHECKLIST.md +++ /dev/null @@ -1,451 +0,0 @@ -# ✅ Deployment Readiness Checklist - Peikarband - -تاریخ بررسی: 2025-12-27 -وضعیت: **READY FOR DEPLOYMENT** 🚀 - ---- - -## 📊 خلاصه بررسی - -| Category | Status | Details | -|----------|--------|---------| -| Assets & Static Files | ✅ FIXED | `.dockerignore` اصلاح شد | -| Health Endpoints | ✅ FIXED | Endpoints متصل شدند | -| Dependencies | ✅ COMPLETE | `psutil` اضافه شد | -| Docker Build | ✅ READY | Multi-stage build optimized | -| CI/CD Pipeline | ✅ READY | Woodpecker configured | -| Kubernetes | ✅ READY | Helm charts + ArgoCD | -| Documentation | ✅ COMPLETE | راهنماهای کامل | - ---- - -## 🔧 مشکلات برطرف شده - -### 1️⃣ Assets در Docker Image (CRITICAL) ✅ - -**مشکل**: فایل‌های استاتیک (logo.png, banner-3.gif, custom.css) در `.dockerignore` exclude شده بودند. - -**راه‌حل**: -```diff -# Before -*.gif -*.png -*.svg -!assets/logo.png - -# After -# Keep assets directory -!assets/ -!src/presentation/web/assets/ -``` - -**تاثیر**: بدون این تغییر، صفحه landing بدون تصاویر نمایش داده می‌شد. - ---- - -### 2️⃣ psutil Dependency (MEDIUM) ✅ - -**مشکل**: `psutil` برای metrics endpoint نیاز بود ولی در `requirements.txt` نبود. - -**راه‌حل**: اضافه شد به requirements: -```python -psutil==5.9.6 -``` - -**تاثیر**: بدون این، `/metrics` endpoint crash می‌کرد. - ---- - -### 3️⃣ Health Endpoints Integration (MEDIUM) ✅ - -**مشکل**: Health check endpoints تعریف شده بودند ولی به Reflex app متصل نبودند. - -**راه‌حل**: `peikarband/peikarband.py` اصلاح شد: -```python -@rx.page(route="/ping") -def ping(): - data = ping_endpoint() - return rx.box(rx.text(str(data))) - -# + /health, /ready, /live -``` - -**تاثیر**: Kubernetes probes حالا کار می‌کنند. - ---- - -## ✅ تایید شده - -### Assets & Static Files ✅ -- ✅ `/logo.png` - در navbar -- ✅ `/banner-3.gif` - در hero section -- ✅ `/custom.css` - استایل‌های سفارشی -- ✅ `assets/` directory شامل می‌شود -- ✅ `src/presentation/web/assets/` شامل می‌شود - -### Reflex Configuration ✅ -- ✅ `rxconfig.py` صحیح است -- ✅ Stylesheets (Vazirmatn, Inter) لود می‌شوند -- ✅ Ports: Frontend 3000, Backend 8000 - -### Docker Build ✅ -- ✅ Multi-stage build (Builder + Runtime) -- ✅ Non-root user (peikarband:1000) -- ✅ Security hardening (tini, minimal runtime) -- ✅ Health checks configured -- ✅ Labels و metadata کامل -- ✅ BuildKit enabled - -### Dependencies ✅ -**Core:** -- ✅ reflex==0.4.0 -- ✅ sqlalchemy==2.0.23 -- ✅ psycopg2-binary==2.9.9 -- ✅ redis==5.0.1 -- ✅ psutil==5.9.6 ⭐ (اضافه شد) - -**Security:** -- ✅ pyjwt==2.8.0 -- ✅ cryptography==41.0.7 -- ✅ passlib[bcrypt]==1.7.4 - -**Monitoring:** -- ✅ sentry-sdk==1.38.0 -- ✅ prometheus-client==0.19.0 -- ✅ structlog==23.2.0 - -### Health Checks ✅ -- ✅ `/ping` - Basic health check -- ✅ `/health` - Detailed with dependencies -- ✅ `/ready` - Readiness probe -- ✅ `/live` - Liveness probe -- ✅ `/metrics` - System metrics (با psutil) - -### Woodpecker CI Pipeline ✅ -**Active Stages:** -- ✅ Lint (Python + YAML) -- ✅ Docker Build -- ✅ Helm Validation -- ✅ Migration Check -- ✅ ArgoCD Deployment -- ✅ Health Verification -- ✅ Notifications - -**Temporarily Disabled** (برای سرعت اولیه): -- ⏸️ Unit Tests (commented) -- ⏸️ Integration Tests (commented) -- ⏸️ Security Scans (commented) - -**توصیه**: بعد از اولین deploy موفق، uncomment کنید. - -### Harbor Registry ✅ -- ✅ URL: `harbor.peikarband.ir` -- ✅ Project: `peikarband` -- ✅ Image pull secrets configured -- ✅ Makefile updated - -### Kubernetes & Helm ✅ -- ✅ Helm chart validated -- ✅ values.yaml با Harbor registry -- ✅ values-production.yaml configured -- ✅ Resource limits defined -- ✅ HPA enabled (2-20 replicas) -- ✅ PDB enabled -- ✅ Network policies configured - -### ArgoCD ✅ -- ✅ Production app: `argocd/application.yaml` -- ✅ Staging app: `argocd/application-staging.yaml` -- ✅ Auto-sync enabled -- ✅ Notifications configured -- ✅ Image parameters set - -### Documentation ✅ -- ✅ `PRODUCTION_DEPLOYMENT.md` (50+ pages) -- ✅ `DEPLOYMENT_QUICK_START.md` (10 minutes) -- ✅ `CHANGELOG-DEPLOYMENT.md` (complete history) -- ✅ This checklist - ---- - -## 🧪 Pre-Deployment Tests - -### Local Testing: -```bash -# 1. Install dependencies -pip install -r requirements.txt - -# 2. Run app locally -make dev -# OR -python3 -m reflex run - -# 3. Test endpoints -curl http://localhost:8000/ping -curl http://localhost:8000/health - -# 4. Kill processes -make kill-dev -``` - -### Docker Testing: -```bash -# 1. Build image -make docker-build - -# 2. Run container -docker run -p 3000:3000 -p 8000:8000 peikarband/landing:latest - -# 3. Test health -curl http://localhost:8000/ping - -# 4. Check logs -docker logs -``` - -### Helm Testing: -```bash -# 1. Lint chart -helm lint helm/peikarband - -# 2. Dry run -helm template peikarband helm/peikarband \ - --set image.tag=latest \ - --debug - -# 3. Validate -helm install peikarband helm/peikarband --dry-run -``` - ---- - -## 🚀 Deployment Steps - -### Quick Deploy (از commit تا production): - -1. **Push to Git** - ```bash - git add . - git commit -m "feat: production-ready deployment" - git push origin main - ``` - -2. **Woodpecker CI** (Automatic) - - ✅ Lint code - - ✅ Build Docker image - - ✅ Push to Harbor - - ✅ Update ArgoCD - - ⏱️ ~5-8 minutes - -3. **ArgoCD** (Automatic) - - ✅ Sync Helm chart - - ✅ Deploy to Kubernetes - - ✅ Rolling update - - ⏱️ ~2-3 minutes - -4. **Verify** - ```bash - # Check pods - kubectl get pods -n peikarband - - # Test endpoint - curl https://peikarband.ir/ping - - # Check ArgoCD - argocd app get peikarband - ``` - -**Total Time**: ~10 minutes از push تا production! 🎉 - ---- - -## ⚠️ Known Issues & Notes - -### 1. Tests Temporarily Disabled -تست‌ها در woodpecker.yml موقتاً comment شدند برای سرعت بیشتر. - -**برای فعال‌سازی**: -- Uncomment کردن test stages در `woodpecker.yml` -- اطمینان از PostgreSQL و Redis در CI environment - -### 2. Reflex Export در Dockerfile -```dockerfile -RUN python -m reflex init --template blank && \ - python -m reflex export --frontend-only --no-zip || true -``` - -`|| true` اضافه شده تا در صورت fail شدن export، build متوقف نشود. - -**نکته**: Reflex در runtime mode اجرا می‌شود، نه export mode. - -### 3. Database در Production -در حال حاضر از SQLite استفاده می‌شود. برای production: - -```bash -# Update rxconfig.py -db_url="postgresql://USER:PASS@HOST:5432/peikarband" - -# Run migrations -kubectl exec -it POD_NAME -n peikarband -- alembic upgrade head -``` - ---- - -## 📈 Performance Expectations - -### Resource Usage: -- **Memory**: 512MB - 1GB per pod -- **CPU**: 0.5 - 1 core per pod -- **Startup Time**: 30-60 seconds -- **Response Time**: < 200ms - -### Scaling: -- **Min Replicas**: 2 (production), 1 (staging) -- **Max Replicas**: 20 (production), 5 (staging) -- **Target CPU**: 60% (production), 70% (staging) - -### Availability: -- **SLA Target**: 99.9% uptime -- **RTO**: < 5 minutes (Recovery Time Objective) -- **RPO**: < 1 hour (Recovery Point Objective) - ---- - -## 🎯 Post-Deployment Tasks - -### Immediate (Day 1): -- [ ] Verify all endpoints responding -- [ ] Check logs for errors -- [ ] Monitor resource usage -- [ ] Test domain and SSL -- [ ] Verify database connectivity - -### Short-term (Week 1): -- [ ] Enable monitoring (Prometheus/Grafana) -- [ ] Set up alerting -- [ ] Configure backup strategy -- [ ] Enable security scans in CI -- [ ] Uncomment tests in pipeline -- [ ] Load testing - -### Long-term (Month 1): -- [ ] Performance optimization -- [ ] Cost optimization -- [ ] Disaster recovery testing -- [ ] Security audit -- [ ] Documentation updates - ---- - -## 🔐 Security Checklist - -- [x] Non-root containers -- [x] Image pull secrets configured -- [x] TLS/SSL ready (cert-manager) -- [x] Network policies enabled -- [x] Resource limits set -- [x] Pod security contexts -- [x] Secrets in Kubernetes -- [ ] Vulnerability scanning (enable after deploy) -- [ ] RBAC configured -- [ ] Audit logging enabled - ---- - -## 📚 Quick References - -### Essential Commands: -```bash -# Logs -kubectl logs -f deployment/peikarband -n peikarband - -# Scale -kubectl scale deployment peikarband --replicas=5 -n peikarband - -# Restart -kubectl rollout restart deployment/peikarband -n peikarband - -# Status -kubectl get all -n peikarband - -# Describe -kubectl describe deployment peikarband -n peikarband -``` - -### Troubleshooting: -- **Pod CrashLoopBackOff**: Check logs with `--previous` flag -- **ImagePullError**: Verify Harbor credentials -- **Ingress 404**: Check DNS and ingress configuration -- **Database Error**: Verify secrets and connectivity - ---- - -## ✅ Final Status - -``` -🎉 پروژه پیکربند آماده دیپلوی در Production است! - -✅ Assets: FIXED -✅ Dependencies: COMPLETE -✅ Health Checks: WORKING -✅ Docker: OPTIMIZED -✅ CI/CD: CONFIGURED -✅ Kubernetes: READY -✅ Documentation: COMPLETE - -📝 تغییرات اعمال شده: - 1. .dockerignore اصلاح شد (assets شامل می‌شوند) - 2. psutil به requirements اضافه شد - 3. Health endpoints به Reflex متصل شدند - 4. peikarband.py بروز شد - -🚀 آماده برای: git push origin main -``` - ---- - -**تایید شده توسط**: AI Code Review -**تاریخ**: 2025-12-27 -**نسخه**: 1.0.0 -**Status**: ✅ PRODUCTION READY - ---- - -## 🎁 Bonus - -### VS Code Tasks (اختیاری): -ایجاد فایل `.vscode/tasks.json`: - -```json -{ - "version": "2.0.0", - "tasks": [ - { - "label": "Dev Server", - "type": "shell", - "command": "make dev", - "problemMatcher": [] - }, - { - "label": "Kill Dev Server", - "type": "shell", - "command": "make kill-dev" - }, - { - "label": "Docker Build", - "type": "shell", - "command": "make docker-build" - }, - { - "label": "Test Health", - "type": "shell", - "command": "curl http://localhost:8000/ping" - } - ] -} -``` - ---- - -**Happy Deploying! 🚀🎉** - diff --git a/docs/deployment/DEPLOYMENT_QUICK_START.md b/docs/deployment/DEPLOYMENT_QUICK_START.md deleted file mode 100644 index db84762..0000000 --- a/docs/deployment/DEPLOYMENT_QUICK_START.md +++ /dev/null @@ -1,259 +0,0 @@ -# راهنمای سریع دیپلوی - Peikarband - -راهنمای سریع برای راه‌اندازی پروژه پیکربند در Production - -## 🚀 دیپلوی سریع در 10 دقیقه - -### 1️⃣ Harbor Registry Setup (2 دقیقه) - -```bash -# لاگین به Harbor -docker login harbor.peikarband.ir - -# ساخت project: peikarband -# ساخت robot account: deployer -``` - -### 2️⃣ Kubernetes Secrets (2 دقیقه) - -```bash -# Harbor pull secret -kubectl create secret docker-registry harbor-registry-secret \ - --docker-server=harbor.peikarband.ir \ - --docker-username=robot\$peikarband+deployer \ - --docker-password="YOUR_TOKEN" \ - --namespace=peikarband - -# Application secrets -kubectl create secret generic peikarband-prod-secrets \ - --from-literal=db-password=YOUR_DB_PASS \ - --from-literal=redis-password=YOUR_REDIS_PASS \ - --from-literal=secret-key=YOUR_SECRET_KEY \ - --from-literal=jwt-secret-key=YOUR_JWT_KEY \ - --namespace=peikarband -``` - -### 3️⃣ ArgoCD Setup (3 دقیقه) - -```bash -# نصب ArgoCD -kubectl create namespace argocd -kubectl apply -n argocd -f https://raw.githubusercontent.com/argoproj/argo-cd/stable/manifests/install.yaml - -# Deploy application -kubectl apply -f argocd/application.yaml - -# Sync -argocd app sync peikarband -``` - -### 4️⃣ Woodpecker CI Secrets (2 دقیقه) - -در Woodpecker UI یا با CLI: - -```bash -woodpecker-cli secret add --name harbor_username --value "robot\$peikarband+deployer" -woodpecker-cli secret add --name harbor_password --value "YOUR_TOKEN" -woodpecker-cli secret add --name argocd_server --value "argocd.peikarband.ir" -woodpecker-cli secret add --name argocd_token --value "YOUR_ARGOCD_TOKEN" -``` - -### 5️⃣ Push & Deploy (1 دقیقه) - -```bash -git add . -git commit -m "feat: production deployment setup" -git push origin main - -# Woodpecker به صورت خودکار: -# ✅ Tests را اجرا می‌کند -# ✅ Docker image را build می‌کند -# ✅ به Harbor push می‌کند -# ✅ ArgoCD را trigger می‌کند -# ✅ در Kubernetes deploy می‌شود -``` - ---- - -## 📋 Checklist قبل از Production - -### Infrastructure -- [ ] Kubernetes cluster آماده است (3+ nodes) -- [ ] Harbor registry نصب شده -- [ ] ArgoCD نصب شده -- [ ] Woodpecker CI پیکربندی شده -- [ ] cert-manager برای SSL نصب شده -- [ ] Ingress NGINX نصب شده - -### Database & Cache -- [ ] PostgreSQL در دسترس است -- [ ] Redis در دسترس است -- [ ] Backup strategy تعریف شده - -### DNS & SSL -- [ ] Domain به cluster اشاره می‌کند -- [ ] SSL certificate صادر شده (Let's Encrypt) -- [ ] HTTPS کار می‌کند - -### Secrets & Security -- [ ] Harbor robot account ساخته شده -- [ ] Kubernetes secrets ایجاد شده -- [ ] ArgoCD token ساخته شده -- [ ] Woodpecker secrets تنظیم شده - -### Monitoring -- [ ] Prometheus نصب شده (اختیاری) -- [ ] Grafana پیکربندی شده (اختیاری) -- [ ] Telegram/Slack notifications تنظیم شده - ---- - -## 🧪 تست سریع - -```bash -# Health check -curl https://peikarband.ir/ping -# Expected: {"status":"ok",...} - -# Kubernetes pods -kubectl get pods -n peikarband -# Expected: 3 pods در حالت Running - -# ArgoCD status -argocd app get peikarband -# Expected: Health Status: Healthy, Sync Status: Synced - -# Logs -kubectl logs -f deployment/peikarband -n peikarband -``` - ---- - -## 📊 CI/CD Pipeline Flow - -```mermaid -graph LR - A[Git Push] --> B[Woodpecker CI] - B --> C[Run Tests] - C --> D[Build Docker Image] - D --> E[Push to Harbor] - E --> F[Update ArgoCD] - F --> G[Deploy to K8s] - G --> H[Health Check] - H --> I[Notify Team] -``` - -### Pipeline Stages: - -1. **Lint & Test** (2-3 min) - - Python linting (flake8, black) - - Unit tests - - Integration tests - -2. **Security Scan** (1-2 min) - - Dependency vulnerabilities - - Secret scanning - - Code security analysis - -3. **Build & Push** (3-5 min) - - Docker build (multi-stage) - - Trivy security scan - - Push to Harbor - -4. **Deploy** (2-3 min) - - Update ArgoCD app - - Kubernetes rolling update - - Health verification - -**Total Pipeline Time**: ~10-15 minutes - ---- - -## 🔧 دستورات مفید - -### Development - -```bash -# Local development -make dev - -# Run tests -make test - -# Build Docker image -make docker-build - -# Push to Harbor -make docker-login -make docker-push -``` - -### Deployment - -```bash -# Full deploy -make k8s-deploy - -# Helm lint -make helm-lint - -# Helm upgrade -make helm-upgrade -``` - -### Monitoring - -```bash -# Watch pods -kubectl get pods -n peikarband -w - -# Tail logs -kubectl logs -f deployment/peikarband -n peikarband - -# Port forward to app -kubectl port-forward svc/peikarband -n peikarband 8000:8000 - -# Describe deployment -kubectl describe deployment peikarband -n peikarband -``` - -### Troubleshooting - -```bash -# Pod details -kubectl describe pod POD_NAME -n peikarband - -# Previous logs (if crashed) -kubectl logs POD_NAME -n peikarband --previous - -# Execute in pod -kubectl exec -it POD_NAME -n peikarband -- /bin/bash - -# Events -kubectl get events -n peikarband --sort-by='.lastTimestamp' -``` - ---- - -## 📞 Support - -- **Documentation**: [docs/deployment/PRODUCTION_DEPLOYMENT.md](docs/deployment/PRODUCTION_DEPLOYMENT.md) -- **Issues**: راهنمای کامل عیب‌یابی در مستندات -- **Team**: support@peikarband.ir - ---- - -## 🎯 Next Steps - -بعد از دیپلوی موفق: - -1. ✅ تنظیم monitoring و alerting -2. ✅ پیکربندی backup strategy -3. ✅ تست load testing -4. ✅ تنظیم CI/CD برای سایر برنچ‌ها -5. ✅ مستندسازی runbooks - ---- - -**Happy Deploying! 🚀** - diff --git a/helm/.helmignore b/helm/.helmignore deleted file mode 100644 index 898df48..0000000 --- a/helm/.helmignore +++ /dev/null @@ -1,24 +0,0 @@ -# Patterns to ignore when building packages. -# This supports shell glob matching, relative path matching, and -# negation (prefixed with !). Only one pattern per line. -.DS_Store -# Common VCS dirs -.git/ -.gitignore -.bzr/ -.bzrignore -.hg/ -.hgignore -.svn/ -# Common backup files -*.swp -*.bak -*.tmp -*.orig -*~ -# Various IDEs -.project -.idea/ -*.tmproj -.vscode/ - diff --git a/deploy/helm/peikarband/Chart.yaml b/helm/peikarband/Chart.yaml similarity index 100% rename from deploy/helm/peikarband/Chart.yaml rename to helm/peikarband/Chart.yaml diff --git a/deploy/helm/peikarband/README.md b/helm/peikarband/README.md similarity index 100% rename from deploy/helm/peikarband/README.md rename to helm/peikarband/README.md diff --git a/deploy/helm/peikarband/templates/NOTES.txt b/helm/peikarband/templates/NOTES.txt similarity index 100% rename from deploy/helm/peikarband/templates/NOTES.txt rename to helm/peikarband/templates/NOTES.txt diff --git a/deploy/helm/peikarband/templates/_helpers.tpl b/helm/peikarband/templates/_helpers.tpl similarity index 100% rename from deploy/helm/peikarband/templates/_helpers.tpl rename to helm/peikarband/templates/_helpers.tpl diff --git a/deploy/helm/peikarband/templates/configmap.yaml b/helm/peikarband/templates/configmap.yaml similarity index 100% rename from deploy/helm/peikarband/templates/configmap.yaml rename to helm/peikarband/templates/configmap.yaml diff --git a/deploy/helm/peikarband/templates/deployment.yaml b/helm/peikarband/templates/deployment.yaml similarity index 100% rename from deploy/helm/peikarband/templates/deployment.yaml rename to helm/peikarband/templates/deployment.yaml diff --git a/deploy/helm/peikarband/templates/docker-registry.yaml b/helm/peikarband/templates/docker-registry.yaml similarity index 100% rename from deploy/helm/peikarband/templates/docker-registry.yaml rename to helm/peikarband/templates/docker-registry.yaml diff --git a/deploy/helm/peikarband/templates/hpa.yaml b/helm/peikarband/templates/hpa.yaml similarity index 100% rename from deploy/helm/peikarband/templates/hpa.yaml rename to helm/peikarband/templates/hpa.yaml diff --git a/deploy/helm/peikarband/templates/ingress.yaml b/helm/peikarband/templates/ingress.yaml similarity index 100% rename from deploy/helm/peikarband/templates/ingress.yaml rename to helm/peikarband/templates/ingress.yaml diff --git a/deploy/helm/peikarband/templates/networkpolicy.yaml b/helm/peikarband/templates/networkpolicy.yaml similarity index 100% rename from deploy/helm/peikarband/templates/networkpolicy.yaml rename to helm/peikarband/templates/networkpolicy.yaml diff --git a/deploy/helm/peikarband/templates/pdb.yaml b/helm/peikarband/templates/pdb.yaml similarity index 100% rename from deploy/helm/peikarband/templates/pdb.yaml rename to helm/peikarband/templates/pdb.yaml diff --git a/deploy/helm/peikarband/templates/service.yaml b/helm/peikarband/templates/service.yaml similarity index 100% rename from deploy/helm/peikarband/templates/service.yaml rename to helm/peikarband/templates/service.yaml diff --git a/deploy/helm/peikarband/templates/serviceaccount.yaml b/helm/peikarband/templates/serviceaccount.yaml similarity index 100% rename from deploy/helm/peikarband/templates/serviceaccount.yaml rename to helm/peikarband/templates/serviceaccount.yaml diff --git a/deploy/helm/peikarband/values-production.yaml b/helm/peikarband/values-production.yaml similarity index 100% rename from deploy/helm/peikarband/values-production.yaml rename to helm/peikarband/values-production.yaml diff --git a/deploy/helm/peikarband/values-staging.yaml b/helm/peikarband/values-staging.yaml similarity index 100% rename from deploy/helm/peikarband/values-staging.yaml rename to helm/peikarband/values-staging.yaml diff --git a/deploy/helm/peikarband/values.yaml b/helm/peikarband/values.yaml similarity index 100% rename from deploy/helm/peikarband/values.yaml rename to helm/peikarband/values.yaml diff --git a/logo.png b/logo.png deleted file mode 100644 index b4cea4b..0000000 Binary files a/logo.png and /dev/null differ diff --git a/peikarband/README.md b/peikarband/README.md new file mode 100644 index 0000000..8e9c333 --- /dev/null +++ b/peikarband/README.md @@ -0,0 +1,222 @@ +# پیکربند - پلتفرم جامع مدیریت هاستینگ و زیرساخت ابری + +## 📖 درباره پروژه + +پیکربند یک پلتفرم حرفه‌ای برای مدیریت هاستینگ، سرورهای ابری، دامین و خدمات DevOps است. این پلتفرم با الهام از سرویس‌هایی مانند Cloudways، DigitalOcean و پارس پک طراحی شده است. + +## 🏗️ معماری + +این پروژه بر اساس **Clean Architecture** و اصول **SOLID** طراحی شده است: + +- **Domain Layer**: منطق کسب‌وکار اصلی +- **Application Layer**: موارد استفاده (Use Cases) +- **Infrastructure Layer**: پیاده‌سازی‌های فنی +- **Presentation Layer**: رابط کاربری (Reflex) + +## 🚀 تکنولوژی‌ها + +- **Frontend/Backend**: Python Reflex +- **Database**: PostgreSQL + SQLAlchemy +- **Cache**: Redis +- **Task Queue**: Celery +- **Testing**: pytest +- **Code Quality**: black, flake8, mypy, isort + +## 📋 پیش‌نیازها + +- Python 3.11+ +- PostgreSQL 14+ +- Redis 7+ +- Node.js 18+ (برای Reflex) + +## 🛠️ نصب و راه‌اندازی + +### 1. کلون کردن پروژه + +```bash +git clone https://github.com/yourusername/peikarband.git +cd peikarband +``` + +### 2. ایجاد محیط مجازی + +```bash +python -m venv venv +source venv/bin/activate # On Windows: venv\Scripts\activate +``` + +### 3. نصب وابستگی‌ها + +```bash +pip install -r requirements.txt +pip install -r requirements-dev.txt # برای توسعه +``` + +### 4. تنظیم Environment Variables + +```bash +cp .env.example .env +# ویرایش .env و تکمیل مقادیر +``` + +### 5. راه‌اندازی دیتابیس + +```bash +# ایجاد دیتابیس +createdb peikarband + +# اجرای migrations +alembic upgrade head +``` + +### 6. اجرای پروژه + +```bash +# توسعه +python -m reflex run + +# یا +make dev +``` + +## 🚢 Deployment + +### با Docker + +```bash +# Build +docker build -t peikarband:latest . + +# Run +docker-compose up -d +``` + +### با Kubernetes/Helm + +```bash +# Deploy +helm upgrade --install peikarband ./deploy/helm/peikarband \ + --namespace production \ + --set image.tag=0.1.0 + +# یا +make k8s-deploy +``` + +📖 [راهنمای کامل Deployment](docs/deployment/kubernetes.md) + +## 📁 ساختار پروژه + +``` +peikarband-landing/ +├── build/ # Build configs (Docker, CI/CD) +├── deploy/ # Deployment configs (Helm, K8s, ArgoCD) +├── config/ # Configuration files +├── tools/ # Scripts و ابزارها +├── assets/ # Static assets +├── src/ # Source code (Clean Architecture) +│ ├── config/ # تنظیمات +│ ├── core/ # هسته اصلی (Domain + Application) +│ ├── infrastructure/ # پیاده‌سازی‌های فنی +│ ├── presentation/ # رابط کاربری (Reflex) +│ └── shared/ # کدهای مشترک +├── tests/ # تست‌ها +├── docs/ # مستندات کامل +└── data/ # Local data (gitignored) +``` + +📖 [ساختار کامل پروژه](docs/PROJECT_STRUCTURE.md) + +## 🧪 تست + +```bash +# اجرای همه تست‌ها +pytest + +# با coverage +pytest --cov=src tests/ + +# تست‌های خاص +pytest tests/unit/ +pytest tests/integration/ +``` + +## 📝 کدنویسی + +### استانداردها + +- **PEP 8**: استاندارد کدنویسی Python +- **PEP 20**: Zen of Python +- **Type Hints**: همه جا استفاده شود +- **Docstrings**: Google Style + +### ابزارهای کیفیت کد + +```bash +# Format +black src/ + +# Linting +flake8 src/ + +# Type checking +mypy src/ + +# Import sorting +isort src/ +``` + +### Pre-commit Hooks + +```bash +pre-commit install +pre-commit run --all-files +``` + +## 📚 مستندات + +مستندات کامل در پوشه `docs/` موجود است: + +- [Handbook](docs/handbook.md): راهنمای جامع پروژه +- [Architecture](docs/architecture/): معماری سیستم +- [Development](docs/development/): راهنمای توسعه +- [API Reference](docs/api/): مستندات API + +## 🔐 امنیت + +- همه پسوردها با bcrypt hash می‌شوند +- استفاده از JWT برای authentication +- پشتیبانی از 2FA +- اطلاعات حساس رمزنگاری می‌شوند + +## 🤝 مشارکت + +برای مشارکت در پروژه: + +1. Fork کنید +2. Branch جدید بسازید (`git checkout -b feature/amazing-feature`) +3. Commit کنید (`git commit -m 'feat: add amazing feature'`) +4. Push کنید (`git push origin feature/amazing-feature`) +5. Pull Request بسازید + +## 📄 لایسنس + +این پروژه تحت لایسنس MIT منتشر شده است. + +## 👥 تیم + +- Lead Developer: [Your Name] +- Architecture: Clean Architecture +- Methodology: Agile/Scrum + +## 📞 تماس + +- Website: https://peikarband.ir +- Email: support@peikarband.ir +- Telegram: @peikarband + +--- + +**نسخه**: 0.1.0 +**آخرین بروزرسانی**: 2025-01-24 + diff --git a/peikarband/__init__.py b/peikarband/__init__.py deleted file mode 100644 index 98996f5..0000000 --- a/peikarband/__init__.py +++ /dev/null @@ -1,6 +0,0 @@ -"""Peikarband application package.""" - -from .peikarband import app - -__all__ = ["app"] - diff --git a/assets/banner-3.gif b/peikarband/assets/banner-3.gif similarity index 100% rename from assets/banner-3.gif rename to peikarband/assets/banner-3.gif diff --git a/assets/custom.css b/peikarband/assets/custom.css similarity index 100% rename from assets/custom.css rename to peikarband/assets/custom.css diff --git a/assets/hero-person.svg b/peikarband/assets/hero-person.svg similarity index 100% rename from assets/hero-person.svg rename to peikarband/assets/hero-person.svg diff --git a/assets/hero-servers.svg b/peikarband/assets/hero-servers.svg similarity index 100% rename from assets/hero-servers.svg rename to peikarband/assets/hero-servers.svg diff --git a/assets/hero-shield.svg b/peikarband/assets/hero-shield.svg similarity index 100% rename from assets/hero-shield.svg rename to peikarband/assets/hero-shield.svg diff --git a/assets/logo.png b/peikarband/assets/logo.png similarity index 100% rename from assets/logo.png rename to peikarband/assets/logo.png diff --git a/assets/wordpress-logo.gif b/peikarband/assets/wordpress-logo.gif similarity index 100% rename from assets/wordpress-logo.gif rename to peikarband/assets/wordpress-logo.gif diff --git a/assets/wordpress.gif b/peikarband/assets/wordpress.gif similarity index 100% rename from assets/wordpress.gif rename to peikarband/assets/wordpress.gif diff --git a/config/alembic.ini b/peikarband/config/alembic.ini similarity index 100% rename from config/alembic.ini rename to peikarband/config/alembic.ini diff --git a/config/mypy.ini b/peikarband/config/mypy.ini similarity index 100% rename from config/mypy.ini rename to peikarband/config/mypy.ini diff --git a/config/pytest.ini b/peikarband/config/pytest.ini similarity index 100% rename from config/pytest.ini rename to peikarband/config/pytest.ini diff --git a/config/reflex.config.py b/peikarband/config/reflex.config.py similarity index 100% rename from config/reflex.config.py rename to peikarband/config/reflex.config.py diff --git a/docs/PROJECT_STRUCTURE.md b/peikarband/docs/PROJECT_STRUCTURE.md similarity index 100% rename from docs/PROJECT_STRUCTURE.md rename to peikarband/docs/PROJECT_STRUCTURE.md diff --git a/docs/architecture/database-strategy.md b/peikarband/docs/architecture/database-strategy.md similarity index 100% rename from docs/architecture/database-strategy.md rename to peikarband/docs/architecture/database-strategy.md diff --git a/docs/architecture/overview.md b/peikarband/docs/architecture/overview.md similarity index 100% rename from docs/architecture/overview.md rename to peikarband/docs/architecture/overview.md diff --git a/docs/changelog/CHANGELOG.md b/peikarband/docs/changelog/CHANGELOG.md similarity index 100% rename from docs/changelog/CHANGELOG.md rename to peikarband/docs/changelog/CHANGELOG.md diff --git a/docs/changelog/known-issues.md b/peikarband/docs/changelog/known-issues.md similarity index 100% rename from docs/changelog/known-issues.md rename to peikarband/docs/changelog/known-issues.md diff --git a/docs/changelog/migrations.md b/peikarband/docs/changelog/migrations.md similarity index 100% rename from docs/changelog/migrations.md rename to peikarband/docs/changelog/migrations.md diff --git a/CHANGELOG-DEPLOYMENT.md b/peikarband/docs/deployment/CHANGELOG-DEPLOYMENT.md similarity index 100% rename from CHANGELOG-DEPLOYMENT.md rename to peikarband/docs/deployment/CHANGELOG-DEPLOYMENT.md diff --git a/DEPLOYMENT_CHECKLIST.md b/peikarband/docs/deployment/DEPLOYMENT_CHECKLIST.md similarity index 100% rename from DEPLOYMENT_CHECKLIST.md rename to peikarband/docs/deployment/DEPLOYMENT_CHECKLIST.md diff --git a/DEPLOYMENT_QUICK_START.md b/peikarband/docs/deployment/DEPLOYMENT_QUICK_START.md similarity index 100% rename from DEPLOYMENT_QUICK_START.md rename to peikarband/docs/deployment/DEPLOYMENT_QUICK_START.md diff --git a/docs/deployment/PRODUCTION_DEPLOYMENT.md b/peikarband/docs/deployment/PRODUCTION_DEPLOYMENT.md similarity index 100% rename from docs/deployment/PRODUCTION_DEPLOYMENT.md rename to peikarband/docs/deployment/PRODUCTION_DEPLOYMENT.md diff --git a/docs/deployment/kubernetes.md b/peikarband/docs/deployment/kubernetes.md similarity index 100% rename from docs/deployment/kubernetes.md rename to peikarband/docs/deployment/kubernetes.md diff --git a/docs/deployment/quickstart.md b/peikarband/docs/deployment/quickstart.md similarity index 100% rename from docs/deployment/quickstart.md rename to peikarband/docs/deployment/quickstart.md diff --git a/docs/development/coding-standards.md b/peikarband/docs/development/coding-standards.md similarity index 100% rename from docs/development/coding-standards.md rename to peikarband/docs/development/coding-standards.md diff --git a/docs/development/git-workflow.md b/peikarband/docs/development/git-workflow.md similarity index 100% rename from docs/development/git-workflow.md rename to peikarband/docs/development/git-workflow.md diff --git a/docs/development/setup.md b/peikarband/docs/development/setup.md similarity index 100% rename from docs/development/setup.md rename to peikarband/docs/development/setup.md diff --git a/docs/handbook.md b/peikarband/docs/handbook.md similarity index 100% rename from docs/handbook.md rename to peikarband/docs/handbook.md diff --git a/peikarband/peikarband.py b/peikarband/peikarband.py deleted file mode 100644 index b98ab29..0000000 --- a/peikarband/peikarband.py +++ /dev/null @@ -1,58 +0,0 @@ -""" -Peikarband Application Entry Point - -This is the main application file that Reflex uses to run the app. -""" - -import reflex as rx -from src.presentation.web.pages.landing.index import index -from src.presentation.api.routes.health import ( - ping_endpoint, - health_endpoint, - ready_endpoint, - live_endpoint, -) - -# Create the app -app = rx.App() - -# Add landing page -app.add_page(index, route="/") - -# Add health check pages (for Kubernetes probes) -# These return JSON responses for monitoring -@rx.page(route="/ping") -def ping(): - """Basic health check endpoint""" - data = ping_endpoint() - return rx.box( - rx.text(str(data)), - style={"whiteSpace": "pre"} - ) - -@rx.page(route="/health") -def health(): - """Detailed health check endpoint""" - data = health_endpoint() - return rx.box( - rx.text(str(data)), - style={"whiteSpace": "pre"} - ) - -@rx.page(route="/ready") -def ready(): - """Readiness probe endpoint""" - data = ready_endpoint() - return rx.box( - rx.text(str(data)), - style={"whiteSpace": "pre"} - ) - -@rx.page(route="/live") -def live(): - """Liveness probe endpoint""" - data = live_endpoint() - return rx.box( - rx.text(str(data)), - style={"whiteSpace": "pre"} - ) diff --git a/requirements-dev.txt b/peikarband/requirements-dev.txt similarity index 100% rename from requirements-dev.txt rename to peikarband/requirements-dev.txt diff --git a/requirements.txt b/peikarband/requirements.txt similarity index 100% rename from requirements.txt rename to peikarband/requirements.txt diff --git a/rxconfig.py b/peikarband/rxconfig.py similarity index 100% rename from rxconfig.py rename to peikarband/rxconfig.py diff --git a/src/__init__.py b/peikarband/src/__init__.py similarity index 100% rename from src/__init__.py rename to peikarband/src/__init__.py diff --git a/src/config/__init__.py b/peikarband/src/config/__init__.py similarity index 100% rename from src/config/__init__.py rename to peikarband/src/config/__init__.py diff --git a/src/config/cache.py b/peikarband/src/config/cache.py similarity index 100% rename from src/config/cache.py rename to peikarband/src/config/cache.py diff --git a/src/config/database.py b/peikarband/src/config/database.py similarity index 100% rename from src/config/database.py rename to peikarband/src/config/database.py diff --git a/src/config/environments/__init__.py b/peikarband/src/config/environments/__init__.py similarity index 100% rename from src/config/environments/__init__.py rename to peikarband/src/config/environments/__init__.py diff --git a/src/config/logging.py b/peikarband/src/config/logging.py similarity index 100% rename from src/config/logging.py rename to peikarband/src/config/logging.py diff --git a/src/config/settings.py b/peikarband/src/config/settings.py similarity index 100% rename from src/config/settings.py rename to peikarband/src/config/settings.py diff --git a/src/core/__init__.py b/peikarband/src/core/__init__.py similarity index 100% rename from src/core/__init__.py rename to peikarband/src/core/__init__.py diff --git a/src/core/application/__init__.py b/peikarband/src/core/application/__init__.py similarity index 100% rename from src/core/application/__init__.py rename to peikarband/src/core/application/__init__.py diff --git a/src/core/application/dto/__init__.py b/peikarband/src/core/application/dto/__init__.py similarity index 100% rename from src/core/application/dto/__init__.py rename to peikarband/src/core/application/dto/__init__.py diff --git a/src/core/application/interfaces/__init__.py b/peikarband/src/core/application/interfaces/__init__.py similarity index 100% rename from src/core/application/interfaces/__init__.py rename to peikarband/src/core/application/interfaces/__init__.py diff --git a/src/core/application/interfaces/providers/__init__.py b/peikarband/src/core/application/interfaces/providers/__init__.py similarity index 100% rename from src/core/application/interfaces/providers/__init__.py rename to peikarband/src/core/application/interfaces/providers/__init__.py diff --git a/src/core/application/interfaces/repositories/__init__.py b/peikarband/src/core/application/interfaces/repositories/__init__.py similarity index 100% rename from src/core/application/interfaces/repositories/__init__.py rename to peikarband/src/core/application/interfaces/repositories/__init__.py diff --git a/src/core/application/interfaces/services/__init__.py b/peikarband/src/core/application/interfaces/services/__init__.py similarity index 100% rename from src/core/application/interfaces/services/__init__.py rename to peikarband/src/core/application/interfaces/services/__init__.py diff --git a/src/core/application/use_cases/__init__.py b/peikarband/src/core/application/use_cases/__init__.py similarity index 100% rename from src/core/application/use_cases/__init__.py rename to peikarband/src/core/application/use_cases/__init__.py diff --git a/src/core/application/use_cases/auth/__init__.py b/peikarband/src/core/application/use_cases/auth/__init__.py similarity index 100% rename from src/core/application/use_cases/auth/__init__.py rename to peikarband/src/core/application/use_cases/auth/__init__.py diff --git a/src/core/application/use_cases/billing/__init__.py b/peikarband/src/core/application/use_cases/billing/__init__.py similarity index 100% rename from src/core/application/use_cases/billing/__init__.py rename to peikarband/src/core/application/use_cases/billing/__init__.py diff --git a/src/core/application/use_cases/servers/__init__.py b/peikarband/src/core/application/use_cases/servers/__init__.py similarity index 100% rename from src/core/application/use_cases/servers/__init__.py rename to peikarband/src/core/application/use_cases/servers/__init__.py diff --git a/src/core/application/use_cases/services/__init__.py b/peikarband/src/core/application/use_cases/services/__init__.py similarity index 100% rename from src/core/application/use_cases/services/__init__.py rename to peikarband/src/core/application/use_cases/services/__init__.py diff --git a/src/core/application/validators/__init__.py b/peikarband/src/core/application/validators/__init__.py similarity index 100% rename from src/core/application/validators/__init__.py rename to peikarband/src/core/application/validators/__init__.py diff --git a/src/core/domain/__init__.py b/peikarband/src/core/domain/__init__.py similarity index 100% rename from src/core/domain/__init__.py rename to peikarband/src/core/domain/__init__.py diff --git a/src/core/domain/entities/__init__.py b/peikarband/src/core/domain/entities/__init__.py similarity index 100% rename from src/core/domain/entities/__init__.py rename to peikarband/src/core/domain/entities/__init__.py diff --git a/src/core/domain/entities/base.py b/peikarband/src/core/domain/entities/base.py similarity index 100% rename from src/core/domain/entities/base.py rename to peikarband/src/core/domain/entities/base.py diff --git a/src/core/domain/enums/__init__.py b/peikarband/src/core/domain/enums/__init__.py similarity index 100% rename from src/core/domain/enums/__init__.py rename to peikarband/src/core/domain/enums/__init__.py diff --git a/src/core/domain/exceptions/__init__.py b/peikarband/src/core/domain/exceptions/__init__.py similarity index 100% rename from src/core/domain/exceptions/__init__.py rename to peikarband/src/core/domain/exceptions/__init__.py diff --git a/src/core/domain/exceptions/base.py b/peikarband/src/core/domain/exceptions/base.py similarity index 100% rename from src/core/domain/exceptions/base.py rename to peikarband/src/core/domain/exceptions/base.py diff --git a/src/core/domain/exceptions/user_exceptions.py b/peikarband/src/core/domain/exceptions/user_exceptions.py similarity index 100% rename from src/core/domain/exceptions/user_exceptions.py rename to peikarband/src/core/domain/exceptions/user_exceptions.py diff --git a/src/core/domain/value_objects/__init__.py b/peikarband/src/core/domain/value_objects/__init__.py similarity index 100% rename from src/core/domain/value_objects/__init__.py rename to peikarband/src/core/domain/value_objects/__init__.py diff --git a/src/core/domain/value_objects/email.py b/peikarband/src/core/domain/value_objects/email.py similarity index 100% rename from src/core/domain/value_objects/email.py rename to peikarband/src/core/domain/value_objects/email.py diff --git a/src/core/domain/value_objects/money.py b/peikarband/src/core/domain/value_objects/money.py similarity index 100% rename from src/core/domain/value_objects/money.py rename to peikarband/src/core/domain/value_objects/money.py diff --git a/src/core/domain/value_objects/phone.py b/peikarband/src/core/domain/value_objects/phone.py similarity index 100% rename from src/core/domain/value_objects/phone.py rename to peikarband/src/core/domain/value_objects/phone.py diff --git a/src/core/utils/__init__.py b/peikarband/src/core/utils/__init__.py similarity index 100% rename from src/core/utils/__init__.py rename to peikarband/src/core/utils/__init__.py diff --git a/src/infrastructure/__init__.py b/peikarband/src/infrastructure/__init__.py similarity index 100% rename from src/infrastructure/__init__.py rename to peikarband/src/infrastructure/__init__.py diff --git a/src/infrastructure/cache/__init__.py b/peikarband/src/infrastructure/cache/__init__.py similarity index 100% rename from src/infrastructure/cache/__init__.py rename to peikarband/src/infrastructure/cache/__init__.py diff --git a/src/infrastructure/database/__init__.py b/peikarband/src/infrastructure/database/__init__.py similarity index 100% rename from src/infrastructure/database/__init__.py rename to peikarband/src/infrastructure/database/__init__.py diff --git a/src/infrastructure/database/migrations/__init__.py b/peikarband/src/infrastructure/database/migrations/__init__.py similarity index 100% rename from src/infrastructure/database/migrations/__init__.py rename to peikarband/src/infrastructure/database/migrations/__init__.py diff --git a/src/infrastructure/database/migrations/env.py b/peikarband/src/infrastructure/database/migrations/env.py similarity index 100% rename from src/infrastructure/database/migrations/env.py rename to peikarband/src/infrastructure/database/migrations/env.py diff --git a/src/infrastructure/database/migrations/script.py.mako b/peikarband/src/infrastructure/database/migrations/script.py.mako similarity index 100% rename from src/infrastructure/database/migrations/script.py.mako rename to peikarband/src/infrastructure/database/migrations/script.py.mako diff --git a/src/infrastructure/database/migrations/versions/__init__.py b/peikarband/src/infrastructure/database/migrations/versions/__init__.py similarity index 100% rename from src/infrastructure/database/migrations/versions/__init__.py rename to peikarband/src/infrastructure/database/migrations/versions/__init__.py diff --git a/src/infrastructure/database/models/__init__.py b/peikarband/src/infrastructure/database/models/__init__.py similarity index 100% rename from src/infrastructure/database/models/__init__.py rename to peikarband/src/infrastructure/database/models/__init__.py diff --git a/src/infrastructure/database/models/base.py b/peikarband/src/infrastructure/database/models/base.py similarity index 100% rename from src/infrastructure/database/models/base.py rename to peikarband/src/infrastructure/database/models/base.py diff --git a/src/infrastructure/database/repositories/__init__.py b/peikarband/src/infrastructure/database/repositories/__init__.py similarity index 100% rename from src/infrastructure/database/repositories/__init__.py rename to peikarband/src/infrastructure/database/repositories/__init__.py diff --git a/src/infrastructure/database/repositories/base_repository.py b/peikarband/src/infrastructure/database/repositories/base_repository.py similarity index 100% rename from src/infrastructure/database/repositories/base_repository.py rename to peikarband/src/infrastructure/database/repositories/base_repository.py diff --git a/src/infrastructure/database/unit_of_work.py b/peikarband/src/infrastructure/database/unit_of_work.py similarity index 100% rename from src/infrastructure/database/unit_of_work.py rename to peikarband/src/infrastructure/database/unit_of_work.py diff --git a/src/infrastructure/external/__init__.py b/peikarband/src/infrastructure/external/__init__.py similarity index 100% rename from src/infrastructure/external/__init__.py rename to peikarband/src/infrastructure/external/__init__.py diff --git a/src/infrastructure/external/email/__init__.py b/peikarband/src/infrastructure/external/email/__init__.py similarity index 100% rename from src/infrastructure/external/email/__init__.py rename to peikarband/src/infrastructure/external/email/__init__.py diff --git a/src/infrastructure/external/payment/__init__.py b/peikarband/src/infrastructure/external/payment/__init__.py similarity index 100% rename from src/infrastructure/external/payment/__init__.py rename to peikarband/src/infrastructure/external/payment/__init__.py diff --git a/src/infrastructure/external/providers/__init__.py b/peikarband/src/infrastructure/external/providers/__init__.py similarity index 100% rename from src/infrastructure/external/providers/__init__.py rename to peikarband/src/infrastructure/external/providers/__init__.py diff --git a/src/infrastructure/external/sms/__init__.py b/peikarband/src/infrastructure/external/sms/__init__.py similarity index 100% rename from src/infrastructure/external/sms/__init__.py rename to peikarband/src/infrastructure/external/sms/__init__.py diff --git a/src/infrastructure/logging/__init__.py b/peikarband/src/infrastructure/logging/__init__.py similarity index 100% rename from src/infrastructure/logging/__init__.py rename to peikarband/src/infrastructure/logging/__init__.py diff --git a/src/infrastructure/security/__init__.py b/peikarband/src/infrastructure/security/__init__.py similarity index 100% rename from src/infrastructure/security/__init__.py rename to peikarband/src/infrastructure/security/__init__.py diff --git a/src/infrastructure/tasks/__init__.py b/peikarband/src/infrastructure/tasks/__init__.py similarity index 100% rename from src/infrastructure/tasks/__init__.py rename to peikarband/src/infrastructure/tasks/__init__.py diff --git a/src/presentation/__init__.py b/peikarband/src/presentation/__init__.py similarity index 100% rename from src/presentation/__init__.py rename to peikarband/src/presentation/__init__.py diff --git a/src/presentation/api/__init__.py b/peikarband/src/presentation/api/__init__.py similarity index 100% rename from src/presentation/api/__init__.py rename to peikarband/src/presentation/api/__init__.py diff --git a/src/presentation/api/middleware/__init__.py b/peikarband/src/presentation/api/middleware/__init__.py similarity index 100% rename from src/presentation/api/middleware/__init__.py rename to peikarband/src/presentation/api/middleware/__init__.py diff --git a/src/presentation/api/routes/__init__.py b/peikarband/src/presentation/api/routes/__init__.py similarity index 100% rename from src/presentation/api/routes/__init__.py rename to peikarband/src/presentation/api/routes/__init__.py diff --git a/src/presentation/api/routes/health.py b/peikarband/src/presentation/api/routes/health.py similarity index 100% rename from src/presentation/api/routes/health.py rename to peikarband/src/presentation/api/routes/health.py diff --git a/src/presentation/web/__init__.py b/peikarband/src/presentation/web/__init__.py similarity index 100% rename from src/presentation/web/__init__.py rename to peikarband/src/presentation/web/__init__.py diff --git a/src/presentation/web/components/__init__.py b/peikarband/src/presentation/web/components/__init__.py similarity index 100% rename from src/presentation/web/components/__init__.py rename to peikarband/src/presentation/web/components/__init__.py diff --git a/src/presentation/web/components/cards/__init__.py b/peikarband/src/presentation/web/components/cards/__init__.py similarity index 100% rename from src/presentation/web/components/cards/__init__.py rename to peikarband/src/presentation/web/components/cards/__init__.py diff --git a/src/presentation/web/components/common/__init__.py b/peikarband/src/presentation/web/components/common/__init__.py similarity index 100% rename from src/presentation/web/components/common/__init__.py rename to peikarband/src/presentation/web/components/common/__init__.py diff --git a/src/presentation/web/components/forms/__init__.py b/peikarband/src/presentation/web/components/forms/__init__.py similarity index 100% rename from src/presentation/web/components/forms/__init__.py rename to peikarband/src/presentation/web/components/forms/__init__.py diff --git a/src/presentation/web/pages/__init__.py b/peikarband/src/presentation/web/pages/__init__.py similarity index 100% rename from src/presentation/web/pages/__init__.py rename to peikarband/src/presentation/web/pages/__init__.py diff --git a/src/presentation/web/pages/admin/__init__.py b/peikarband/src/presentation/web/pages/admin/__init__.py similarity index 100% rename from src/presentation/web/pages/admin/__init__.py rename to peikarband/src/presentation/web/pages/admin/__init__.py diff --git a/src/presentation/web/pages/auth/__init__.py b/peikarband/src/presentation/web/pages/auth/__init__.py similarity index 100% rename from src/presentation/web/pages/auth/__init__.py rename to peikarband/src/presentation/web/pages/auth/__init__.py diff --git a/src/presentation/web/pages/dashboard/__init__.py b/peikarband/src/presentation/web/pages/dashboard/__init__.py similarity index 100% rename from src/presentation/web/pages/dashboard/__init__.py rename to peikarband/src/presentation/web/pages/dashboard/__init__.py diff --git a/src/presentation/web/pages/landing/__init__.py b/peikarband/src/presentation/web/pages/landing/__init__.py similarity index 100% rename from src/presentation/web/pages/landing/__init__.py rename to peikarband/src/presentation/web/pages/landing/__init__.py diff --git a/src/presentation/web/pages/landing/index.py b/peikarband/src/presentation/web/pages/landing/index.py similarity index 100% rename from src/presentation/web/pages/landing/index.py rename to peikarband/src/presentation/web/pages/landing/index.py diff --git a/src/presentation/web/state/__init__.py b/peikarband/src/presentation/web/state/__init__.py similarity index 100% rename from src/presentation/web/state/__init__.py rename to peikarband/src/presentation/web/state/__init__.py diff --git a/src/presentation/web/styles/__init__.py b/peikarband/src/presentation/web/styles/__init__.py similarity index 100% rename from src/presentation/web/styles/__init__.py rename to peikarband/src/presentation/web/styles/__init__.py diff --git a/src/shared/__init__.py b/peikarband/src/shared/__init__.py similarity index 100% rename from src/shared/__init__.py rename to peikarband/src/shared/__init__.py diff --git a/src/shared/events/__init__.py b/peikarband/src/shared/events/__init__.py similarity index 100% rename from src/shared/events/__init__.py rename to peikarband/src/shared/events/__init__.py diff --git a/src/shared/messaging/__init__.py b/peikarband/src/shared/messaging/__init__.py similarity index 100% rename from src/shared/messaging/__init__.py rename to peikarband/src/shared/messaging/__init__.py diff --git a/tests/__init__.py b/peikarband/tests/__init__.py similarity index 100% rename from tests/__init__.py rename to peikarband/tests/__init__.py diff --git a/tests/conftest.py b/peikarband/tests/conftest.py similarity index 100% rename from tests/conftest.py rename to peikarband/tests/conftest.py diff --git a/tests/e2e/__init__.py b/peikarband/tests/e2e/__init__.py similarity index 100% rename from tests/e2e/__init__.py rename to peikarband/tests/e2e/__init__.py diff --git a/tests/e2e/scenarios/__init__.py b/peikarband/tests/e2e/scenarios/__init__.py similarity index 100% rename from tests/e2e/scenarios/__init__.py rename to peikarband/tests/e2e/scenarios/__init__.py diff --git a/tests/fixtures/__init__.py b/peikarband/tests/fixtures/__init__.py similarity index 100% rename from tests/fixtures/__init__.py rename to peikarband/tests/fixtures/__init__.py diff --git a/tests/integration/__init__.py b/peikarband/tests/integration/__init__.py similarity index 100% rename from tests/integration/__init__.py rename to peikarband/tests/integration/__init__.py diff --git a/tests/integration/database/__init__.py b/peikarband/tests/integration/database/__init__.py similarity index 100% rename from tests/integration/database/__init__.py rename to peikarband/tests/integration/database/__init__.py diff --git a/tests/integration/external/__init__.py b/peikarband/tests/integration/external/__init__.py similarity index 100% rename from tests/integration/external/__init__.py rename to peikarband/tests/integration/external/__init__.py diff --git a/tests/unit/__init__.py b/peikarband/tests/unit/__init__.py similarity index 100% rename from tests/unit/__init__.py rename to peikarband/tests/unit/__init__.py diff --git a/tests/unit/core/__init__.py b/peikarband/tests/unit/core/__init__.py similarity index 100% rename from tests/unit/core/__init__.py rename to peikarband/tests/unit/core/__init__.py diff --git a/tests/unit/core/application/__init__.py b/peikarband/tests/unit/core/application/__init__.py similarity index 100% rename from tests/unit/core/application/__init__.py rename to peikarband/tests/unit/core/application/__init__.py diff --git a/tests/unit/core/domain/__init__.py b/peikarband/tests/unit/core/domain/__init__.py similarity index 100% rename from tests/unit/core/domain/__init__.py rename to peikarband/tests/unit/core/domain/__init__.py diff --git a/tests/unit/infrastructure/__init__.py b/peikarband/tests/unit/infrastructure/__init__.py similarity index 100% rename from tests/unit/infrastructure/__init__.py rename to peikarband/tests/unit/infrastructure/__init__.py diff --git a/tools/scripts/diagnose-502.sh b/peikarband/tools/scripts/diagnose-502.sh similarity index 100% rename from tools/scripts/diagnose-502.sh rename to peikarband/tools/scripts/diagnose-502.sh diff --git a/tools/scripts/update-env-json.sh b/peikarband/tools/scripts/update-env-json.sh similarity index 100% rename from tools/scripts/update-env-json.sh rename to peikarband/tools/scripts/update-env-json.sh diff --git a/tools/setup.py b/peikarband/tools/setup.py similarity index 100% rename from tools/setup.py rename to peikarband/tools/setup.py diff --git a/wired-flat-2579-logo-wordpress-hover-pinch.gif b/wired-flat-2579-logo-wordpress-hover-pinch.gif deleted file mode 100644 index e1141bd..0000000 Binary files a/wired-flat-2579-logo-wordpress-hover-pinch.gif and /dev/null differ diff --git a/woodpecker copy.yml b/woodpecker copy.yml deleted file mode 100644 index f90a106..0000000 --- a/woodpecker copy.yml +++ /dev/null @@ -1,439 +0,0 @@ -# Peikarband Platform - Woodpecker CI/CD Pipeline -# Complete production-ready pipeline with Harbor registry integration - -variables: - - &harbor_registry 'harbor.peikarband.ir' - - &image_name 'peikarband/landing' - - &python_version '3.11' - -# Global configuration -when: - - evaluate: 'CI_PIPELINE_EVENT != "cron"' - -# ============================================ -# STAGE 1: Code Quality & Linting -# ============================================ -steps: - lint-python: - image: python:${python_version}-slim - environment: - - PYTHONPATH=/woodpecker/src/workspace - commands: - - pip install --no-cache-dir flake8 black isort mypy - - echo "🔍 Running flake8..." - - flake8 src/ --max-line-length=120 --exclude=__pycache__,migrations --statistics - - echo "✅ Flake8 passed" - - echo "🔍 Running black check..." - - black --check src/ --line-length=120 - - echo "✅ Black check passed" - - echo "🔍 Running isort check..." - - isort --check-only src/ - - echo "✅ Isort check passed" - when: - branch: - include: - - main - - develop - - staging - - feature/* - - hotfix/* - - lint-yaml: - image: cytopia/yamllint:latest - commands: - - echo "🔍 Validating YAML files..." - - yamllint -c .yamllint.yml helm/ || true - - yamllint woodpecker.yml - - echo "✅ YAML validation completed" - when: - branch: - include: - - main - - develop - - staging - -# # ============================================ -# # STAGE 2: Unit Tests & Coverage -# # ============================================ -# test-unit: -# image: python:${python_version}-slim -# environment: -# - PYTHONPATH=/woodpecker/src/workspace -# - ENVIRONMENT=test -# - DATABASE_URL=postgresql://test:test@postgres:5432/test_db -# - REDIS_URL=redis://redis:6379/0 -# commands: -# - apt-get update && apt-get install -y --no-install-recommends postgresql-client -# - pip install --no-cache-dir -r requirements.txt -r requirements-dev.txt -# - echo "🧪 Running unit tests..." -# - pytest tests/unit/ -v --cov=src --cov-report=term --cov-report=xml --cov-report=html -# - echo "✅ Unit tests passed" -# - echo "📊 Coverage report generated" -# when: -# branch: -# include: -# - main -# - develop -# - staging -# - feature/* - -# test-integration: -# image: python:${python_version}-slim -# environment: -# - PYTHONPATH=/woodpecker/src/workspace -# - ENVIRONMENT=test -# - DATABASE_URL=postgresql://test:test@postgres:5432/test_db -# - REDIS_URL=redis://redis:6379/0 -# commands: -# - apt-get update && apt-get install -y --no-install-recommends postgresql-client -# - pip install --no-cache-dir -r requirements.txt -r requirements-dev.txt -# - echo "🧪 Running integration tests..." -# - pytest tests/integration/ -v --maxfail=3 -# - echo "✅ Integration tests passed" -# when: -# branch: -# include: -# - main -# - develop -# - staging - -# # ============================================ -# # STAGE 3: Security Scanning -# # ============================================ -# security-python-deps: -# image: python:${python_version}-slim -# commands: -# - pip install --no-cache-dir safety bandit -# - echo "🔒 Checking Python dependencies for vulnerabilities..." -# - safety check --json || true -# - echo "🔒 Running Bandit security linter..." -# - bandit -r src/ -f json -o bandit-report.json || true -# - echo "✅ Security scan completed" -# when: -# branch: -# include: -# - main -# - develop -# - staging - -# security-secrets: -# image: trufflesecurity/trufflehog:latest -# commands: -# - echo "🔐 Scanning for secrets and credentials..." -# - trufflehog filesystem . --json --no-update || true -# - echo "✅ Secret scan completed" -# when: -# branch: -# include: -# - main -# - develop -# - staging - -# ============================================ -# STAGE 4: Docker Build -# ============================================ - docker-build: - image: plugins/docker - settings: - registry: *harbor_registry - repo: ${harbor_registry}/${image_name} - tags: - - ${CI_COMMIT_SHA:0:8} - - ${CI_COMMIT_BRANCH} - - latest - username: - from_secret: harbor_username - password: - from_secret: harbor_password - build_args: - - ENVIRONMENT=production - - VERSION=${CI_COMMIT_SHA:0:8} - cache_from: - - ${harbor_registry}/${image_name}:latest - dockerfile: Dockerfile - dry_run: false - when: - branch: - include: - - main - - develop - - staging - event: - - push - - tag - -# # ============================================ -# # STAGE 5: Container Security Scan -# # ============================================ -# security-trivy: -# image: aquasec/trivy:latest -# commands: -# - echo "🔒 Scanning Docker image for vulnerabilities..." -# - trivy image -# --severity HIGH,CRITICAL -# --exit-code 0 -# --format json -# --output trivy-report.json -# ${harbor_registry}/${image_name}:${CI_COMMIT_SHA:0:8} -# - echo "✅ Trivy scan completed" -# - trivy image -# --severity HIGH,CRITICAL -# --format table -# ${harbor_registry}/${image_name}:${CI_COMMIT_SHA:0:8} -# when: -# branch: -# include: -# - main -# - develop -# - staging -# event: -# - push - -# ============================================ -# STAGE 6: Helm Validation -# ============================================ - helm-lint: - image: alpine/helm:latest - commands: - - echo "📦 Linting Helm chart..." - - helm lint helm/peikarband --strict - - echo "✅ Helm lint passed" - - echo "📦 Validating Helm template..." - - helm template peikarband helm/peikarband - --set image.repository=${harbor_registry}/${image_name} - --set image.tag=${CI_COMMIT_SHA:0:8} - --debug > /dev/null - - echo "✅ Helm template validation passed" - when: - branch: - include: - - main - - develop - - staging - -# ============================================ -# STAGE 7: Database Migration Check -# ============================================ - migration-check: - image: python:${python_version}-slim - environment: - - PYTHONPATH=/woodpecker/src/workspace - commands: - - pip install --no-cache-dir alembic sqlalchemy psycopg2-binary - - echo "🗄️ Checking database migrations..." - - alembic check || echo "⚠️ Migration check completed with warnings" - - alembic history - - echo "✅ Migration check completed" - when: - branch: - include: - - main - - develop - - staging - -# ============================================ -# STAGE 8: Deploy to Staging -# ============================================ - deploy-staging: - image: argoproj/argocd:latest - environment: - ARGOCD_SERVER: - from_secret: argocd_server - ARGOCD_AUTH_TOKEN: - from_secret: argocd_token - commands: - - echo "🚀 Deploying to Staging via ArgoCD..." - - argocd app set peikarband-staging - --helm-set image.tag=${CI_COMMIT_SHA:0:8} - - argocd app sync peikarband-staging --prune - - argocd app wait peikarband-staging --timeout 600 - - echo "✅ Staging deployment completed" - when: - branch: - - develop - - staging - event: - - push - -# ============================================ -# STAGE 9: Deploy to Production -# ============================================ - deploy-production: - image: argoproj/argocd:latest - environment: - ARGOCD_SERVER: - from_secret: argocd_server - ARGOCD_AUTH_TOKEN: - from_secret: argocd_token - commands: - - echo "🚀 Deploying to Production via ArgoCD..." - - argocd app set peikarband - --helm-set image.tag=${CI_COMMIT_SHA:0:8} - - argocd app sync peikarband --prune - - argocd app wait peikarband --timeout 600 - - echo "✅ Production deployment completed" - - echo "🎉 Version ${CI_COMMIT_SHA:0:8} is now live!" - when: - branch: - - main - event: - - push - - tag - -# ============================================ -# STAGE 10: Post-Deployment Verification -# ============================================ - verify-deployment: - image: curlimages/curl:latest - commands: - - echo "🔍 Verifying deployment..." - - sleep 30 - - | - if [ "${CI_COMMIT_BRANCH}" = "main" ]; then - ENDPOINT="https://peikarband.ir/ping" - else - ENDPOINT="https://staging.peikarband.ir/ping" - fi - - echo "Testing endpoint: $ENDPOINT" - - curl -f -s -o /dev/null -w "HTTP Status: %{http_code}\n" $ENDPOINT || echo "⚠️ Health check warning" - - echo "✅ Deployment verification completed" - when: - branch: - include: - - main - - develop - - staging - event: - - push - -# ============================================ -# STAGE 11: Notifications -# ============================================ - notify-telegram: - image: appleboy/drone-telegram:latest - settings: - token: - from_secret: telegram_bot_token - to: - from_secret: telegram_chat_id - format: markdown - message: > - {{#success build.status}} - ✅ **Build Success** - {{else}} - ❌ **Build Failed** - {{/success}} - - **Project:** Peikarband Landing - - **Branch:** ${CI_COMMIT_BRANCH} - - **Commit:** `${CI_COMMIT_SHA:0:8}` - - **Author:** ${CI_COMMIT_AUTHOR} - - **Message:** ${CI_COMMIT_MESSAGE} - - **Build:** [#${CI_BUILD_NUMBER}](${CI_BUILD_LINK}) - - **Duration:** ${CI_BUILD_FINISHED} - when: - status: - - success - - failure - branch: - - main - - develop - - staging - - notify-slack: - image: plugins/slack:latest - settings: - webhook: - from_secret: slack_webhook - channel: deployments - username: Woodpecker CI - template: > - {{#success build.status}} - :white_check_mark: Build #{{build.number}} succeeded - {{else}} - :x: Build #{{build.number}} failed - {{/success}} - - *Repository:* {{repo.name}} - *Branch:* {{build.branch}} - *Commit:* {{build.commit}} - *Author:* {{build.author}} - *Message:* {{build.message}} - *Link:* {{build.link}} - when: - status: - - success - - failure - branch: - - main - -# ============================================ -# Services (for testing) -# ============================================ -services: - postgres: - image: postgres:14-alpine - environment: - POSTGRES_USER: test - POSTGRES_PASSWORD: test - POSTGRES_DB: test_db - when: - branch: - include: - - main - - develop - - staging - - feature/* - - redis: - image: redis:7-alpine - when: - branch: - include: - - main - - develop - - staging - - feature/* - -# ============================================ -# Matrix Build (Optional - Multi-arch support) -# ============================================ -matrix: - include: - - PLATFORM: linux/amd64 - ENVIRONMENT: production - - PLATFORM: linux/arm64 - ENVIRONMENT: production - -# ============================================ -# Pipeline Configuration -# ============================================ -labels: - platform: linux/amd64 - backend: docker - -depends_on: [] - -skip_clone: false - -# Workspace configuration -workspace: - base: /woodpecker/src - path: workspace - -# Clone settings -clone: - git: - image: woodpeckerci/plugin-git:latest - settings: - depth: 50 - lfs: false - recursive: true - tags: true -