system-prompts-and-models-o.../salesflow-saas/docs/DEPLOYMENT-NOTES.md
Claude 84762f08ab
Add complete launch infrastructure: models, APIs, agents, compliance, docs, knowledge base
Phase 1 - Repo Hardening:
- README.md, LICENSE, SECURITY.md, CONTRIBUTING.md
- GitHub Actions repo-hygiene workflow
- docs/: ARCHITECTURE, DATA-MODEL, API-MAP, AGENT-MAP, DEPLOYMENT-NOTES

Phase 2 - Database Models (7 new):
- Company, Contact, Call, Commission, Payout, Dispute, GuaranteeClaim
- Consent, Complaint, Policy, KnowledgeArticle, SectorAsset
- Updated models/__init__.py with all 32+ models

Phase 3 - API Surfaces (16 new route files):
- companies, contacts, calls, meetings, commissions, payouts
- disputes, guarantees, consents, complaints, knowledge
- sectors, presentations, supervisor, admin, health
- Updated router.py with all 24 route groups

Phase 4 - AI Prompt Registry (18 agent contracts):
- Lead Qualification, Affiliate Recruitment Evaluator, Onboarding Coach
- Outreach Writer, Arabic WhatsApp, English Conversation, Voice Call
- Meeting Booking, Sector Strategist, Objection Handler
- Proposal Drafter, QA Reviewer, Compliance Reviewer
- Knowledge Retrieval, Revenue Attribution, Fraud Reviewer
- Guarantee Claim Reviewer, Management Summary

Phase 5 - Communication Templates:
- 15 production templates (WhatsApp, email, voice, internal)
- Arabic + English variants with variable interpolation

Phase 6 - Compliance Center (7 legal docs):
- Privacy policy, Terms of service, Refund policy
- Commission policy, Affiliate rules, Consent policy, Data protection
- All PDPL-compliant, Arabic

Phase 7 - Celery Workers (fully implemented):
- follow_up_tasks: automated lead follow-ups with workflow execution
- message_tasks: WhatsApp/email/SMS with retry logic
- notification_tasks: daily reports, meeting reminders, in-app notifications
- affiliate_tasks: target checking, commission calculation, weekly reports, AI outreach

Phase 8 - Knowledge Base OS (8 files):
- Services overview, Pricing policy, Channel policy, Meeting policy
- Identity rules, Escalation rules, Hiring path, Internal SOPs

https://claude.ai/code/session_01KnJgK7RwyeCvRZTRThHtfU
2026-03-31 07:57:48 +00:00

66 lines
2.2 KiB
Markdown

# Deployment Notes
## Principles
- **Secrets live outside Git.** All credentials are injected via environment variables or a secret manager at deploy time.
- **SSL lives outside the repo.** Certificates are provisioned on the host or via a cloud load balancer. Never commit `.pem`, `.key`, or `.crt` files.
- **Infrastructure as config, not code secrets.** `docker-compose.yml` and Nginx configs reference environment variables, not hardcoded values.
## Deployment Order
Follow this sequence for a clean deployment:
```
1. Validate environment
- Confirm .env is populated (never committed)
- Verify database connection string
- Verify Redis connection string
- Verify WhatsApp API credentials
- Verify AI provider API keys
2. Start database and cache
- docker-compose up -d postgres redis
- Wait for health checks to pass
- Run migrations: docker-compose exec backend alembic upgrade head
3. Start backend
- docker-compose up -d backend
- Verify: curl http://localhost:8000/api/v1/health
4. Health check
- GET /api/v1/health must return {"status": "ok"}
- Confirm database and Redis connectivity in response
5. Start frontend
- docker-compose up -d frontend
- Verify: curl http://localhost:3000
6. Start workers
- docker-compose up -d celery-worker celery-beat
- Verify workers register with Redis broker
7. Start reverse proxy
- docker-compose up -d nginx
- Verify routing: https://yourdomain.com -> frontend
- Verify routing: https://yourdomain.com/api -> backend
8. SSL termination
- Handled at Nginx or cloud load balancer level
- Certbot or managed certificates (not stored in repo)
- Verify HTTPS redirect and certificate validity
```
## Rollback
1. Identify the failing service via logs: `docker-compose logs <service>`
2. Roll back the container image to the previous tag
3. If a migration caused the issue, run `alembic downgrade -1`
4. Restart affected services: `docker-compose up -d <service>`
## Monitoring
- Application logs: `docker-compose logs -f backend`
- Worker logs: `docker-compose logs -f celery-worker`
- Database: monitor connection pool and query latency
- Redis: monitor memory usage and queue depth