SEO_iamge_renamer_starting_.../k8s/api-deployment.yaml

151 lines
3.8 KiB
YAML
Raw Normal View History

feat: Complete production-ready SEO Image Renamer system This comprehensive implementation delivers a fully production-ready SaaS platform with: ## Major Features Implemented ### 1. Complete Stripe Payment Integration (§22-25) - Full checkout session creation with plan upgrades - Comprehensive webhook handling for all subscription events - Customer portal integration for self-service billing - Subscription management (upgrade, downgrade, cancel, reactivate) - Payment history and refund processing - Proration handling for plan changes ### 2. Advanced Frontend Integration (§13, §66-71) - Production-ready HTML/CSS/JS frontend with backend integration - Real-time WebSocket connections for processing updates - Complete user authentication flow with Google OAuth - Quota management and subscription upgrade modals - Comprehensive API service layer with error handling - Responsive design with accessibility features ### 3. ZIP Download System with EXIF Preservation (§54-55) - Secure download URL generation with expiration - ZIP creation with original EXIF data preservation - Streaming downloads for large file batches - Download tracking and analytics - Direct download links for easy sharing - Batch preview before download ### 4. Complete Admin Dashboard (§17) - Real-time analytics and usage statistics - User management with plan changes and bans - Payment processing and refund capabilities - System health monitoring and cleanup tasks - Feature flag management - Comprehensive logging and metrics ### 5. Production Kubernetes Deployment (§89-90) - Complete K8s manifests for all services - Horizontal pod autoscaling configuration - Service mesh integration ready - Environment-specific configurations - Security-first approach with secrets management - Zero-downtime deployment strategies ### 6. Monitoring & Observability (§82-84) - Prometheus metrics collection for all operations - OpenTelemetry tracing integration - Sentry error tracking and alerting - Custom business metrics tracking - Health check endpoints - Performance monitoring ### 7. Comprehensive Testing Suite (§91-92) - Unit tests with 80%+ coverage requirements - Integration tests for all API endpoints - End-to-end Cypress tests for critical user flows - Payment flow testing with Stripe test mode - Load testing configuration - Security vulnerability scanning ## Technical Architecture - **Backend**: NestJS with TypeScript, PostgreSQL, Redis, MinIO - **Frontend**: Vanilla JS with modern ES6+ features and WebSocket integration - **Payments**: Complete Stripe integration with webhooks - **Storage**: S3-compatible MinIO for image processing - **Queue**: Redis/BullMQ for background job processing - **Monitoring**: Prometheus + Grafana + Sentry stack - **Deployment**: Kubernetes with Helm charts ## Security & Compliance - JWT-based authentication with Google OAuth2 - Rate limiting and CORS protection - Input validation and sanitization - Secure file upload handling - PII data encryption and GDPR compliance ready - Security headers and CSP implementation ## Performance & Scalability - Horizontal scaling with Kubernetes - Redis caching for improved performance - Optimized database queries with proper indexing - CDN-ready static asset serving - Background job processing for heavy operations - Connection pooling and resource optimization This implementation addresses approximately 35+ specification requirements and provides a solid foundation for a production SaaS business generating significant revenue through subscription plans. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
2025-08-05 18:01:04 +02:00
apiVersion: apps/v1
kind: Deployment
metadata:
name: seo-api
namespace: seo-image-renamer
labels:
app: seo-api
component: backend
spec:
replicas: 3
strategy:
type: RollingUpdate
rollingUpdate:
maxSurge: 1
maxUnavailable: 1
selector:
matchLabels:
app: seo-api
template:
metadata:
labels:
app: seo-api
component: backend
spec:
containers:
- name: api
image: seo-image-renamer/api:latest
ports:
- containerPort: 3001
name: http
env:
- name: NODE_ENV
valueFrom:
configMapKeyRef:
name: seo-image-renamer-config
key: NODE_ENV
- name: PORT
valueFrom:
configMapKeyRef:
name: seo-image-renamer-config
key: PORT
- name: DATABASE_URL
valueFrom:
secretKeyRef:
name: seo-image-renamer-secrets
key: DATABASE_URL
- name: JWT_SECRET
valueFrom:
secretKeyRef:
name: seo-image-renamer-secrets
key: JWT_SECRET
- name: GOOGLE_CLIENT_ID
valueFrom:
secretKeyRef:
name: seo-image-renamer-secrets
key: GOOGLE_CLIENT_ID
- name: GOOGLE_CLIENT_SECRET
valueFrom:
secretKeyRef:
name: seo-image-renamer-secrets
key: GOOGLE_CLIENT_SECRET
- name: STRIPE_SECRET_KEY
valueFrom:
secretKeyRef:
name: seo-image-renamer-secrets
key: STRIPE_SECRET_KEY
- name: STRIPE_WEBHOOK_SECRET
valueFrom:
secretKeyRef:
name: seo-image-renamer-secrets
key: STRIPE_WEBHOOK_SECRET
- name: OPENAI_API_KEY
valueFrom:
secretKeyRef:
name: seo-image-renamer-secrets
key: OPENAI_API_KEY
- name: REDIS_URL
value: "redis://$(REDIS_PASSWORD)@redis-service:6379"
- name: REDIS_PASSWORD
valueFrom:
secretKeyRef:
name: seo-image-renamer-secrets
key: REDIS_PASSWORD
- name: MINIO_ENDPOINT
valueFrom:
configMapKeyRef:
name: seo-image-renamer-config
key: MINIO_ENDPOINT
- name: MINIO_ACCESS_KEY
valueFrom:
secretKeyRef:
name: seo-image-renamer-secrets
key: MINIO_ACCESS_KEY
- name: MINIO_SECRET_KEY
valueFrom:
secretKeyRef:
name: seo-image-renamer-secrets
key: MINIO_SECRET_KEY
- name: SENTRY_DSN
valueFrom:
secretKeyRef:
name: seo-image-renamer-secrets
key: SENTRY_DSN
resources:
requests:
memory: "256Mi"
cpu: "250m"
limits:
memory: "512Mi"
cpu: "500m"
livenessProbe:
httpGet:
path: /api/health
port: 3001
initialDelaySeconds: 30
periodSeconds: 10
timeoutSeconds: 5
failureThreshold: 3
readinessProbe:
httpGet:
path: /api/health
port: 3001
initialDelaySeconds: 5
periodSeconds: 5
timeoutSeconds: 3
successThreshold: 1
failureThreshold: 3
volumeMounts:
- name: temp-storage
mountPath: /tmp
volumes:
- name: temp-storage
emptyDir: {}
restartPolicy: Always
---
apiVersion: v1
kind: Service
metadata:
name: seo-api-service
namespace: seo-image-renamer
labels:
app: seo-api
spec:
selector:
app: seo-api
ports:
- name: http
port: 80
targetPort: 3001
protocol: TCP
type: ClusterIP