Documentation Index
Fetch the complete documentation index at: https://mintlify.com/KevinhosUTP/Automatizacion-Lurwis/llms.txt
Use this file to discover all available pages before exploring further.
Production Deployment
Comprehensive guide to deploying Automatización Lurwis to production with enterprise-grade reliability and security.Pre-Deployment Checklist
Infrastructure Requirements
Compute Resources
Compute Resources
Minimum Requirements:
- CPU: 4 cores
- RAM: 8GB
- Storage: 100GB SSD
- Network: 1Gbps
- CPU: 8+ cores
- RAM: 16GB+
- Storage: 250GB SSD with daily backups
- Network: 10Gbps
Database Infrastructure
Database Infrastructure
PostgreSQL:
- Version: 12+
- Connection Pooling: PgBouncer or built-in session pooler
- Replication: Primary + read replica
- Storage: 50GB minimum, with auto-scaling
- Version: 4.4+
- Replica Set: 3 nodes minimum
- Storage: 20GB for conversation history
- Version: 6+
- Configuration: Standalone or cluster
- Memory: 4GB minimum
- Persistence: AOF enabled
External Services
External Services
- WhatsApp Business API: Production access approved
- Google Gemini API: Billing enabled, rate limits verified
- Domain & SSL: Valid SSL certificate (Let’s Encrypt or commercial)
- DNS: Properly configured with low TTL for failover
Security Hardening
Network Security
Enable HTTPS/TLS
Configure reverse proxy with SSL:Caddy (Recommended - Used in Workflows):
The Receptor workflow shows Caddy in use:
via: 1.1 Caddy in the webhook headers.Database Security
PostgreSQL:Connection Security:
- Use SSL/TLS for all database connections
- Whitelist only n8n server IP
- Use connection pooling to prevent exhaustion
Authentication & Authorization
High Availability Architecture
Recommended Production Architecture
Container Orchestration
- Docker Compose (Simple)
- Kubernetes (Advanced)
For single-server deployment:
Scaling Strategy
Vertical Scaling
Horizontal Scaling
Queue Mode Configuration:Database Optimization
PostgreSQL Performance
PostgreSQL Performance
Redis Memory Management
Redis Memory Management
MongoDB Optimization
MongoDB Optimization
Monitoring & Observability
Application Monitoring
Error Tracking
The workflows include error notification via WhatsApp:From Workflow Notes: “El ‘Gateaway’ está conectado a un Error Workflow (to notify when this one errors) conectado a mi teléfono de WhatsApp personal.”
- Create a dedicated error workflow
- Use Error Trigger node
- Add WhatsApp node with your notification number
- Link both main workflows to this error workflow
Log Management
- Use ELK Stack (Elasticsearch, Logstash, Kibana)
- Or cloud solutions: CloudWatch, Stackdriver, Datadog
Backup & Disaster Recovery
Automated Backups
- PostgreSQL Backups
- MongoDB Backups
- n8n Workflows
Disaster Recovery Plan
Document Recovery Procedures
Create runbook with:
- RTO (Recovery Time Objective): 1 hour
- RPO (Recovery Point Objective): 24 hours
- Step-by-step restoration process
- Contact information for team
Test Recovery Regularly
Monthly drill:
- Restore backups to staging environment
- Verify data integrity
- Test workflow execution
- Document any issues
Performance Optimization
Workflow Optimization
Message Buffering (Already Implemented)
Message Buffering (Already Implemented)
The Receptor workflow uses Redis buffering:
- Buffer window: 8 seconds
- Purpose: Aggregate rapid messages
- TTL: 30 seconds
Database Query Optimization
Database Query Optimization
The Procesador workflow queries are optimized:
Memory Context Windows
Memory Context Windows
Optimized per agent:
- Orders: 25 messages (detailed history)
- Reservations: 15 messages
- General: 10 messages (fast queries)
API Rate Limiting
Google Gemini:- Free tier: 60 requests/minute
- Implement exponential backoff
- Use faster models for classification
- Tier 1: 1,000 messages/day
- Tier 2: 10,000 messages/day
- Monitor usage in Meta dashboard
Deployment Process
Blue-Green Deployment
Run smoke tests
- Test webhook verification
- Send test message
- Verify database connections
- Check AI agent responses
Production Checklist
Before going live:Security
- SSL certificates installed and valid
- All default passwords changed
- Firewall rules configured
- Database connections use SSL/TLS
- Row Level Security enabled on PostgreSQL
- API tokens rotated and secured
- Error notifications configured
Infrastructure
- Reverse proxy (Caddy) configured
- Health checks enabled
- Auto-restart policies set
- Resource limits configured
- Backup system automated
- Monitoring dashboards created
Application
- Both workflows imported and activated
- All credentials configured in n8n
- WhatsApp webhook verified with Meta
- Database schema migrated
- Redis connection tested
- AI models responding correctly
Testing
- End-to-end message flow tested
- Order creation verified
- Database writes confirmed
- Error handling validated
- Load testing completed
- Failover procedures tested
Documentation
- Runbooks created for operations team
- Disaster recovery plan documented
- Escalation procedures defined
- Architecture diagrams updated
Maintenance Windows
Planned Maintenance
Schedule:- Weekly: Database optimization (5 minutes)
- Monthly: Security updates (30 minutes)
- Quarterly: Major version upgrades (2 hours)
- Announce 48 hours in advance
- Use low-traffic windows (3-5 AM local time)
- Post status updates during maintenance
Support & Escalation
On-Call Rotation
Tier 1: Automated Alerts- Error workflow sends WhatsApp notifications
- Monitoring alerts via email/SMS
- Review logs and metrics
- Apply standard troubleshooting
- Escalate if unresolved in 30 minutes
- Deep investigation
- Code fixes if needed
- Post-mortem after resolution
Post-Deployment
Monitoring Dashboard
Set up Grafana with key metrics
Troubleshooting Guide
Common issues and solutions
Database Schema
Reference for database structure
API Reference
Internal API documentation