feat: add Sentry, Cloudflare R2, and CloudFlare CDN integrations
Production quick wins for improved observability and scalability: Sentry Error Tracking: - Add sentry-sdk[fastapi] dependency - Initialize Sentry in main.py with FastAPI/SQLAlchemy integrations - Add Celery integration for background task error tracking - Feature-flagged via SENTRY_DSN (disabled when empty) Cloudflare R2 Storage: - Add boto3 dependency for S3-compatible API - Create storage_service.py with StorageBackend abstraction - LocalStorageBackend for development (default) - R2StorageBackend for production cloud storage - Feature-flagged via STORAGE_BACKEND setting CloudFlare CDN/Proxy: - Create middleware/cloudflare.py for CF header handling - Extract real client IP from CF-Connecting-IP - Support CF-IPCountry for geo features - Feature-flagged via CLOUDFLARE_ENABLED setting Documentation: - Add docs/deployment/cloudflare.md setup guide - Update infrastructure.md with dev vs prod requirements - Add enterprise upgrade checklist for scaling beyond 1000 users - Update installation.md with new environment variables All features are optional and disabled by default for development. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
35
.env.example
35
.env.example
@@ -163,3 +163,38 @@ FLOWER_URL=http://localhost:5555
|
||||
# Flower basic authentication password
|
||||
# ⚠️ CHANGE THIS IN PRODUCTION!
|
||||
FLOWER_PASSWORD=changeme
|
||||
|
||||
# =============================================================================
|
||||
# SENTRY ERROR TRACKING
|
||||
# =============================================================================
|
||||
# Get your DSN from https://sentry.io (free tier available)
|
||||
# Leave empty to disable Sentry
|
||||
SENTRY_DSN=
|
||||
SENTRY_ENVIRONMENT=production
|
||||
SENTRY_TRACES_SAMPLE_RATE=0.1
|
||||
|
||||
# =============================================================================
|
||||
# CLOUDFLARE R2 STORAGE
|
||||
# =============================================================================
|
||||
# Storage backend: "local" (default) or "r2" for Cloudflare R2
|
||||
# Set to "r2" for production to enable cloud storage
|
||||
STORAGE_BACKEND=local
|
||||
|
||||
# Cloudflare R2 credentials (required when STORAGE_BACKEND=r2)
|
||||
# Get these from Cloudflare Dashboard > R2 > Manage R2 API Tokens
|
||||
R2_ACCOUNT_ID=
|
||||
R2_ACCESS_KEY_ID=
|
||||
R2_SECRET_ACCESS_KEY=
|
||||
R2_BUCKET_NAME=wizamart-media
|
||||
|
||||
# Public URL for R2 bucket (optional - for custom domain)
|
||||
# If not set, uses Cloudflare's default R2 public URL
|
||||
# Example: https://media.yoursite.com
|
||||
R2_PUBLIC_URL=
|
||||
|
||||
# =============================================================================
|
||||
# CLOUDFLARE CDN / PROXY
|
||||
# =============================================================================
|
||||
# Set to true when your domain is proxied through CloudFlare
|
||||
# This enables proper handling of CF-Connecting-IP and other CloudFlare headers
|
||||
CLOUDFLARE_ENABLED=false
|
||||
|
||||
Reference in New Issue
Block a user