2025-12-17 00:42:57 +02:00

202 lines
3.6 KiB
Markdown

# Helm Chart README
## Dating App Helm Chart
This Helm chart deploys the MVP dating application to Kubernetes with all necessary components.
### Prerequisites
- Kubernetes 1.19+
- Helm 3.0+
- Nginx Ingress Controller (for ingress)
- Storage provisioner (for PVC)
### Installation
#### Basic Installation (Development)
```bash
# Install with default values
helm install dating-app ./helm/dating-app -n dating-app --create-namespace
```
#### Production Installation with Custom Values
```bash
# Create custom values file
cp helm/dating-app/values.yaml my-values.yaml
# Edit my-values.yaml with your configuration
# Then install
helm install dating-app ./helm/dating-app -n dating-app --create-namespace -f my-values.yaml
```
### Configuration
Edit `values.yaml` to customize:
#### Ingress Hosts
```yaml
backend:
ingress:
host: api.yourdomain.com
frontend:
ingress:
host: app.yourdomain.com
```
#### Database
```yaml
postgres:
credentials:
username: your_user
password: your_password
database: your_db
```
#### Backend Environment
```yaml
backend:
environment:
JWT_SECRET: your-secret-key
CORS_ORIGINS: "https://app.yourdomain.com"
```
#### Frontend API URL
```yaml
frontend:
environment:
VITE_API_URL: "https://api.yourdomain.com"
```
#### Storage Classes
For cloud deployments (AWS, GCP, etc.), specify storage class:
```yaml
backend:
persistence:
storageClass: ebs-sc # AWS EBS
size: 10Gi
postgres:
persistence:
storageClass: ebs-sc
size: 20Gi
```
#### Replicas and Resources
```yaml
backend:
replicas: 3
resources:
requests:
memory: "512Mi"
cpu: "200m"
limits:
memory: "1Gi"
cpu: "500m"
frontend:
replicas: 2
resources:
requests:
memory: "256Mi"
cpu: "100m"
limits:
memory: "512Mi"
cpu: "200m"
```
### Upgrading
```bash
helm upgrade dating-app ./helm/dating-app -f my-values.yaml
```
### Uninstalling
```bash
helm uninstall dating-app -n dating-app
```
### AWS Migration
To deploy to AWS:
1. **RDS for PostgreSQL**: Disable postgres in chart
```yaml
postgres:
enabled: false
```
2. **Update database URL** to RDS endpoint
```yaml
backend:
environment:
DATABASE_URL: "postgresql://user:password@your-rds-endpoint:5432/dating_app"
```
3. **S3 for Media Storage**: Update backend environment
```yaml
backend:
environment:
MEDIA_STORAGE: s3
S3_BUCKET: your-bucket
AWS_REGION: us-east-1
```
4. **Use AWS Load Balancer Controller** for ingress
```yaml
ingress:
className: aws-alb
annotations:
alb.ingress.kubernetes.io/scheme: internet-facing
```
5. **Use EBS for persistent storage**
```yaml
backend:
persistence:
storageClass: ebs-sc
```
### Troubleshooting
Check pod status:
```bash
kubectl get pods -n dating-app
kubectl logs -n dating-app <pod-name>
```
Check services:
```bash
kubectl get svc -n dating-app
```
Check ingress:
```bash
kubectl get ingress -n dating-app
```
Port forward for debugging:
```bash
kubectl port-forward -n dating-app svc/backend 8000:8000
kubectl port-forward -n dating-app svc/frontend 3000:80
```
### Database Initialization
The backend automatically initializes tables on startup. To verify:
```bash
kubectl exec -it -n dating-app <postgres-pod> -- psql -U dating_user -d dating_app -c "\dt"
```
### Notes
- This chart is designed to be portable between on-premises and cloud deployments
- Modify `values.yaml` for your specific infrastructure
- For production, use external secrets management (HashiCorp Vault, AWS Secrets Manager, etc.)
- Enable TLS/SSL with cert-manager for production ingress
- Configure proper backup strategies for PostgreSQL PVC