Boturist is a scalable Telegram bot platform built with Python, Django, and various modern technologies. It provides a robust foundation for building and managing Telegram bots with features like CRM integration, analytics, and multi-platform support.
- Python 3.11+
- Django 5.0+
- PostgreSQL 15
- Redis 7
- MongoDB 6
- Docker & Docker Compose
- Prometheus & Grafana for monitoring
- Docker and Docker Compose
- Git
- Make (optional, for using Makefile commands)
- Clone the repository:
git clone https://github.com/sheba-pleasure/boturist.git
cd boturist- Create environment file:
cp .env.example .env
# Edit .env with your configuration- Build and start services:
docker-compose up -d- Run migrations:
docker-compose exec web python manage.py migrate- Create superuser:
docker-compose exec web python manage.py createsuperuserboturist/
├── bot/ # Telegram bot core
├── web/ # Django web interface
├── parsers/ # Data parsing services
├── worker/ # Background tasks worker
├── config/ # Configuration files
├── scripts/ # Utility scripts
└── tests/ # Test suite
- Create a virtual environment:
python -m venv .venv
source .venv/bin/activate # Linux/Mac
.venv\Scripts\activate # Windows- Install dependencies:
pip install -r requirements.txt- Install pre-commit hooks:
pre-commit installpytestThe project uses:
- Black for code formatting
- Flake8 for linting
- isort for import sorting
- mypy for type checking
-
Set up production server:
- Install Docker and Docker Compose
- Configure firewall rules
- Set up SSL certificates
-
Configure environment variables:
- Copy
.env.exampleto.env - Update all sensitive information
- Set
DEBUG=False
- Copy
-
Deploy using Docker Compose:
docker-compose -f docker-compose.yml -f docker-compose.prod.yml up -dRun the backup script:
./scripts/backup.shBackups are stored in /backup directory with timestamp.
- PostgreSQL:
gunzip -c backup_file.sql.gz | docker exec -i container_name psql -U username dbname- MongoDB:
docker exec -i container_name mongorestore --archive < backup_file.archive.gz- Prometheus: http://your-domain:9090
- Grafana: http://your-domain:3000
- Node Exporter: http://your-domain:9100
- PostgreSQL Exporter: http://your-domain:9187
Health endpoint: http://your-domain:8000/health/
Logs are stored in the logs/ directory:
- Application logs:
django.log - Bot logs:
bot.log - Error logs:
bot_error.log
- Check logs for errors
- Monitor disk space
- Verify backup integrity
- Update dependencies
- Review security alerts
- Pull latest changes:
git pull origin main- Update dependencies:
docker-compose build- Apply migrations:
docker-compose exec web python manage.py migrate- Restart services:
docker-compose down
docker-compose up -d-
Database connection errors:
- Check database credentials
- Verify network connectivity
- Check database logs
-
Redis connection issues:
- Verify Redis is running
- Check Redis configuration
- Monitor Redis memory usage
-
Bot API errors:
- Verify Telegram token
- Check API request limits
- Review bot logs
For issues and support, please open an issue on GitHub.
- Regular security updates
- Proper access control
- Secure communication
- Regular security audits
- Backup verification
- HTTPS enforcement
- Rate limiting
- Input validation
- Regular dependency updates
- Access control implementation
[Your License Here]
mkdir -p logs
chmod +x scripts/backup.sh