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

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
  • .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

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

🤖 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

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 .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