# TeleFlow CRM Deployment Checklist

## Pre-Deployment

- [ ] All dependencies installed via `composer install`
- [ ] `.env` file created and configured
- [ ] Database created
- [ ] Redis running and accessible
- [ ] Storage directories writable (755 or 775)
- [ ] PHP extensions verified (see requirements)

## Installation Steps

1. [ ] Run web installer at `/install.php`
2. [ ] Complete all installer steps
3. [ ] Create admin account
4. [ ] **Delete `/public/install.php` immediately**

## Post-Installation Configuration

### Web Server

- [ ] Apache: `mod_rewrite` enabled
- [ ] Nginx: Config copied and enabled
- [ ] Document root points to `/public`
- [ ] `.htaccess` or nginx rewrites working

### SSL Certificate

- [ ] SSL certificate installed
- [ ] HTTPS redirect configured
- [ ] Mixed content warnings resolved

### Queue Worker

- [ ] Supervisor/systemd service created
- [ ] Worker running: `ps aux | grep worker.php`
- [ ] Worker logs: `tail -f storage/logs/worker.log`

### Cron Jobs

- [ ] Crontab entry added
- [ ] Cron running: check `storage/logs/cron.log`

### Payment Methods

- [ ] Stripe keys added (live mode)
- [ ] Cryptomus keys added
- [ ] Manual payment bank details configured per currency
- [ ] Test transactions completed

### AI Providers

- [ ] OpenAI API key added
- [ ] Claude API key added (optional)
- [ ] Gemini API key added (optional)
- [ ] DeepSeek API key added (optional)
- [ ] Test AI responses working

### Email Configuration

- [ ] SMTP credentials configured
- [ ] Test email sent successfully
- [ ] Email templates reviewed

### Security

- [ ] `APP_ENV=production` in `.env`
- [ ] `APP_DEBUG=false` in `.env`
- [ ] Strong `APP_KEY` generated
- [ ] Database user has minimal required privileges
- [ ] Firewall rules configured
- [ ] Backup strategy implemented

### Monitoring

- [ ] Error logging working: `storage/logs/`
- [ ] Queue job processing monitored
- [ ] Disk space alerts configured
- [ ] Uptime monitoring enabled

## Testing

- [ ] Admin login works
- [ ] User registration works
- [ ] Telegram account connection tested
- [ ] Contact import tested
- [ ] Campaign creation tested
- [ ] AI assistant tested
- [ ] Payment flow tested (all methods)
- [ ] Email notifications working
- [ ] Multi-language switching tested

## Performance Optimization

- [ ] OPcache enabled
- [ ] Redis cache working
- [ ] Static assets cached (browser)
- [ ] Database indexes verified
- [ ] Slow query log reviewed

## Backup Strategy

- [ ] Database backup automated (daily)
- [ ] File uploads backed up
- [ ] `.env` file backed up (securely)
- [ ] Restore procedure tested

## Documentation

- [ ] Admin credentials documented (securely)
- [ ] API keys documented (securely)
- [ ] Deployment notes saved
- [ ] Team onboarded

## Launch

- [ ] DNS records updated
- [ ] SSL verified
- [ ] All tests passing
- [ ] Monitoring active
- [ ] Support channels ready

---

## Common Production Issues

### High Memory Usage

```bash
# Increase PHP memory limit
php_value memory_limit 512M
```

### Slow Response Times

- Enable Redis for sessions and cache
- Enable PHP OPcache
- Optimize database queries
- Use CDN for static assets

### Queue Jobs Backing Up

- Increase worker count in supervisor config
- Check for failed jobs: `redis-cli LLEN teleflow_queue:failed`
- Monitor worker logs

### Telegram Flood Waits

- Reduce campaign send rate
- Add delays between messages
- Use multiple Telegram accounts

---

**Last Updated:** Installation Date
**Deployed By:** [Your Name]
**Environment:** Production
