Files
TG_autoposter/PRE_LAUNCH_CHECKLIST.md
2025-12-18 05:55:32 +09:00

301 lines
6.8 KiB
Markdown

# Pre-Launch Checklist
## ✅ Installation & Setup
### System Requirements
- [ ] Docker installed and running
- [ ] Docker Compose installed (v2.0+)
- [ ] Python 3.11+ (for local development)
- [ ] Git installed
- [ ] At least 4GB RAM available
- [ ] 10GB free disk space
### Repository Setup
- [ ] Repository cloned
- [ ] In project directory: `cd TG_autoposter`
- [ ] `.env` file created and configured
- [ ] `.env` has required variables:
- [ ] TELEGRAM_BOT_TOKEN (from @BotFather)
- [ ] TELEGRAM_API_ID (from my.telegram.org)
- [ ] TELEGRAM_API_HASH (from my.telegram.org)
- [ ] ADMIN_ID (your Telegram user ID)
- [ ] DB_PASSWORD (secure password for database)
- [ ] REDIS_PASSWORD (secure password for Redis)
- [ ] Read README.md for overview
## 🚀 Starting Services
### Option 1: Quick Start (Recommended)
```bash
chmod +x quickstart.sh
./quickstart.sh
```
- [ ] Execute quickstart.sh
- [ ] Wait for all services to start
- [ ] Verify no error messages
### Option 2: Manual Start
```bash
docker-compose up -d
docker-compose exec bot alembic upgrade head
docker-compose ps
```
- [ ] All containers running
- [ ] Database migrations successful
- [ ] All services show "healthy"
## 📊 Verification
### Service Health
```bash
docker-compose ps
```
- [ ] postgres - running & healthy
- [ ] redis - running & healthy
- [ ] bot - running
- [ ] celery_worker_send - running
- [ ] celery_worker_parse - running
- [ ] celery_worker_maintenance - running
- [ ] celery_beat - running
- [ ] flower - running
### Database Check
```bash
docker-compose exec postgres psql -U bot -d tg_autoposter -c "SELECT version();"
```
- [ ] PostgreSQL connection successful
### Redis Check
```bash
docker-compose exec redis redis-cli ping
```
- [ ] Redis responding with PONG
### Bot Logs
```bash
docker-compose logs bot --tail 20
```
- [ ] No error messages
- [ ] Shows "Starting bot..."
### Celery Worker Status
```bash
docker-compose logs celery_worker_send --tail 10
```
- [ ] Worker shows ready status
- [ ] No connection errors
### Flower Dashboard
- [ ] Open http://localhost:5555 in browser
- [ ] See worker status
- [ ] See empty task queue (normal)
## 🤖 Bot Testing
### Telegram Bot Setup
- [ ] Open Telegram app
- [ ] Find your bot by token
- [ ] Send `/start` command
- [ ] Receive welcome message
- [ ] See main menu with options
### Basic Commands Test
- [ ] `/start` - works ✓
- [ ] `/help` - works ✓
- [ ] `/create` - can create message ✓
- [ ] Can select group from list ✓
- [ ] `/broadcast` - can send message ✓
### Database Verification
```bash
docker-compose exec postgres psql -U bot -d tg_autoposter
# In psql:
SELECT COUNT(*) FROM groups;
SELECT COUNT(*) FROM messages;
```
- [ ] Groups table has entries
- [ ] Messages table has entries
## 📊 Monitoring Setup
### Flower Dashboard
- [ ] Access http://localhost:5555
- [ ] Default login: admin
- [ ] Password from env: FLOWER_PASSWORD
- [ ] Can see active tasks
- [ ] Can see worker status
### Logs Monitoring
```bash
docker-compose logs -f
```
- [ ] All services logging correctly
- [ ] No critical errors
- [ ] Can see message flow
## 🔒 Security Verification
### Environment Variables
- [ ] TELEGRAM_BOT_TOKEN is secret
- [ ] DB_PASSWORD is secure (12+ chars)
- [ ] REDIS_PASSWORD is secure
- [ ] ADMIN_ID is your actual ID
- [ ] No sensitive data in git history
### Network Security
- [ ] Only necessary ports exposed
- [ ] Redis/PostgreSQL not exposed to public (in production)
- [ ] Bot service protected
- [ ] Docker bridge network isolated
### File Permissions
```bash
ls -la .env
```
- [ ] .env is readable only by owner: -rw-------
- [ ] Sessions directory is writable
- [ ] Logs directory is writable
## 📈 Performance Baseline
### Memory Usage
```bash
docker stats
```
- [ ] Bot: < 200MB
- [ ] PostgreSQL: < 500MB
- [ ] Redis: < 100MB
- [ ] Workers: < 150MB each
### CPU Usage
- [ ] No cores consistently at 100%
- [ ] Spikes acceptable during message send
## 📚 Documentation Review
- [ ] Read README.md
- [ ] Read DOCKER_QUICKSTART.md
- [ ] Skimmed DEVELOPMENT.md
- [ ] Know where PRODUCTION_DEPLOYMENT.md is
- [ ] Bookmarked docs/ folder
## 🛠️ Helpful Commands Reference
### Development
```bash
make up # Start containers
make down # Stop containers
make logs # View logs
make test # Run tests
make lint # Check code
```
### Docker Direct
```bash
docker-compose ps # List services
docker-compose logs -f [service] # Follow logs
docker-compose exec [service] bash # Shell into service
docker-compose restart [service] # Restart service
docker-compose down -v # Clean everything
```
### Bot Management
```bash
docker-compose exec bot alembic upgrade head # Migrations
docker-compose exec bot alembic downgrade -1 # Rollback
docker-compose exec postgres psql ... # Database access
redis-cli # Redis access
```
## 🚨 Troubleshooting Quick Reference
### Service won't start
```bash
docker-compose logs [service] --tail 50
# Fix issues, then:
docker-compose restart [service]
```
### Database connection error
```bash
docker-compose restart postgres
docker-compose exec postgres psql -U bot -d tg_autoposter
```
### Bot not responding
```bash
# Check logs
docker-compose logs bot --tail 50
# Check token in .env
echo $TELEGRAM_BOT_TOKEN
# Restart bot
docker-compose restart bot
```
### High memory usage
```bash
docker stats
# Identify culprit service
docker-compose restart [service]
```
### Redis issues
```bash
docker-compose logs redis --tail 20
docker-compose restart redis
redis-cli ping # Should return PONG
```
## ✅ Final Sign-Off
Before declaring setup complete:
- [ ] All services running & healthy
- [ ] Bot responds in Telegram
- [ ] Database has test data
- [ ] Celery tasks executing
- [ ] Flower dashboard accessible
- [ ] Logs being written
- [ ] No error messages in logs
- [ ] Can create and send messages
- [ ] All documentation understood
- [ ] Ready for development/deployment
## 📝 Notes
### First Time Running
Write down:
- Bot Token: _________________
- Database Password: _________________
- Redis Password: _________________
- Admin Telegram ID: _________________
### Important Reminders
- Never commit `.env` file
- Keep backups of database
- Monitor disk space for logs
- Check security logs regularly
- Update dependencies monthly
## 🎉 Success!
If all checks are marked, your TG Autoposter is:
- Installed correctly
- Configured properly
- Running smoothly
- Verified working
- Ready for use!
**Next Steps:**
1. Create your first message in the bot
2. Test scheduling with cron expressions
3. Monitor through Flower dashboard
4. Explore advanced features in PRODUCTION_DEPLOYMENT.md
5. Deploy to production when ready
---
**Checklist Version**: 1.0
**Last Updated**: 2024-01-01
**Status**: Production Ready