159 lines
4.0 KiB
Markdown
159 lines
4.0 KiB
Markdown
# Brand Master Helm Chart
|
|
|
|
This Helm chart deploys the Brand Master e-commerce application on Kubernetes.
|
|
|
|
## Components
|
|
|
|
- **Frontend**: React-based UI served by Nginx
|
|
- **Backend**: FastAPI application
|
|
- **Database**: PostgreSQL 16
|
|
- **Storage**: 15GB PVC for product images
|
|
|
|
## Prerequisites
|
|
|
|
- Kubernetes 1.19+
|
|
- Helm 3.0+
|
|
- cert-manager (for TLS certificates)
|
|
- Storage class configured (nfs-client by default)
|
|
|
|
## Installation
|
|
|
|
### 1. Update values.yaml
|
|
|
|
Edit `values.yaml` and configure:
|
|
|
|
- Image repositories (if using private registry)
|
|
- Domain names for ingress
|
|
- JWT secret key (IMPORTANT!)
|
|
- Database credentials
|
|
- Storage class name
|
|
|
|
### 2. Install the chart
|
|
|
|
```bash
|
|
# Install in the my-apps namespace
|
|
helm install brand-master ./brand-master-chart -n my-apps --create-namespace
|
|
|
|
# Or with custom values
|
|
helm install brand-master ./brand-master-chart -n my-apps \
|
|
--set backend.jwtSecretKey=your-super-secret-key \
|
|
--set postgres.password=secure-password
|
|
```
|
|
|
|
### 3. Upgrade the chart
|
|
|
|
```bash
|
|
helm upgrade brand-master ./brand-master-chart -n my-apps
|
|
```
|
|
|
|
### 4. Uninstall
|
|
|
|
```bash
|
|
helm uninstall brand-master -n my-apps
|
|
```
|
|
|
|
## Configuration
|
|
|
|
### Key Configuration Options
|
|
|
|
| Parameter | Description | Default |
|
|
|-----------|-------------|---------|
|
|
| `backend.image.repository` | Backend Docker image | `harbor.dvirlabs.com/my-apps/brand-master-backend` |
|
|
| `backend.image.tag` | Backend image tag | `latest` |
|
|
| `backend.jwtSecretKey` | JWT secret for authentication | `your-secret-key-change-this-in-production` |
|
|
| `backend.persistence.enabled` | Enable persistent storage for images | `true` |
|
|
| `backend.persistence.size` | Size of uploads PVC | `15Gi` |
|
|
| `frontend.image.repository` | Frontend Docker image | `harbor.dvirlabs.com/my-apps/brand-master-frontend` |
|
|
| `frontend.image.tag` | Frontend image tag | `latest` |
|
|
| `postgres.user` | PostgreSQL username | `brand_master_user` |
|
|
| `postgres.password` | PostgreSQL password | `brand_master_password` |
|
|
| `postgres.database` | PostgreSQL database name | `brand_master_db` |
|
|
| `postgres.persistence.size` | Size of database PVC | `10Gi` |
|
|
|
|
## Building Docker Images
|
|
|
|
### Backend
|
|
|
|
```bash
|
|
cd backend
|
|
docker build -t harbor.dvirlabs.com/my-apps/brand-master-backend:latest .
|
|
docker push harbor.dvirlabs.com/my-apps/brand-master-backend:latest
|
|
```
|
|
|
|
### Frontend
|
|
|
|
```bash
|
|
cd frontend
|
|
docker build -t harbor.dvirlabs.com/my-apps/brand-master-frontend:latest \
|
|
--build-arg VITE_API_URL=https://api-brand-master.dvirlabs.com .
|
|
docker push harbor.dvirlabs.com/my-apps/brand-master-frontend:latest
|
|
```
|
|
|
|
## Storage
|
|
|
|
The chart creates two PVCs:
|
|
|
|
1. **Database PVC**: 10GB for PostgreSQL data
|
|
2. **Uploads PVC**: 15GB for product images at `/app/uploads`
|
|
|
|
Both use the `nfs-client` storage class by default. Update this in `values.yaml` if needed.
|
|
|
|
## Ingress
|
|
|
|
The chart creates two ingress resources:
|
|
|
|
- **Frontend**: `brand-master.dvirlabs.com`
|
|
- **Backend API**: `api-brand-master.dvirlabs.com`
|
|
|
|
TLS is enabled by default using Let's Encrypt via cert-manager.
|
|
|
|
## Troubleshooting
|
|
|
|
### Check pod status
|
|
```bash
|
|
kubectl get pods -n my-apps
|
|
```
|
|
|
|
### View logs
|
|
```bash
|
|
# Backend logs
|
|
kubectl logs -n my-apps -l app.kubernetes.io/component=backend
|
|
|
|
# Frontend logs
|
|
kubectl logs -n my-apps -l app.kubernetes.io/component=frontend
|
|
|
|
# Database logs
|
|
kubectl logs -n my-apps -l app.kubernetes.io/component=database
|
|
```
|
|
|
|
### Access services locally
|
|
```bash
|
|
# Frontend
|
|
kubectl port-forward -n my-apps svc/brand-master-frontend 8080:80
|
|
|
|
# Backend
|
|
kubectl port-forward -n my-apps svc/brand-master-backend 8000:8000
|
|
|
|
# Database
|
|
kubectl port-forward -n my-apps svc/brand-master-db 5432:5432
|
|
```
|
|
|
|
### Check PVC status
|
|
```bash
|
|
kubectl get pvc -n my-apps
|
|
```
|
|
|
|
## Security Notes
|
|
|
|
1. **Change the JWT secret** in production
|
|
2. **Update database credentials**
|
|
3. **Use strong passwords**
|
|
4. **Configure proper CORS settings**
|
|
5. **Review and adjust resource limits**
|
|
6. **Enable network policies** if needed
|
|
7. **Use image pull secrets** for private registries
|
|
|
|
## Support
|
|
|
|
For issues or questions, refer to the main repository documentation.
|