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:
@@ -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/
|
||||
|
||||
@@ -1,18 +0,0 @@
|
||||
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
|
||||
|
||||
@@ -1,164 +0,0 @@
|
||||
# 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
|
||||
|
||||
@@ -1,43 +0,0 @@
|
||||
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
|
||||
|
||||
@@ -1,61 +0,0 @@
|
||||
{{/*
|
||||
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 }}
|
||||
|
||||
@@ -1,9 +0,0 @@
|
||||
apiVersion: v1
|
||||
kind: ConfigMap
|
||||
metadata:
|
||||
name: {{ include "peikarband.fullname" . }}
|
||||
labels:
|
||||
{{- include "peikarband.labels" . | nindent 4 }}
|
||||
data:
|
||||
{{- toYaml .Values.configMap.data | nindent 2 }}
|
||||
|
||||
@@ -1,117 +0,0 @@
|
||||
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 }}
|
||||
|
||||
@@ -1,12 +0,0 @@
|
||||
{{- 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 }}
|
||||
|
||||
@@ -1,33 +0,0 @@
|
||||
{{- 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 }}
|
||||
|
||||
@@ -1,85 +0,0 @@
|
||||
{{- 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 }}
|
||||
@@ -1,19 +0,0 @@
|
||||
{{- 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 }}
|
||||
|
||||
@@ -1,14 +0,0 @@
|
||||
{{- 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 }}
|
||||
|
||||
@@ -1,20 +0,0 @@
|
||||
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 }}
|
||||
|
||||
@@ -1,13 +0,0 @@
|
||||
{{- 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 }}
|
||||
|
||||
@@ -1,155 +0,0 @@
|
||||
# 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
|
||||
|
||||
@@ -1,68 +0,0 @@
|
||||
# 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
|
||||
|
||||
@@ -1,231 +0,0 @@
|
||||
# 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