refactor: reorganize project structure for better maintainability
- Move Docker files to build/docker/ - Move CI/CD configs to build/ci/ - Move deployment configs to deploy/ (helm, k8s, argocd) - Move config files to config/ - Move scripts to tools/ - Consolidate assets to assets/ (Reflex compatible) - Add data/ directory for local data (gitignored) - Update all path references in Makefile, Dockerfile, CI configs - Add comprehensive README files for build/ and deploy/ - Update project documentation Benefits: - Clear separation of concerns - Cleaner root directory - Better developer experience - Enterprise-grade structure - Improved maintainability
This commit is contained in:
226
deploy/README.md
Normal file
226
deploy/README.md
Normal file
@@ -0,0 +1,226 @@
|
||||
# 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 <pod-name> -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 <revision> -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)
|
||||
|
||||
154
deploy/argocd/README.md
Normal file
154
deploy/argocd/README.md
Normal file
@@ -0,0 +1,154 @@
|
||||
# ArgoCD Deployment
|
||||
|
||||
This directory contains ArgoCD Application manifests for deploying Peikarband to Kubernetes.
|
||||
|
||||
## Files
|
||||
|
||||
- `application.yaml`: Production deployment (main branch → peikarband namespace)
|
||||
- `application-staging.yaml`: Staging deployment (develop branch → peikarband-staging namespace)
|
||||
|
||||
## Prerequisites
|
||||
|
||||
1. ArgoCD installed in your cluster
|
||||
2. Git repository access configured in ArgoCD
|
||||
3. Docker registry credentials (if using private registry)
|
||||
|
||||
## Deployment
|
||||
|
||||
### 1. Add Git Repository to ArgoCD
|
||||
|
||||
```bash
|
||||
# For HTTPS with token
|
||||
argocd repo add https://git.peikarband.ir/ehsan-minadd/peikarband.git \
|
||||
--username YOUR_USERNAME \
|
||||
--password YOUR_ACCESS_TOKEN
|
||||
|
||||
# Or using argocd UI: Settings → Repositories → Connect Repo
|
||||
```
|
||||
|
||||
### 2. Deploy Production
|
||||
|
||||
```bash
|
||||
kubectl apply -f argocd/application.yaml
|
||||
```
|
||||
|
||||
### 3. Deploy Staging
|
||||
|
||||
```bash
|
||||
kubectl apply -f argocd/application-staging.yaml
|
||||
```
|
||||
|
||||
## Sync Policy
|
||||
|
||||
Both applications use **automatic sync** with:
|
||||
- **Auto-prune**: Remove resources deleted from Git
|
||||
- **Self-heal**: Automatically sync when cluster state differs from Git
|
||||
- **Retry logic**: 5 attempts with exponential backoff
|
||||
|
||||
## Monitoring
|
||||
|
||||
```bash
|
||||
# Check application status
|
||||
argocd app get peikarband
|
||||
argocd app get peikarband-staging
|
||||
|
||||
# Watch sync progress
|
||||
argocd app sync peikarband --watch
|
||||
|
||||
# View logs
|
||||
argocd app logs peikarband
|
||||
```
|
||||
|
||||
## Manual Sync
|
||||
|
||||
```bash
|
||||
# Force sync
|
||||
argocd app sync peikarband --force
|
||||
|
||||
# Sync with prune
|
||||
argocd app sync peikarband --prune
|
||||
```
|
||||
|
||||
## Rollback
|
||||
|
||||
```bash
|
||||
# List history
|
||||
argocd app history peikarband
|
||||
|
||||
# Rollback to specific revision
|
||||
argocd app rollback peikarband <REVISION>
|
||||
```
|
||||
|
||||
## Architecture
|
||||
|
||||
```
|
||||
┌─────────────────────────────────────────────────┐
|
||||
│ ArgoCD │
|
||||
│ ┌───────────────────┐ ┌──────────────────┐ │
|
||||
│ │ Production App │ │ Staging App │ │
|
||||
│ │ (main branch) │ │ (develop branch) │ │
|
||||
│ └─────────┬─────────┘ └────────┬─────────┘ │
|
||||
└────────────┼─────────────────────┼──────────────┘
|
||||
│ │
|
||||
▼ ▼
|
||||
┌────────────────┐ ┌─────────────────┐
|
||||
│ namespace: │ │ namespace: │
|
||||
│ peikarband │ │ peikarband-stg │
|
||||
└────────────────┘ └─────────────────┘
|
||||
```
|
||||
|
||||
## Environment Variables
|
||||
|
||||
Override via Helm values:
|
||||
|
||||
```yaml
|
||||
# In values-production.yaml or values-staging.yaml
|
||||
env:
|
||||
- name: DATABASE_URL
|
||||
value: "postgresql://..."
|
||||
- name: REDIS_URL
|
||||
value: "redis://..."
|
||||
```
|
||||
|
||||
## Secrets Management
|
||||
|
||||
Secrets should be managed outside Git:
|
||||
|
||||
```bash
|
||||
# Using kubectl
|
||||
kubectl create secret generic peikarband-secrets \
|
||||
--from-literal=database-password=xxx \
|
||||
--namespace=peikarband
|
||||
|
||||
# Or using Sealed Secrets, External Secrets Operator, etc.
|
||||
```
|
||||
|
||||
## Troubleshooting
|
||||
|
||||
### Application Out of Sync
|
||||
|
||||
```bash
|
||||
argocd app sync peikarband --force
|
||||
```
|
||||
|
||||
### Image Pull Errors
|
||||
|
||||
Check registry credentials:
|
||||
```bash
|
||||
kubectl get secret regcred -n peikarband -o yaml
|
||||
```
|
||||
|
||||
### Health Check Failing
|
||||
|
||||
View pod logs:
|
||||
```bash
|
||||
kubectl logs -n peikarband -l app=peikarband --tail=100
|
||||
```
|
||||
|
||||
### Helm Values Override Not Working
|
||||
|
||||
Verify values file path in Application manifest:
|
||||
```bash
|
||||
argocd app manifests peikarband | grep valueFiles
|
||||
```
|
||||
|
||||
58
deploy/argocd/application-staging.yaml
Normal file
58
deploy/argocd/application-staging.yaml
Normal file
@@ -0,0 +1,58 @@
|
||||
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
|
||||
|
||||
64
deploy/argocd/application.yaml
Normal file
64
deploy/argocd/application.yaml
Normal file
@@ -0,0 +1,64 @@
|
||||
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
|
||||
|
||||
24
deploy/helm/peikarband/.helmignore
Normal file
24
deploy/helm/peikarband/.helmignore
Normal file
@@ -0,0 +1,24 @@
|
||||
# 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/
|
||||
|
||||
18
deploy/helm/peikarband/Chart.yaml
Normal file
18
deploy/helm/peikarband/Chart.yaml
Normal file
@@ -0,0 +1,18 @@
|
||||
apiVersion: v2
|
||||
name: peikarband
|
||||
description: Peikarband Cloud Services Platform - Landing Page
|
||||
type: application
|
||||
version: 0.1.0
|
||||
appVersion: "0.1.0"
|
||||
keywords:
|
||||
- cloud
|
||||
- hosting
|
||||
- devops
|
||||
- wordpress
|
||||
maintainers:
|
||||
- name: Peikarband Team
|
||||
email: support@peikarband.ir
|
||||
sources:
|
||||
- http://git.peikarband.ir/ehsan-minadd/peikarband # Internal Git server
|
||||
icon: https://peikarband.ir/logo.png
|
||||
|
||||
164
deploy/helm/peikarband/README.md
Normal file
164
deploy/helm/peikarband/README.md
Normal file
@@ -0,0 +1,164 @@
|
||||
# Peikarband Helm Chart
|
||||
|
||||
Official Helm chart برای deploy کردن Peikarband Cloud Platform.
|
||||
|
||||
## نصب
|
||||
|
||||
### اضافه کردن Repository
|
||||
|
||||
```bash
|
||||
helm repo add peikarband https://peikarband.github.io/charts
|
||||
helm repo update
|
||||
```
|
||||
|
||||
### نصب Chart
|
||||
|
||||
```bash
|
||||
helm install peikarband peikarband/peikarband \
|
||||
--namespace production \
|
||||
--create-namespace \
|
||||
--set image.tag=0.1.0
|
||||
```
|
||||
|
||||
## پیکربندی
|
||||
|
||||
### مهمترین Values
|
||||
|
||||
| Key | Type | Default | Description |
|
||||
|-----|------|---------|-------------|
|
||||
| `replicaCount` | int | `2` | تعداد replicas |
|
||||
| `image.repository` | string | `registry.example.com/peikarband/landing` | Docker image repository |
|
||||
| `image.tag` | string | `latest` | Image tag |
|
||||
| `image.pullPolicy` | string | `IfNotPresent` | Image pull policy |
|
||||
| `resources.limits.cpu` | string | `1000m` | CPU limit |
|
||||
| `resources.limits.memory` | string | `1Gi` | Memory limit |
|
||||
| `autoscaling.enabled` | bool | `true` | فعال کردن HPA |
|
||||
| `autoscaling.minReplicas` | int | `2` | حداقل replicas |
|
||||
| `autoscaling.maxReplicas` | int | `10` | حداکثر replicas |
|
||||
| `ingress.enabled` | bool | `true` | فعال کردن Ingress |
|
||||
| `ingress.hosts[0].host` | string | `peikarband.ir` | Domain |
|
||||
|
||||
### مثالهای استفاده
|
||||
|
||||
#### نصب با مقادیر سفارشی
|
||||
|
||||
```bash
|
||||
helm install peikarband peikarband/peikarband \
|
||||
--set image.tag=0.2.0 \
|
||||
--set replicaCount=3 \
|
||||
--set resources.limits.cpu=2000m \
|
||||
--set ingress.hosts[0].host=example.com
|
||||
```
|
||||
|
||||
#### استفاده از values file
|
||||
|
||||
```bash
|
||||
helm install peikarband peikarband/peikarband \
|
||||
-f my-values.yaml
|
||||
```
|
||||
|
||||
#### Upgrade
|
||||
|
||||
```bash
|
||||
helm upgrade peikarband peikarband/peikarband \
|
||||
--set image.tag=0.3.0 \
|
||||
--reuse-values
|
||||
```
|
||||
|
||||
## Requirements
|
||||
|
||||
- Kubernetes 1.24+
|
||||
- Helm 3.10+
|
||||
- PostgreSQL (external یا in-cluster)
|
||||
- Redis (external یا in-cluster)
|
||||
|
||||
## Values فایلها
|
||||
|
||||
این chart شامل چند values file است:
|
||||
|
||||
- `values.yaml` - مقادیر پیشفرض
|
||||
- `values-production.yaml` - تنظیمات production
|
||||
|
||||
## Components
|
||||
|
||||
این Chart شامل موارد زیر است:
|
||||
|
||||
- **Deployment**: اجرای application
|
||||
- **Service**: ClusterIP service برای internal access
|
||||
- **Ingress**: External access با TLS
|
||||
- **ConfigMap**: تنظیمات application
|
||||
- **ServiceAccount**: Kubernetes service account
|
||||
- **HPA**: Horizontal Pod Autoscaler
|
||||
- **PDB**: Pod Disruption Budget
|
||||
- **NetworkPolicy**: محدودیتهای network
|
||||
|
||||
## پیشنیازها
|
||||
|
||||
### ساخت Secrets
|
||||
|
||||
```bash
|
||||
kubectl create secret generic peikarband-secrets \
|
||||
--from-literal=db-username=USERNAME \
|
||||
--from-literal=db-password=PASSWORD \
|
||||
--from-literal=redis-password=REDIS_PASS \
|
||||
-n production
|
||||
```
|
||||
|
||||
### cert-manager (برای TLS)
|
||||
|
||||
```bash
|
||||
kubectl apply -f https://github.com/cert-manager/cert-manager/releases/download/v1.13.0/cert-manager.yaml
|
||||
```
|
||||
|
||||
## Troubleshooting
|
||||
|
||||
### مشاهده وضعیت
|
||||
|
||||
```bash
|
||||
helm status peikarband -n production
|
||||
kubectl get all -n production
|
||||
kubectl get pods -l app.kubernetes.io/name=peikarband -n production
|
||||
```
|
||||
|
||||
### مشاهده Logs
|
||||
|
||||
```bash
|
||||
kubectl logs -f deployment/peikarband -n production
|
||||
```
|
||||
|
||||
### Rollback
|
||||
|
||||
```bash
|
||||
helm rollback peikarband -n production
|
||||
```
|
||||
|
||||
## توسعه
|
||||
|
||||
### Lint
|
||||
|
||||
```bash
|
||||
helm lint .
|
||||
```
|
||||
|
||||
### Template
|
||||
|
||||
```bash
|
||||
helm template peikarband . --debug
|
||||
```
|
||||
|
||||
### Package
|
||||
|
||||
```bash
|
||||
helm package .
|
||||
```
|
||||
|
||||
## لایسنس
|
||||
|
||||
MIT
|
||||
|
||||
## پشتیبانی
|
||||
|
||||
- Email: support@peikarband.ir
|
||||
- Website: https://peikarband.ir
|
||||
- Docs: https://docs.peikarband.ir
|
||||
|
||||
43
deploy/helm/peikarband/templates/NOTES.txt
Normal file
43
deploy/helm/peikarband/templates/NOTES.txt
Normal file
@@ -0,0 +1,43 @@
|
||||
Thank you for installing {{ .Chart.Name }}.
|
||||
|
||||
Your release is named {{ .Release.Name }}.
|
||||
|
||||
To learn more about the release, try:
|
||||
|
||||
$ helm status {{ .Release.Name }}
|
||||
$ helm get all {{ .Release.Name }}
|
||||
|
||||
1. Get the application URL by running these commands:
|
||||
{{- if .Values.ingress.enabled }}
|
||||
{{- range $host := .Values.ingress.hosts }}
|
||||
{{- range .paths }}
|
||||
http{{ if $.Values.ingress.tls }}s{{ end }}://{{ $host.host }}{{ .path }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- else if contains "NodePort" .Values.service.type }}
|
||||
export NODE_PORT=$(kubectl get --namespace {{ .Release.Namespace }} -o jsonpath="{.spec.ports[0].nodePort}" services {{ include "peikarband.fullname" . }})
|
||||
export NODE_IP=$(kubectl get nodes --namespace {{ .Release.Namespace }} -o jsonpath="{.items[0].status.addresses[0].address}")
|
||||
echo http://$NODE_IP:$NODE_PORT
|
||||
{{- else if contains "LoadBalancer" .Values.service.type }}
|
||||
NOTE: It may take a few minutes for the LoadBalancer IP to be available.
|
||||
You can watch the status of by running 'kubectl get --namespace {{ .Release.Namespace }} svc -w {{ include "peikarband.fullname" . }}'
|
||||
export SERVICE_IP=$(kubectl get svc --namespace {{ .Release.Namespace }} {{ include "peikarband.fullname" . }} --template "{{"{{ range (index .status.loadBalancer.ingress 0) }}{{.}}{{ end }}"}}")
|
||||
echo http://$SERVICE_IP:{{ .Values.service.frontend.port }}
|
||||
{{- else if contains "ClusterIP" .Values.service.type }}
|
||||
export POD_NAME=$(kubectl get pods --namespace {{ .Release.Namespace }} -l "app.kubernetes.io/name={{ include "peikarband.name" . }},app.kubernetes.io/instance={{ .Release.Name }}" -o jsonpath="{.items[0].metadata.name}")
|
||||
export CONTAINER_PORT=$(kubectl get pod --namespace {{ .Release.Namespace }} $POD_NAME -o jsonpath="{.spec.containers[0].ports[0].containerPort}")
|
||||
echo "Visit http://127.0.0.1:8080 to use your application"
|
||||
kubectl --namespace {{ .Release.Namespace }} port-forward $POD_NAME 8080:$CONTAINER_PORT
|
||||
{{- end }}
|
||||
|
||||
2. Check the deployment status:
|
||||
kubectl get deployment {{ include "peikarband.fullname" . }} -n {{ .Release.Namespace }}
|
||||
|
||||
3. View logs:
|
||||
kubectl logs -f deployment/{{ include "peikarband.fullname" . }} -n {{ .Release.Namespace }}
|
||||
|
||||
4. Scale the deployment:
|
||||
kubectl scale deployment {{ include "peikarband.fullname" . }} --replicas=3 -n {{ .Release.Namespace }}
|
||||
|
||||
Peikarband - Cloud Services Platform
|
||||
|
||||
61
deploy/helm/peikarband/templates/_helpers.tpl
Normal file
61
deploy/helm/peikarband/templates/_helpers.tpl
Normal file
@@ -0,0 +1,61 @@
|
||||
{{/*
|
||||
Expand the name of the chart.
|
||||
*/}}
|
||||
{{- define "peikarband.name" -}}
|
||||
{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" }}
|
||||
{{- end }}
|
||||
|
||||
{{/*
|
||||
Create a default fully qualified app name.
|
||||
*/}}
|
||||
{{- define "peikarband.fullname" -}}
|
||||
{{- if .Values.fullnameOverride }}
|
||||
{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" }}
|
||||
{{- else }}
|
||||
{{- $name := default .Chart.Name .Values.nameOverride }}
|
||||
{{- if contains $name .Release.Name }}
|
||||
{{- .Release.Name | trunc 63 | trimSuffix "-" }}
|
||||
{{- else }}
|
||||
{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
|
||||
{{/*
|
||||
Create chart name and version as used by the chart label.
|
||||
*/}}
|
||||
{{- define "peikarband.chart" -}}
|
||||
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }}
|
||||
{{- end }}
|
||||
|
||||
{{/*
|
||||
Common labels
|
||||
*/}}
|
||||
{{- define "peikarband.labels" -}}
|
||||
helm.sh/chart: {{ include "peikarband.chart" . }}
|
||||
{{ include "peikarband.selectorLabels" . }}
|
||||
{{- if .Chart.AppVersion }}
|
||||
app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
|
||||
{{- end }}
|
||||
app.kubernetes.io/managed-by: {{ .Release.Service }}
|
||||
{{- end }}
|
||||
|
||||
{{/*
|
||||
Selector labels
|
||||
*/}}
|
||||
{{- define "peikarband.selectorLabels" -}}
|
||||
app.kubernetes.io/name: {{ include "peikarband.name" . }}
|
||||
app.kubernetes.io/instance: {{ .Release.Name }}
|
||||
{{- end }}
|
||||
|
||||
{{/*
|
||||
Create the name of the service account to use
|
||||
*/}}
|
||||
{{- define "peikarband.serviceAccountName" -}}
|
||||
{{- if .Values.serviceAccount.create }}
|
||||
{{- default (include "peikarband.fullname" .) .Values.serviceAccount.name }}
|
||||
{{- else }}
|
||||
{{- default "default" .Values.serviceAccount.name }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
|
||||
9
deploy/helm/peikarband/templates/configmap.yaml
Normal file
9
deploy/helm/peikarband/templates/configmap.yaml
Normal file
@@ -0,0 +1,9 @@
|
||||
apiVersion: v1
|
||||
kind: ConfigMap
|
||||
metadata:
|
||||
name: {{ include "peikarband.fullname" . }}
|
||||
labels:
|
||||
{{- include "peikarband.labels" . | nindent 4 }}
|
||||
data:
|
||||
{{- toYaml .Values.configMap.data | nindent 2 }}
|
||||
|
||||
117
deploy/helm/peikarband/templates/deployment.yaml
Normal file
117
deploy/helm/peikarband/templates/deployment.yaml
Normal file
@@ -0,0 +1,117 @@
|
||||
apiVersion: apps/v1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
name: {{ include "peikarband.fullname" . }}
|
||||
labels:
|
||||
{{- include "peikarband.labels" . | nindent 4 }}
|
||||
spec:
|
||||
{{- if not .Values.autoscaling.enabled }}
|
||||
replicas: {{ .Values.replicaCount }}
|
||||
{{- end }}
|
||||
selector:
|
||||
matchLabels:
|
||||
{{- include "peikarband.selectorLabels" . | nindent 6 }}
|
||||
template:
|
||||
metadata:
|
||||
annotations:
|
||||
checksum/config: {{ include (print $.Template.BasePath "/configmap.yaml") . | sha256sum }}
|
||||
{{- with .Values.podAnnotations }}
|
||||
{{- toYaml . | nindent 8 }}
|
||||
{{- end }}
|
||||
labels:
|
||||
{{- include "peikarband.selectorLabels" . | nindent 8 }}
|
||||
spec:
|
||||
{{- with .Values.imagePullSecrets }}
|
||||
imagePullSecrets:
|
||||
{{- toYaml . | nindent 8 }}
|
||||
{{- end }}
|
||||
serviceAccountName: {{ include "peikarband.serviceAccountName" . }}
|
||||
securityContext:
|
||||
{{- toYaml .Values.podSecurityContext | nindent 8 }}
|
||||
containers:
|
||||
- name: {{ .Chart.Name }}
|
||||
securityContext:
|
||||
{{- toYaml .Values.securityContext | nindent 12 }}
|
||||
image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}"
|
||||
imagePullPolicy: {{ .Values.image.pullPolicy }}
|
||||
ports:
|
||||
- name: backend
|
||||
containerPort: {{ .Values.service.backend.targetPort }}
|
||||
protocol: TCP
|
||||
- name: frontend
|
||||
containerPort: {{ .Values.service.frontend.targetPort }}
|
||||
protocol: TCP
|
||||
livenessProbe:
|
||||
{{- toYaml .Values.livenessProbe | nindent 12 }}
|
||||
readinessProbe:
|
||||
{{- toYaml .Values.readinessProbe | nindent 12 }}
|
||||
resources:
|
||||
{{- toYaml .Values.resources | nindent 12 }}
|
||||
env:
|
||||
- name: API_URL
|
||||
value: {{ .Values.reflex.apiUrl | quote }}
|
||||
- name: FRONTEND_PORT
|
||||
value: {{ .Values.service.frontend.targetPort | quote }}
|
||||
- name: BACKEND_PORT
|
||||
value: {{ .Values.service.backend.targetPort | quote }}
|
||||
{{- if .Values.postgresql.enabled }}
|
||||
- name: DATABASE_HOST
|
||||
value: {{ .Values.postgresql.external.host }}
|
||||
- name: DATABASE_PORT
|
||||
value: {{ .Values.postgresql.external.port | quote }}
|
||||
- name: DATABASE_NAME
|
||||
value: {{ .Values.postgresql.external.database }}
|
||||
- name: DATABASE_USER
|
||||
valueFrom:
|
||||
secretKeyRef:
|
||||
name: {{ .Values.postgresql.external.usernameSecret.name }}
|
||||
key: {{ .Values.postgresql.external.usernameSecret.key }}
|
||||
- name: DATABASE_PASSWORD
|
||||
valueFrom:
|
||||
secretKeyRef:
|
||||
name: {{ .Values.postgresql.external.passwordSecret.name }}
|
||||
key: {{ .Values.postgresql.external.passwordSecret.key }}
|
||||
- name: DATABASE_URL
|
||||
value: "postgresql://$(DATABASE_USER):$(DATABASE_PASSWORD)@$(DATABASE_HOST):$(DATABASE_PORT)/$(DATABASE_NAME)"
|
||||
{{- end }}
|
||||
{{- if .Values.redis.enabled }}
|
||||
- name: REDIS_HOST
|
||||
value: {{ .Values.redis.external.host }}
|
||||
- name: REDIS_PORT
|
||||
value: {{ .Values.redis.external.port | quote }}
|
||||
{{- if .Values.redis.external.passwordSecret }}
|
||||
- name: REDIS_PASSWORD
|
||||
valueFrom:
|
||||
secretKeyRef:
|
||||
name: {{ .Values.redis.external.passwordSecret.name }}
|
||||
key: {{ .Values.redis.external.passwordSecret.key }}
|
||||
- name: REDIS_URL
|
||||
value: "redis://:$(REDIS_PASSWORD)@$(REDIS_HOST):$(REDIS_PORT)/0"
|
||||
{{- else }}
|
||||
- name: REDIS_URL
|
||||
value: "redis://$(REDIS_HOST):$(REDIS_PORT)/0"
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- range .Values.env }}
|
||||
- name: {{ .name }}
|
||||
value: {{ .value | quote }}
|
||||
{{- end }}
|
||||
envFrom:
|
||||
- configMapRef:
|
||||
name: {{ include "peikarband.fullname" . }}
|
||||
{{- with .Values.envFrom }}
|
||||
{{- toYaml . | nindent 10 }}
|
||||
{{- end }}
|
||||
{{- with .Values.nodeSelector }}
|
||||
nodeSelector:
|
||||
{{- toYaml . | nindent 8 }}
|
||||
{{- end }}
|
||||
{{- with .Values.affinity }}
|
||||
affinity:
|
||||
{{- toYaml . | nindent 8 }}
|
||||
{{- end }}
|
||||
{{- with .Values.tolerations }}
|
||||
tolerations:
|
||||
{{- toYaml . | nindent 8 }}
|
||||
{{- end }}
|
||||
|
||||
12
deploy/helm/peikarband/templates/docker-registry.yaml
Normal file
12
deploy/helm/peikarband/templates/docker-registry.yaml
Normal file
@@ -0,0 +1,12 @@
|
||||
{{- if .Values.registrySecret.enabled }}
|
||||
apiVersion: v1
|
||||
kind: Secret
|
||||
metadata:
|
||||
name: {{ .Values.registrySecret.name }}
|
||||
labels:
|
||||
{{- include "peikarband.labels" . | nindent 4 }}
|
||||
type: kubernetes.io/dockerconfigjson
|
||||
data:
|
||||
.dockerconfigjson: {{ printf "{\"auths\":{\"%s\":{\"username\":\"%s\",\"password\":\"%s\",\"auth\":\"%s\"}}}" .Values.registrySecret.server .Values.registrySecret.username .Values.registrySecret.password (printf "%s:%s" .Values.registrySecret.username .Values.registrySecret.password | b64enc) | b64enc }}
|
||||
{{- end }}
|
||||
|
||||
33
deploy/helm/peikarband/templates/hpa.yaml
Normal file
33
deploy/helm/peikarband/templates/hpa.yaml
Normal file
@@ -0,0 +1,33 @@
|
||||
{{- if .Values.autoscaling.enabled }}
|
||||
apiVersion: autoscaling/v2
|
||||
kind: HorizontalPodAutoscaler
|
||||
metadata:
|
||||
name: {{ include "peikarband.fullname" . }}
|
||||
labels:
|
||||
{{- include "peikarband.labels" . | nindent 4 }}
|
||||
spec:
|
||||
scaleTargetRef:
|
||||
apiVersion: apps/v1
|
||||
kind: Deployment
|
||||
name: {{ include "peikarband.fullname" . }}
|
||||
minReplicas: {{ .Values.autoscaling.minReplicas }}
|
||||
maxReplicas: {{ .Values.autoscaling.maxReplicas }}
|
||||
metrics:
|
||||
{{- if .Values.autoscaling.targetCPUUtilizationPercentage }}
|
||||
- type: Resource
|
||||
resource:
|
||||
name: cpu
|
||||
target:
|
||||
type: Utilization
|
||||
averageUtilization: {{ .Values.autoscaling.targetCPUUtilizationPercentage }}
|
||||
{{- end }}
|
||||
{{- if .Values.autoscaling.targetMemoryUtilizationPercentage }}
|
||||
- type: Resource
|
||||
resource:
|
||||
name: memory
|
||||
target:
|
||||
type: Utilization
|
||||
averageUtilization: {{ .Values.autoscaling.targetMemoryUtilizationPercentage }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
|
||||
85
deploy/helm/peikarband/templates/ingress.yaml
Normal file
85
deploy/helm/peikarband/templates/ingress.yaml
Normal file
@@ -0,0 +1,85 @@
|
||||
{{- if .Values.ingress.enabled -}}
|
||||
# Frontend Ingress (peikarband.ir -> port 3000)
|
||||
apiVersion: networking.k8s.io/v1
|
||||
kind: Ingress
|
||||
metadata:
|
||||
name: {{ include "peikarband.fullname" . }}-frontend
|
||||
labels:
|
||||
{{- include "peikarband.labels" . | nindent 4 }}
|
||||
{{- with .Values.ingress.annotations }}
|
||||
annotations:
|
||||
{{- toYaml . | nindent 4 }}
|
||||
{{- end }}
|
||||
spec:
|
||||
{{- if .Values.ingress.className }}
|
||||
ingressClassName: {{ .Values.ingress.className }}
|
||||
{{- end }}
|
||||
{{- if .Values.ingress.tls }}
|
||||
tls:
|
||||
{{- range .Values.ingress.tls }}
|
||||
- hosts:
|
||||
{{- range .hosts }}
|
||||
- {{ . | quote }}
|
||||
{{- end }}
|
||||
secretName: {{ .secretName }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
rules:
|
||||
{{- range .Values.ingress.hosts }}
|
||||
- host: {{ .host | quote }}
|
||||
http:
|
||||
paths:
|
||||
{{- range .paths }}
|
||||
- path: {{ .path }}
|
||||
pathType: {{ .pathType }}
|
||||
backend:
|
||||
service:
|
||||
name: {{ include "peikarband.fullname" $ }}
|
||||
port:
|
||||
number: {{ $.Values.service.frontend.port }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
|
||||
{{- if .Values.ingress.apiEnabled -}}
|
||||
# Backend API Ingress (api.peikarband.ir -> port 8000)
|
||||
apiVersion: networking.k8s.io/v1
|
||||
kind: Ingress
|
||||
metadata:
|
||||
name: {{ include "peikarband.fullname" . }}-api
|
||||
labels:
|
||||
{{- include "peikarband.labels" . | nindent 4 }}
|
||||
{{- with .Values.ingress.apiAnnotations }}
|
||||
annotations:
|
||||
{{- toYaml . | nindent 4 }}
|
||||
{{- end }}
|
||||
spec:
|
||||
{{- if .Values.ingress.className }}
|
||||
ingressClassName: {{ .Values.ingress.className }}
|
||||
{{- end }}
|
||||
{{- if .Values.ingress.apiTls }}
|
||||
tls:
|
||||
{{- range .Values.ingress.apiTls }}
|
||||
- hosts:
|
||||
{{- range .hosts }}
|
||||
- {{ . | quote }}
|
||||
{{- end }}
|
||||
secretName: {{ .secretName }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
rules:
|
||||
{{- range .Values.ingress.apiHosts }}
|
||||
- host: {{ .host | quote }}
|
||||
http:
|
||||
paths:
|
||||
{{- range .paths }}
|
||||
- path: {{ .path }}
|
||||
pathType: {{ .pathType }}
|
||||
backend:
|
||||
service:
|
||||
name: {{ include "peikarband.fullname" $ }}
|
||||
port:
|
||||
number: {{ $.Values.service.backend.port }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
19
deploy/helm/peikarband/templates/networkpolicy.yaml
Normal file
19
deploy/helm/peikarband/templates/networkpolicy.yaml
Normal file
@@ -0,0 +1,19 @@
|
||||
{{- if .Values.networkPolicy.enabled }}
|
||||
apiVersion: networking.k8s.io/v1
|
||||
kind: NetworkPolicy
|
||||
metadata:
|
||||
name: {{ include "peikarband.fullname" . }}
|
||||
labels:
|
||||
{{- include "peikarband.labels" . | nindent 4 }}
|
||||
spec:
|
||||
podSelector:
|
||||
matchLabels:
|
||||
{{- include "peikarband.selectorLabels" . | nindent 6 }}
|
||||
policyTypes:
|
||||
{{- toYaml .Values.networkPolicy.policyTypes | nindent 4 }}
|
||||
ingress:
|
||||
{{- toYaml .Values.networkPolicy.ingress | nindent 4 }}
|
||||
egress:
|
||||
{{- toYaml .Values.networkPolicy.egress | nindent 4 }}
|
||||
{{- end }}
|
||||
|
||||
14
deploy/helm/peikarband/templates/pdb.yaml
Normal file
14
deploy/helm/peikarband/templates/pdb.yaml
Normal file
@@ -0,0 +1,14 @@
|
||||
{{- if .Values.podDisruptionBudget.enabled }}
|
||||
apiVersion: policy/v1
|
||||
kind: PodDisruptionBudget
|
||||
metadata:
|
||||
name: {{ include "peikarband.fullname" . }}
|
||||
labels:
|
||||
{{- include "peikarband.labels" . | nindent 4 }}
|
||||
spec:
|
||||
minAvailable: {{ .Values.podDisruptionBudget.minAvailable }}
|
||||
selector:
|
||||
matchLabels:
|
||||
{{- include "peikarband.selectorLabels" . | nindent 6 }}
|
||||
{{- end }}
|
||||
|
||||
20
deploy/helm/peikarband/templates/service.yaml
Normal file
20
deploy/helm/peikarband/templates/service.yaml
Normal file
@@ -0,0 +1,20 @@
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
name: {{ include "peikarband.fullname" . }}
|
||||
labels:
|
||||
{{- include "peikarband.labels" . | nindent 4 }}
|
||||
spec:
|
||||
type: {{ .Values.service.type }}
|
||||
ports:
|
||||
- port: {{ .Values.service.backend.port }}
|
||||
targetPort: {{ .Values.service.backend.targetPort }}
|
||||
protocol: TCP
|
||||
name: backend
|
||||
- port: {{ .Values.service.frontend.port }}
|
||||
targetPort: {{ .Values.service.frontend.targetPort }}
|
||||
protocol: TCP
|
||||
name: frontend
|
||||
selector:
|
||||
{{- include "peikarband.selectorLabels" . | nindent 4 }}
|
||||
|
||||
13
deploy/helm/peikarband/templates/serviceaccount.yaml
Normal file
13
deploy/helm/peikarband/templates/serviceaccount.yaml
Normal file
@@ -0,0 +1,13 @@
|
||||
{{- if .Values.serviceAccount.create -}}
|
||||
apiVersion: v1
|
||||
kind: ServiceAccount
|
||||
metadata:
|
||||
name: {{ include "peikarband.serviceAccountName" . }}
|
||||
labels:
|
||||
{{- include "peikarband.labels" . | nindent 4 }}
|
||||
{{- with .Values.serviceAccount.annotations }}
|
||||
annotations:
|
||||
{{- toYaml . | nindent 4 }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
|
||||
155
deploy/helm/peikarband/values-production.yaml
Normal file
155
deploy/helm/peikarband/values-production.yaml
Normal file
@@ -0,0 +1,155 @@
|
||||
# Production-specific values for peikarband
|
||||
# This file overrides default values.yaml for production
|
||||
|
||||
replicaCount: 1
|
||||
|
||||
image:
|
||||
pullPolicy: Always
|
||||
|
||||
# Auto-create registry secret
|
||||
registrySecret:
|
||||
enabled: true
|
||||
name: hub-registry-secret
|
||||
server: hub.peikarband.ir
|
||||
username: "admin"
|
||||
password: "5459ed7590d37656410fae38bdf59eb7ee33b68cd4c"
|
||||
|
||||
imagePullSecrets:
|
||||
- name: hub-registry-secret
|
||||
|
||||
# Auto-create application secrets (database, redis, etc)
|
||||
appSecrets:
|
||||
enabled: false # Set to true if you need database/redis
|
||||
name: peikarband-prod-secrets
|
||||
dbUsername: ""
|
||||
dbPassword: ""
|
||||
redisPassword: ""
|
||||
|
||||
# Reflex configuration for production
|
||||
reflex:
|
||||
apiUrl: "https://api.peikarband.ir" # Production API URL (backend)
|
||||
|
||||
podAnnotations:
|
||||
prometheus.io/scrape: "true"
|
||||
prometheus.io/port: "8000"
|
||||
prometheus.io/path: "/metrics"
|
||||
|
||||
resources:
|
||||
limits:
|
||||
cpu: 500m
|
||||
memory: 512Mi
|
||||
requests:
|
||||
cpu: 100m
|
||||
memory: 256Mi
|
||||
|
||||
autoscaling:
|
||||
enabled: false
|
||||
minReplicas: 1
|
||||
maxReplicas: 5
|
||||
targetCPUUtilizationPercentage: 70
|
||||
targetMemoryUtilizationPercentage: 80
|
||||
|
||||
ingress:
|
||||
enabled: true
|
||||
className: "traefik"
|
||||
annotations:
|
||||
cert-manager.io/cluster-issuer: "letsencrypt-prod"
|
||||
traefik.ingress.kubernetes.io/router.entrypoints: "websecure"
|
||||
traefik.ingress.kubernetes.io/router.tls: "true"
|
||||
# Rate limiting and body size should be configured via Traefik Middleware
|
||||
# Example: traefik.ingress.kubernetes.io/router.middlewares: default-ratelimit@kubernetescrd
|
||||
hosts:
|
||||
- host: peikarband.ir
|
||||
paths:
|
||||
- path: /
|
||||
pathType: Prefix
|
||||
- host: www.peikarband.ir
|
||||
paths:
|
||||
- path: /
|
||||
pathType: Prefix
|
||||
tls:
|
||||
- secretName: peikarband-tls
|
||||
hosts:
|
||||
- peikarband.ir
|
||||
- www.peikarband.ir
|
||||
|
||||
# Backend API Ingress (api.peikarband.ir -> port 8000)
|
||||
apiEnabled: true
|
||||
apiAnnotations:
|
||||
cert-manager.io/cluster-issuer: "letsencrypt-prod"
|
||||
traefik.ingress.kubernetes.io/router.entrypoints: "websecure"
|
||||
traefik.ingress.kubernetes.io/router.tls: "true"
|
||||
apiHosts:
|
||||
- host: api.peikarband.ir
|
||||
paths:
|
||||
- path: /
|
||||
pathType: Prefix
|
||||
apiTls:
|
||||
- secretName: peikarband-api-tls
|
||||
hosts:
|
||||
- api.peikarband.ir
|
||||
|
||||
postgresql:
|
||||
enabled: false # Using SQLite for now
|
||||
external:
|
||||
host: "postgres-prod.default.svc.cluster.local"
|
||||
port: "5432"
|
||||
database: "peikarband_prod"
|
||||
usernameSecret:
|
||||
name: "peikarband-prod-secrets"
|
||||
key: "db-username"
|
||||
passwordSecret:
|
||||
name: "peikarband-prod-secrets"
|
||||
key: "db-password"
|
||||
|
||||
redis:
|
||||
enabled: false # Not used yet
|
||||
external:
|
||||
host: "redis-prod.default.svc.cluster.local"
|
||||
port: "6379"
|
||||
passwordSecret:
|
||||
name: "peikarband-prod-secrets"
|
||||
key: "redis-password"
|
||||
|
||||
# Override readiness probe for production
|
||||
# Reflex startup time: 30-60 seconds (per deployment checklist)
|
||||
# Using /ping endpoint (simpler, faster response)
|
||||
readinessProbe:
|
||||
httpGet:
|
||||
path: /ping
|
||||
port: 8000
|
||||
initialDelaySeconds: 60 # Allow Reflex to fully start (30-60s expected)
|
||||
periodSeconds: 10
|
||||
timeoutSeconds: 5
|
||||
failureThreshold: 6 # Allow 6 failures = 60s grace period
|
||||
|
||||
# Override liveness probe
|
||||
# Using /live endpoint which is specifically designed for liveness checks
|
||||
livenessProbe:
|
||||
httpGet:
|
||||
path: /live
|
||||
port: 8000
|
||||
initialDelaySeconds: 90 # More time for liveness (after readiness)
|
||||
periodSeconds: 15
|
||||
timeoutSeconds: 5
|
||||
failureThreshold: 3
|
||||
|
||||
configMap:
|
||||
data:
|
||||
APP_NAME: "peikarband"
|
||||
LOG_LEVEL: "warning"
|
||||
ENVIRONMENT: "prod"
|
||||
|
||||
podDisruptionBudget:
|
||||
enabled: false
|
||||
minAvailable: 1
|
||||
|
||||
networkPolicy:
|
||||
enabled: true
|
||||
|
||||
monitoring:
|
||||
serviceMonitor:
|
||||
enabled: true
|
||||
interval: 30s
|
||||
scrapeTimeout: 10s
|
||||
|
||||
68
deploy/helm/peikarband/values-staging.yaml
Normal file
68
deploy/helm/peikarband/values-staging.yaml
Normal file
@@ -0,0 +1,68 @@
|
||||
# Staging-specific values for peikarband
|
||||
|
||||
replicaCount: 1
|
||||
|
||||
image:
|
||||
pullPolicy: Always
|
||||
|
||||
# Reflex configuration for staging
|
||||
reflex:
|
||||
apiUrl: "https://staging.peikarband.ir" # Staging API URL
|
||||
|
||||
resources:
|
||||
limits:
|
||||
cpu: 500m
|
||||
memory: 512Mi
|
||||
requests:
|
||||
cpu: 100m
|
||||
memory: 256Mi
|
||||
|
||||
autoscaling:
|
||||
enabled: false
|
||||
|
||||
ingress:
|
||||
enabled: true
|
||||
className: "traefik"
|
||||
annotations:
|
||||
cert-manager.io/cluster-issuer: "letsencrypt-staging"
|
||||
traefik.ingress.kubernetes.io/router.entrypoints: "websecure"
|
||||
traefik.ingress.kubernetes.io/router.tls: "true"
|
||||
hosts:
|
||||
- host: staging.peikarband.ir
|
||||
paths:
|
||||
- path: /
|
||||
pathType: Prefix
|
||||
tls:
|
||||
- secretName: peikarband-staging-tls
|
||||
hosts:
|
||||
- staging.peikarband.ir
|
||||
|
||||
postgresql:
|
||||
enabled: false # Using SQLite for now
|
||||
external:
|
||||
host: "postgres-staging.default.svc.cluster.local"
|
||||
port: "5432"
|
||||
database: "peikarband_staging"
|
||||
|
||||
redis:
|
||||
enabled: false # Not used yet
|
||||
external:
|
||||
host: "redis-staging.default.svc.cluster.local"
|
||||
port: "6379"
|
||||
|
||||
configMap:
|
||||
data:
|
||||
APP_NAME: "peikarband-staging"
|
||||
LOG_LEVEL: "debug"
|
||||
ENVIRONMENT: "dev"
|
||||
|
||||
podDisruptionBudget:
|
||||
enabled: false
|
||||
|
||||
networkPolicy:
|
||||
enabled: false
|
||||
|
||||
monitoring:
|
||||
serviceMonitor:
|
||||
enabled: false
|
||||
|
||||
231
deploy/helm/peikarband/values.yaml
Normal file
231
deploy/helm/peikarband/values.yaml
Normal file
@@ -0,0 +1,231 @@
|
||||
# Default values for peikarband
|
||||
# This is a YAML-formatted file.
|
||||
|
||||
replicaCount: 2
|
||||
|
||||
image:
|
||||
repository: hub.peikarband.ir/peikarband/landing # Match CI/CD registry
|
||||
pullPolicy: IfNotPresent
|
||||
tag: "latest"
|
||||
|
||||
imagePullSecrets: []
|
||||
|
||||
# Registry secret auto-creation (for private registry)
|
||||
registrySecret:
|
||||
enabled: false # Set to true in production values
|
||||
name: hub-registry-secret
|
||||
server: hub.peikarband.ir
|
||||
username: "" # MUST be set via ArgoCD values or --set (DO NOT commit passwords)
|
||||
password: "" # MUST be set via ArgoCD values or --set (DO NOT commit passwords)
|
||||
|
||||
# Application secrets (database, redis, etc)
|
||||
appSecrets:
|
||||
enabled: false # Set to true in production values
|
||||
name: peikarband-prod-secrets
|
||||
dbUsername: "" # Set via ArgoCD values or --set
|
||||
dbPassword: "" # Set via ArgoCD values or --set
|
||||
redisPassword: "" # Set via ArgoCD values or --set
|
||||
|
||||
nameOverride: ""
|
||||
fullnameOverride: ""
|
||||
|
||||
serviceAccount:
|
||||
create: true
|
||||
annotations: {}
|
||||
name: ""
|
||||
|
||||
podAnnotations:
|
||||
prometheus.io/scrape: "true"
|
||||
prometheus.io/port: "8000"
|
||||
prometheus.io/path: "/metrics"
|
||||
|
||||
podSecurityContext:
|
||||
runAsNonRoot: true
|
||||
runAsUser: 1000
|
||||
fsGroup: 1000
|
||||
|
||||
securityContext:
|
||||
allowPrivilegeEscalation: false
|
||||
capabilities:
|
||||
drop:
|
||||
- ALL
|
||||
readOnlyRootFilesystem: false
|
||||
|
||||
service:
|
||||
type: ClusterIP
|
||||
backend:
|
||||
port: 8000
|
||||
targetPort: 8000
|
||||
frontend:
|
||||
port: 3000
|
||||
targetPort: 3000
|
||||
|
||||
ingress:
|
||||
enabled: true
|
||||
className: "traefik"
|
||||
annotations:
|
||||
cert-manager.io/cluster-issuer: "letsencrypt-prod"
|
||||
traefik.ingress.kubernetes.io/router.entrypoints: "websecure"
|
||||
traefik.ingress.kubernetes.io/router.tls: "true"
|
||||
hosts:
|
||||
- host: peikarband.ir
|
||||
paths:
|
||||
- path: /
|
||||
pathType: Prefix
|
||||
- host: www.peikarband.ir
|
||||
paths:
|
||||
- path: /
|
||||
pathType: Prefix
|
||||
tls:
|
||||
- secretName: peikarband-tls
|
||||
hosts:
|
||||
- peikarband.ir
|
||||
- www.peikarband.ir
|
||||
|
||||
# Backend API Ingress (api.peikarband.ir -> port 8000)
|
||||
apiEnabled: false # Enable in production values
|
||||
apiAnnotations:
|
||||
cert-manager.io/cluster-issuer: "letsencrypt-prod"
|
||||
traefik.ingress.kubernetes.io/router.entrypoints: "websecure"
|
||||
traefik.ingress.kubernetes.io/router.tls: "true"
|
||||
apiHosts: []
|
||||
apiTls: []
|
||||
|
||||
resources:
|
||||
limits:
|
||||
cpu: 1000m
|
||||
memory: 1Gi
|
||||
requests:
|
||||
cpu: 250m
|
||||
memory: 512Mi
|
||||
|
||||
autoscaling:
|
||||
enabled: true
|
||||
minReplicas: 2
|
||||
maxReplicas: 10
|
||||
targetCPUUtilizationPercentage: 70
|
||||
targetMemoryUtilizationPercentage: 80
|
||||
|
||||
nodeSelector: {}
|
||||
|
||||
tolerations: []
|
||||
|
||||
affinity:
|
||||
podAntiAffinity:
|
||||
preferredDuringSchedulingIgnoredDuringExecution:
|
||||
- weight: 100
|
||||
podAffinityTerm:
|
||||
labelSelector:
|
||||
matchExpressions:
|
||||
- key: app.kubernetes.io/name
|
||||
operator: In
|
||||
values:
|
||||
- peikarband
|
||||
topologyKey: kubernetes.io/hostname
|
||||
|
||||
livenessProbe:
|
||||
httpGet:
|
||||
path: /ping
|
||||
port: 8000
|
||||
initialDelaySeconds: 30
|
||||
periodSeconds: 10
|
||||
timeoutSeconds: 5
|
||||
failureThreshold: 3
|
||||
|
||||
readinessProbe:
|
||||
httpGet:
|
||||
path: /ping
|
||||
port: 8000
|
||||
initialDelaySeconds: 10
|
||||
periodSeconds: 5
|
||||
timeoutSeconds: 3
|
||||
failureThreshold: 3
|
||||
|
||||
env:
|
||||
- name: REFLEX_ENV
|
||||
value: "prod"
|
||||
- name: PYTHONUNBUFFERED
|
||||
value: "1"
|
||||
|
||||
envFrom: []
|
||||
|
||||
# Reflex-specific configuration
|
||||
reflex:
|
||||
apiUrl: "http://localhost:8000" # Override in production values
|
||||
|
||||
configMap:
|
||||
data:
|
||||
APP_NAME: "peikarband"
|
||||
LOG_LEVEL: "info"
|
||||
ENVIRONMENT: "prod"
|
||||
|
||||
secretRef:
|
||||
name: "peikarband-secrets"
|
||||
|
||||
postgresql:
|
||||
enabled: false
|
||||
external:
|
||||
host: "postgres.default.svc.cluster.local"
|
||||
port: "5432"
|
||||
database: "peikarband"
|
||||
usernameSecret:
|
||||
name: "peikarband-secrets"
|
||||
key: "db-username"
|
||||
passwordSecret:
|
||||
name: "peikarband-secrets"
|
||||
key: "db-password"
|
||||
|
||||
redis:
|
||||
enabled: false
|
||||
external:
|
||||
host: "redis.default.svc.cluster.local"
|
||||
port: "6379"
|
||||
passwordSecret:
|
||||
name: "peikarband-secrets"
|
||||
key: "redis-password"
|
||||
|
||||
persistence:
|
||||
enabled: false
|
||||
storageClass: ""
|
||||
accessMode: ReadWriteOnce
|
||||
size: 10Gi
|
||||
|
||||
podDisruptionBudget:
|
||||
enabled: true
|
||||
minAvailable: 1
|
||||
|
||||
networkPolicy:
|
||||
enabled: true
|
||||
policyTypes:
|
||||
- Ingress
|
||||
- Egress
|
||||
ingress:
|
||||
# Allow traffic from Traefik and any ingress controller
|
||||
- from:
|
||||
- namespaceSelector: {}
|
||||
ports:
|
||||
- protocol: TCP
|
||||
port: 8000
|
||||
- protocol: TCP
|
||||
port: 3000
|
||||
egress:
|
||||
- to:
|
||||
- namespaceSelector: {}
|
||||
ports:
|
||||
- protocol: TCP
|
||||
port: 5432 # PostgreSQL
|
||||
- protocol: TCP
|
||||
port: 6379 # Redis
|
||||
- protocol: TCP
|
||||
port: 443 # HTTPS
|
||||
- protocol: TCP
|
||||
port: 80 # HTTP
|
||||
- protocol: UDP
|
||||
port: 53 # DNS
|
||||
|
||||
monitoring:
|
||||
serviceMonitor:
|
||||
enabled: false
|
||||
interval: 30s
|
||||
scrapeTimeout: 10s
|
||||
|
||||
Reference in New Issue
Block a user