- Migrated from Python pre-commit to NodeJS-native solution - Reorganized documentation structure - Set up Husky + lint-staged for efficient pre-commit hooks - Fixed Dockerfile healthcheck issue - Added comprehensive documentation index
227 lines
5.0 KiB
Markdown
227 lines
5.0 KiB
Markdown
# 📦 Storage Configuration Examples
|
|
|
|
## Overview
|
|
|
|
RxMinder now supports configurable storage through environment variables, making it easy to adapt to different Kubernetes environments and storage requirements.
|
|
|
|
## 🗂️ Storage Configuration Variables
|
|
|
|
### **STORAGE_CLASS**
|
|
|
|
The Kubernetes StorageClass to use for persistent volumes.
|
|
|
|
**Common Options:**
|
|
|
|
- `longhorn` - Longhorn distributed storage (Raspberry Pi clusters)
|
|
- `local-path` - Local path provisioner (k3s default)
|
|
- `standard` - Cloud provider standard storage
|
|
- `fast-ssd` - High-performance SSD storage
|
|
- `gp2` - AWS General Purpose SSD
|
|
- `pd-standard` - Google Cloud Standard Persistent Disk
|
|
- `azure-disk` - Azure Standard Disk
|
|
|
|
### **STORAGE_SIZE**
|
|
|
|
The amount of storage to allocate for the CouchDB database.
|
|
|
|
**Sizing Guidelines:**
|
|
|
|
- `1Gi` - Minimal testing (not recommended for production)
|
|
- `5Gi` - Small deployment (default, good for development)
|
|
- `10Gi` - Medium deployment (suitable for small teams)
|
|
- `20Gi` - Large deployment (production use)
|
|
- `50Gi+` - Enterprise deployment (high-volume usage)
|
|
|
|
## 🎯 Environment-Specific Examples
|
|
|
|
### Development (.env)
|
|
|
|
```bash
|
|
# Development environment
|
|
APP_NAME=rxminder-dev
|
|
STORAGE_CLASS=local-path
|
|
STORAGE_SIZE=5Gi
|
|
INGRESS_HOST=rxminder-dev.local
|
|
```
|
|
|
|
### Staging (.env.staging)
|
|
|
|
```bash
|
|
# Staging environment
|
|
APP_NAME=rxminder-staging
|
|
STORAGE_CLASS=longhorn
|
|
STORAGE_SIZE=10Gi
|
|
INGRESS_HOST=staging.rxminder.company.com
|
|
```
|
|
|
|
### Production (.env.production)
|
|
|
|
```bash
|
|
# Production environment
|
|
APP_NAME=rxminder
|
|
STORAGE_CLASS=fast-ssd
|
|
STORAGE_SIZE=50Gi
|
|
INGRESS_HOST=rxminder.company.com
|
|
```
|
|
|
|
### Cloud Providers
|
|
|
|
#### AWS EKS
|
|
|
|
```bash
|
|
APP_NAME=rxminder
|
|
STORAGE_CLASS=gp2 # General Purpose SSD
|
|
STORAGE_SIZE=20Gi
|
|
INGRESS_HOST=rxminder.aws.company.com
|
|
```
|
|
|
|
#### Google GKE
|
|
|
|
```bash
|
|
APP_NAME=rxminder
|
|
STORAGE_CLASS=pd-standard # Standard Persistent Disk
|
|
STORAGE_SIZE=20Gi
|
|
INGRESS_HOST=rxminder.gcp.company.com
|
|
```
|
|
|
|
#### Azure AKS
|
|
|
|
```bash
|
|
APP_NAME=rxminder
|
|
STORAGE_CLASS=managed-premium # Premium SSD
|
|
STORAGE_SIZE=20Gi
|
|
INGRESS_HOST=rxminder.azure.company.com
|
|
```
|
|
|
|
## 🏗️ Generated Kubernetes Resources
|
|
|
|
### Before (Hardcoded)
|
|
|
|
```yaml
|
|
# Old approach - hardcoded values
|
|
apiVersion: v1
|
|
kind: PersistentVolumeClaim
|
|
metadata:
|
|
name: couchdb-pvc
|
|
spec:
|
|
storageClassName: longhorn
|
|
resources:
|
|
requests:
|
|
storage: 1Gi
|
|
```
|
|
|
|
### After (Template-Based)
|
|
|
|
```yaml
|
|
# Template: k8s/couchdb-pvc.yaml.template
|
|
apiVersion: v1
|
|
kind: PersistentVolumeClaim
|
|
metadata:
|
|
name: ${APP_NAME}-couchdb-pvc
|
|
labels:
|
|
app: ${APP_NAME}
|
|
spec:
|
|
storageClassName: ${STORAGE_CLASS}
|
|
resources:
|
|
requests:
|
|
storage: ${STORAGE_SIZE}
|
|
```
|
|
|
|
### Deployed Result
|
|
|
|
```yaml
|
|
# After envsubst processing
|
|
apiVersion: v1
|
|
kind: PersistentVolumeClaim
|
|
metadata:
|
|
name: rxminder-couchdb-pvc
|
|
labels:
|
|
app: rxminder
|
|
spec:
|
|
storageClassName: fast-ssd
|
|
resources:
|
|
requests:
|
|
storage: 20Gi
|
|
```
|
|
|
|
## 🚀 Deployment Examples
|
|
|
|
### Quick Development Setup
|
|
|
|
```bash
|
|
# Development with local storage
|
|
export APP_NAME=rxminder-dev
|
|
export STORAGE_CLASS=local-path
|
|
export STORAGE_SIZE=5Gi
|
|
./scripts/k8s-deploy-template.sh deploy
|
|
```
|
|
|
|
### Production Deployment
|
|
|
|
```bash
|
|
# Copy production environment
|
|
cp .env.production .env
|
|
# Edit with your specific values
|
|
nano .env
|
|
|
|
# Deploy to production
|
|
./scripts/k8s-deploy-template.sh deploy
|
|
```
|
|
|
|
### Custom Configuration
|
|
|
|
```bash
|
|
# Override specific values
|
|
export STORAGE_CLASS=custom-storage
|
|
export STORAGE_SIZE=100Gi
|
|
./scripts/k8s-deploy-template.sh deploy
|
|
```
|
|
|
|
## 🔍 Storage Class Discovery
|
|
|
|
### Find Available Storage Classes
|
|
|
|
```bash
|
|
# List available storage classes in your cluster
|
|
kubectl get storageclass
|
|
|
|
# Get details about a specific storage class
|
|
kubectl describe storageclass longhorn
|
|
```
|
|
|
|
### Common Storage Class Names by Platform
|
|
|
|
| Platform | Common Storage Classes |
|
|
| -------------- | ------------------------------------------ |
|
|
| **k3s** | `local-path` (default) |
|
|
| **Longhorn** | `longhorn` |
|
|
| **AWS EKS** | `gp2`, `gp3`, `io1`, `io2` |
|
|
| **Google GKE** | `standard`, `ssd`, `pd-standard`, `pd-ssd` |
|
|
| **Azure AKS** | `default`, `managed-premium` |
|
|
| **Rancher** | `longhorn`, `local-path` |
|
|
|
|
## 💡 Benefits
|
|
|
|
### Flexibility
|
|
|
|
- ✅ **Environment-specific** storage configuration
|
|
- ✅ **Cloud-agnostic** deployment
|
|
- ✅ **Performance tuning** via storage class selection
|
|
- ✅ **Cost optimization** through appropriate sizing
|
|
|
|
### Maintainability
|
|
|
|
- ✅ **Single source of truth** via `.env` files
|
|
- ✅ **Easy scaling** by changing STORAGE_SIZE
|
|
- ✅ **Environment promotion** using different .env files
|
|
- ✅ **Disaster recovery** with consistent configurations
|
|
|
|
### Developer Experience
|
|
|
|
- ✅ **No hardcoded values** in manifests
|
|
- ✅ **Clear documentation** of requirements
|
|
- ✅ **Validation** of required variables
|
|
- ✅ **Automated deployment** with proper storage setup
|
|
|
|
This approach makes RxMinder truly **portable** across different Kubernetes environments while maintaining **production-grade** storage management!
|