Files
bakery-ia/docs/pilot-launch-cost-effective-plan.md
2025-11-19 07:46:40 +01:00

306 lines
10 KiB
Markdown

# Cost-Effective Pilot Launch Plan for Bakery-IA
## Executive Summary
Total estimated cost: **€50-80/month** (€300-480 for 6-month pilot)
## 1. Server Setup (clouding.io)
**Recommended VPS Configuration:**
- **RAM**: 20 GB
- **CPU**: 8 vCPU
- **Storage**: 200 GB NVMe SSD
- **Cost**: €40-80/month
- **Setup**: Install k3s (lightweight Kubernetes)
**Why clouding.io:**
- Cost-effective European VPS provider
- Good performance/price ratio
- Supports custom ISO and Kubernetes
- Barcelona-based (good latency for Spain)
## 2. Domain & DNS
**Domain Registration:**
- Register domain at **Namecheap** or **Cloudflare Registrar** (~€10-15/year)
- Suggested: `bakeryforecast.es` or `bakery-ia.com`
**DNS Configuration (FREE):**
- Use **Cloudflare DNS** (free tier)
- Benefits: Fast DNS, free SSL proxy option, DDoS protection
- Point A record to your clouding.io VPS IP
## 3. Email Solution (Professional Domain Email)
**RECOMMENDED: Gmail + Google Workspace Trial + Free Forwarding**
### Option A - Gmail SMTP (FREE, best for pilot):
1. Use existing Gmail account with App Password
2. Configure `DEFAULT_FROM_EMAIL: "noreply@bakeryforecast.es"`
3. Set up **email forwarding** at domain registrar:
- `info@bakeryforecast.es` → your personal Gmail
- `noreply@bakeryforecast.es` → your personal Gmail
4. Send via Gmail SMTP, receive via forwarding
5. **Limit**: 500 emails/day (sufficient for 10 tenants)
6. **Cost**: FREE
### Option B - Google Workspace (if you need professional inbox):
- First 14 days FREE trial
- After trial: €5.75/user/month for Business Starter
- Includes: Professional email, 30GB storage, Meet
- Can cancel after pilot if needed
### Option C - Zoho Mail (FREE permanent option):
- FREE tier: 1 domain, 5 users, 5GB/user
- Professional email addresses with your domain
- Send/receive from `info@bakeryforecast.es`
- Web interface + SMTP/IMAP
- **Cost**: FREE forever
### Option D - Cloudflare Email Routing (FREE forwarding only):
- FREE email forwarding from your domain to personal Gmail
- Can receive at `info@bakeryforecast.es` → forwards to Gmail
- Cannot send FROM domain (receive only)
- **Cost**: FREE
**RECOMMENDATION**: Start with **Zoho Mail FREE** for full send/receive capability, or **Gmail SMTP + domain forwarding** if you just need to send notifications.
## 4. WhatsApp Business API (FREE for pilot)
**Setup Meta WhatsApp Business Cloud API:**
1. Create Meta Business Account (FREE)
2. Register WhatsApp Business phone number
- **Use your personal phone number** (must be non-VoIP)
- Can test with personal number initially
- Later: Get dedicated number (~€5-10/month from Twilio or similar)
3. Create app in Meta Developer Portal
4. Configure webhook for delivery status
5. Create message templates and submit for approval (15 min - 24 hours)
**Cost Breakdown:**
- First **1,000 conversations/month**: FREE
- Beyond free tier: €0.01-0.10 per conversation
- For 10 bakeries with ~50 notifications/month each = 500 total = **FREE**
**Personal Phone Testing:**
- You can use your personal WhatsApp number for testing
- Meta allows switching numbers during development
- Later migrate to dedicated business number
## 5. Email Notifications Testing
**Testing Strategy (FREE):**
1. Use **Mailtrap.io** (FREE tier) for development testing
- Catches all emails in fake inbox
- Test templates without sending real emails
- 100 emails/month free
2. Use **Gmail + filters** for real testing
- Create Gmail filter to label test emails
- Send to your own email addresses
3. Use **temp-mail.org** for disposable test addresses
**Production Email Testing:**
- Send test emails to your personal Gmail
- Verify deliverability, template rendering, links
- Check spam score with **mail-tester.com** (FREE)
## 6. SSL Certificates (FREE)
**Let's Encrypt (already configured in your setup):**
- FREE SSL certificates
- Auto-renewal with cert-manager
- Wildcard certificates supported
- **Cost**: FREE
## 7. Additional Cost Optimizations
**What to SKIP in pilot phase:**
- ❌ Managed databases (use containerized PostgreSQL)
- ❌ CDN (not needed for <50 users)
- Premium monitoring tools (use included Prometheus/Grafana)
- Paid backup services (use VPS snapshot feature)
- Multiple replicas (single instance sufficient)
**What to USE (FREE/included):**
- Let's Encrypt SSL
- Cloudflare DNS + DDoS protection
- Gmail SMTP or Zoho Mail
- Meta WhatsApp Business API (1k free conversations)
- Self-hosted monitoring (Prometheus/Grafana)
- VPS snapshots for backups
## 8. Total Cost Breakdown
### Monthly Recurring Costs
| Service | Provider | Monthly Cost |
|---------|----------|-------------|
| VPS Server | clouding.io | 40-80 |
| Domain | Namecheap | 1.25 (€15/year) |
| Email | Zoho/Gmail | 0 (FREE tier) |
| WhatsApp | Meta Business API | 0 (FREE tier) |
| DNS | Cloudflare | 0 (FREE tier) |
| SSL | Let's Encrypt | 0 (FREE) |
| **TOTAL** | | **41-81/month** |
### 6-Month Pilot Total: €246-486
### Optional Add-ons
- Dedicated WhatsApp number: +€5-10/month
- Google Workspace: +€5.75/user/month
- VPS backups: +€8-15/month
- External geocoding API: +€5-10/month
## 9. Implementation Steps
### Week 1: Infrastructure Setup
1. Register domain at Namecheap/Cloudflare
2. Set up clouding.io VPS with Ubuntu 22.04
3. Install k3s (lightweight Kubernetes)
4. Configure Cloudflare DNS pointing to VPS
### Week 2: Email & Communication
1. Set up Zoho Mail FREE account with domain
2. Configure SMTP credentials in Kubernetes secrets
3. Create Meta Business Account for WhatsApp
4. Register your personal phone with WhatsApp Business API
5. Create and submit WhatsApp message templates
### Week 3: Deployment
1. Update Kubernetes secrets with production values
2. Deploy application using Skaffold
3. Configure SSL with Let's Encrypt
4. Test email notifications
5. Test WhatsApp notifications to your personal number
### Week 4: Testing & Launch
1. Send test emails to verify deliverability
2. Send test WhatsApp messages
3. Invite first pilot bakery
4. Monitor costs and usage
## 10. Migration Path (Post-Pilot)
When ready to scale beyond pilot:
- **25-50 tenants**: Upgrade VPS to 32GB RAM (€80-120/month)
- **Email**: Upgrade to paid tier or switch to AWS SES
- **WhatsApp**: Start paying per conversation beyond 1k/month
- **Database**: Consider managed PostgreSQL for HA
- **Monitoring**: Add external monitoring (UptimeRobot, etc.)
## Key Recommendations Summary
1. **VPS**: Use clouding.io (€40-80/month) with k3s
2. **Domain**: Register at Namecheap + use Cloudflare DNS (FREE)
3. **Email**: Zoho Mail FREE tier for professional domain email
4. **WhatsApp**: Meta Business API with personal phone for testing (FREE 1k conversations)
5. **SSL**: Let's Encrypt (FREE, auto-renewal)
6. **Testing**: Use personal email addresses and your WhatsApp number
7. **Skip**: Managed services, CDN, premium monitoring for now
**Total pilot cost: €41-81/month** or **246-486 for 6 months**
---
## Current Infrastructure Status
### What's Already Configured ✅
1. **Email Notifications**: SMTP with Gmail (FREE tier ready)
2. **WhatsApp Notifications**: Meta Business API integration (1,000 FREE conversations/month)
3. **Kubernetes Deployment**: Complete manifests for all services
4. **Docker Compose**: Local development environment
5. **Monitoring**: Prometheus + Grafana configured
6. **Database Migrations**: Alembic for all 18 services
7. **Service Mesh**: RabbitMQ for event-driven architecture
8. **Caching**: Redis configured
9. **SSL/TLS**: cert-manager for automatic certificates
10. **Frontend**: React application with Vite build
### What Needs Setup ❌
1. **Domain Registration**: Buy domain (e.g., bakeryforecast.es)
2. **DNS Configuration**: Point domain to VPS IP
3. **Production Secrets**: Replace placeholder secrets with real values
4. **WhatsApp Business Account**: Register with Meta (1-3 days)
5. **Email SMTP Credentials**: Get Gmail app password or Zoho account
6. **VPS Provisioning**: Set up server at clouding.io
7. **Kubernetes Cluster**: Install k3s on VPS
8. **CI/CD Pipeline**: GitHub Actions for automated deployment (optional)
9. **Backup Strategy**: Configure VPS snapshots
10. **Monitoring Alerts**: Configure Prometheus alerting rules
## Technical Requirements
### VPS Specifications (Minimum for 10 tenants)
- **RAM**: 20 GB
- **CPU**: 8 vCPU
- **Storage**: 200 GB NVMe SSD
- **Network**: 1 Gbps connection
- **OS**: Ubuntu 22.04 LTS
### Storage Breakdown
- **Databases**: 36 GB (18 x 2GB PostgreSQL instances)
- **ML Models**: 10 GB (training/forecasting models)
- **Redis Cache**: 1 GB
- **RabbitMQ**: 2 GB
- **Prometheus Metrics**: 20 GB
- **Container Images**: ~30 GB
- **Growth Buffer**: ~100 GB
- **TOTAL**: 200 GB recommended
### Memory Requirements
- **Application Services**: 14.1 GB requests / 34.5 GB limits
- **Databases**: 4.6 GB requests / 9.2 GB limits
- **Infrastructure (Redis, RabbitMQ)**: 0.8 GB
- **Gateway/Frontend**: 1.8 GB
- **Monitoring**: 1.5 GB
- **TOTAL**: ~20 GB RAM minimum
## Configuration Files to Update
### Email Configuration
**File**: `infrastructure/kubernetes/base/secrets.yaml`
```yaml
SMTP_HOST: "smtp.gmail.com" # or smtp.zoho.com
SMTP_PORT: "587"
SMTP_USERNAME: <base64-encoded-email>
SMTP_PASSWORD: <base64-encoded-app-password>
DEFAULT_FROM_EMAIL: "noreply@bakeryforecast.es"
```
### WhatsApp Configuration
**File**: `infrastructure/kubernetes/base/secrets.yaml`
```yaml
WHATSAPP_ACCESS_TOKEN: <base64-encoded-meta-token>
WHATSAPP_PHONE_NUMBER_ID: <base64-encoded-phone-id>
WHATSAPP_BUSINESS_ACCOUNT_ID: <base64-encoded-account-id>
WHATSAPP_WEBHOOK_VERIFY_TOKEN: <base64-encoded-verify-token>
```
### Domain Configuration
**File**: `infrastructure/kubernetes/base/configmap.yaml`
```yaml
DOMAIN: "bakeryforecast.es"
CORS_ORIGINS: "https://bakeryforecast.es,https://www.bakeryforecast.es"
```
## Useful Links
- **WhatsApp Setup Guide**: `services/notification/WHATSAPP_SETUP_GUIDE.md`
- **Multi-tenant WhatsApp**: `services/notification/MULTI_TENANT_WHATSAPP_IMPLEMENTATION.md`
- **VPS Sizing Guide**: `docs/05-deployment/vps-sizing-production.md`
- **K8s Production Readiness**: `docs/05-deployment/k8s-production-readiness.md`
- **Kubernetes README**: `infrastructure/kubernetes/README.md`
## Next Steps
1. **Register domain** at Namecheap or Cloudflare
2. **Sign up for clouding.io VPS** (20GB RAM, 8 vCPU, 200GB SSD)
3. **Set up Zoho Mail** with your domain (FREE)
4. **Create Meta Business Account** for WhatsApp
5. **Follow Week 1-4 implementation plan** above
---
*Last Updated: 2025-11-19*
*Estimated Total Pilot Cost: €246-486 for 6 months*