MAJOR FIXES: ✅ Fixed UserBot container startup by making TELEGRAM_BOT_TOKEN optional ✅ Broke circular import chain between app modules ✅ Made Config.validate() conditional for UserBot-only mode ✅ Removed unused celery import from userbot_service.py INTEGRATION: ✅ UserBot menu now accessible from main bot /start command ✅ Added 🤖 UserBot button to main keyboard ✅ Integrated userbot_manager.py handlers: - userbot_menu: Main UserBot interface - userbot_settings: Configuration - userbot_collect_groups: Gather all user groups - userbot_collect_members: Parse group members ✅ UserBot handlers properly registered in ConversationHandler CONTAINERS: ✅ tg_autoposter_bot: Running and handling /start commands ✅ tg_autoposter_userbot: Running as standalone microservice ✅ All dependent services (Redis, PostgreSQL, Celery workers) operational STATUS: Bot is fully operational and ready for testing
6.8 KiB
6.8 KiB
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 .envfile created and configured.envhas 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)
chmod +x quickstart.sh
./quickstart.sh
- Execute quickstart.sh
- Wait for all services to start
- Verify no error messages
Option 2: Manual Start
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
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
docker-compose exec postgres psql -U bot -d tg_autoposter -c "SELECT version();"
- PostgreSQL connection successful
Redis Check
docker-compose exec redis redis-cli ping
- Redis responding with PONG
Bot Logs
docker-compose logs bot --tail 20
- No error messages
- Shows "Starting bot..."
Celery Worker Status
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
/startcommand - 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
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
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
ls -la .env
- .env is readable only by owner: -rw-------
- Sessions directory is writable
- Logs directory is writable
📈 Performance Baseline
Memory Usage
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
make up # Start containers
make down # Stop containers
make logs # View logs
make test # Run tests
make lint # Check code
Docker Direct
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
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
docker-compose logs [service] --tail 50
# Fix issues, then:
docker-compose restart [service]
Database connection error
docker-compose restart postgres
docker-compose exec postgres psql -U bot -d tg_autoposter
Bot not responding
# 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
docker stats
# Identify culprit service
docker-compose restart [service]
Redis issues
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
.envfile - 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:
- Create your first message in the bot
- Test scheduling with cron expressions
- Monitor through Flower dashboard
- Explore advanced features in PRODUCTION_DEPLOYMENT.md
- Deploy to production when ready
Checklist Version: 1.0
Last Updated: 2024-01-01
Status: Production Ready ✅