- BTCPay Server integration - TeleBot Telegram bot - Review system - Admin area - Docker deployment configuration 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
5.3 KiB
5.3 KiB
TeleBot Docker Deployment on Portainer
Prerequisites
- Portainer-01 instance running
- LittleShop API deployed and accessible
- Telegram Bot Token from @BotFather
- Admin Chat ID for notifications
Quick Deployment Steps
1. Prepare Environment Variables
Copy .env.example to .env and configure:
cp .env.example .env
Edit .env with your values:
TELEGRAM_BOT_TOKEN- Your bot token from @BotFatherTELEGRAM_ADMIN_CHAT_ID- Your Telegram chat ID for admin notificationsLITTLESHOP_API_URL- URL to your LittleShop API instanceDATABASE_ENCRYPTION_KEY- 32-character secure key for database encryption
2. Deploy via Portainer UI
- Access Portainer at your portainer-01 URL
- Navigate to Stacks → Add Stack
- Stack Name:
littleshop-telebot - Build Method: Repository
- Repository URL: Your git repository URL
- Repository Reference: main/master
- Compose Path:
TeleBot/docker-compose.yml - Environment Variables: Upload your
.envfile or add manually
3. Deploy via Portainer API (Alternative)
# Upload stack via Portainer API
curl -X POST \
http://portainer-01:9000/api/stacks \
-H "X-API-Key: YOUR_PORTAINER_API_KEY" \
-F "Name=littleshop-telebot" \
-F "StackFileContent=@docker-compose.yml" \
-F "Env=@.env"
4. Manual Docker Deploy (If not using Portainer)
# Build and start services
docker-compose up -d
# View logs
docker-compose logs -f telebot
# Stop services
docker-compose down
Configuration Details
Required Environment Variables
| Variable | Description | Example |
|---|---|---|
TELEGRAM_BOT_TOKEN |
Bot token from @BotFather | 7880403661:AAGma1wAyoHsmG45iO6VvHCqzimhJX1pp14 |
TELEGRAM_ADMIN_CHAT_ID |
Admin chat ID for notifications | 123456789 |
LITTLESHOP_API_URL |
LittleShop API endpoint | https://api.yourshop.com |
DATABASE_ENCRYPTION_KEY |
32-char encryption key | your_secure_32_character_key_here |
Optional Variables
| Variable | Default | Description |
|---|---|---|
REDIS_ENABLED |
false |
Enable Redis caching |
HANGFIRE_ENABLED |
false |
Enable background job processing |
LITTLESHOP_USERNAME |
admin |
API admin username |
LITTLESHOP_PASSWORD |
admin |
API admin password |
Networking
The stack creates a littleshop-network bridge network for service communication.
Connecting to External LittleShop API
If your LittleShop API runs on the host or different container:
- Use
host.docker.internal:5001for same-host deployment - Use
https://your-api-domain.comfor external API
Persistent Storage
Volumes Created
littleshop-telebot-data- Bot database and application datalittleshop-telebot-logs- Application logslittleshop-redis-data- Redis data (if enabled)
Data Backup
# Backup bot data
docker run --rm -v littleshop-telebot-data:/data -v $(pwd):/backup alpine tar czf /backup/telebot-backup.tar.gz /data
# Restore bot data
docker run --rm -v littleshop-telebot-data:/data -v $(pwd):/backup alpine tar xzf /backup/telebot-backup.tar.gz -C /
Health Monitoring
The bot includes health checks:
- Endpoint: Container process check
- Interval: 30 seconds
- Timeout: 10 seconds
- Retries: 3
Security Considerations
- Database Encryption: Use a strong 32-character encryption key
- Redis Password: Set secure Redis password if enabled
- Network Isolation: Bot runs in isolated Docker network
- Non-Root User: Container runs as non-root
telebotuser - Secret Management: Use Docker secrets or external secret management
Troubleshooting
Check Container Status
docker-compose ps
View Logs
# All services
docker-compose logs
# Bot only
docker-compose logs telebot
# Follow logs
docker-compose logs -f telebot
Access Container Shell
docker-compose exec telebot /bin/bash
Common Issues
- Bot Token Invalid: Verify token with @BotFather
- API Connection Failed: Check
LITTLESHOP_API_URLand network connectivity - Permission Denied: Ensure proper file permissions on volumes
- Build Failed: Check Docker build context includes LittleShop.Client project
Monitoring & Maintenance
Log Rotation
Logs are automatically rotated:
- Max size: 10MB per file
- Max files: 3 files retained
Resource Usage
Typical resource requirements:
- CPU: 0.5 cores
- Memory: 512MB
- Storage: 1GB for data + logs
Updates
To update the bot:
# Pull latest changes
git pull
# Rebuild and restart
docker-compose up -d --build
Integration with Portainer
Stack Templates
Create a custom template in Portainer for easy redeployment:
- Portainer → App Templates → Custom Templates
- Add Template with docker-compose.yml content
- Variables section with environment variable definitions
Webhooks
Enable webhooks for automated deployments:
- Stack → Webhooks → Create Webhook
- Use webhook URL in CI/CD pipeline for automated updates
Support
For deployment issues:
- Check container logs:
docker-compose logs telebot - Verify environment variables in Portainer stack
- Test API connectivity from container
- Review bot registration in LittleShop admin panel