Add TeleBot deployment with Tor integration
- Created docker-compose.telebot.yml with Tor proxy - Added deployment script for automated setup - Configured Telegram traffic routing through Tor - Integrated with LittleShop API via Docker network 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
parent
127e810daa
commit
5210b5b70c
98
deploy-telebot.sh
Normal file
98
deploy-telebot.sh
Normal file
@ -0,0 +1,98 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
# TeleBot Deployment Script with Tor
|
||||||
|
# Ensures Telegram connectivity through Tor for privacy
|
||||||
|
|
||||||
|
set -e
|
||||||
|
|
||||||
|
echo "🤖 TeleBot Deployment to Hostinger VPS with Tor"
|
||||||
|
echo "==============================================="
|
||||||
|
|
||||||
|
# Configuration
|
||||||
|
REMOTE_HOST="srv1002428.hstgr.cloud"
|
||||||
|
REMOTE_USER="sysadmin"
|
||||||
|
REMOTE_PORT="2255"
|
||||||
|
SSH_KEY="/home/sysadmin/.claude/Knowledge/Infrastructure/vps_hardening_key"
|
||||||
|
|
||||||
|
echo "📦 Preparing deployment files..."
|
||||||
|
# Ensure files are ready
|
||||||
|
if [ ! -f "Dockerfile.telebot" ]; then
|
||||||
|
echo "❌ Dockerfile.telebot not found!"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ ! -f "docker-compose.telebot.yml" ]; then
|
||||||
|
echo "❌ docker-compose.telebot.yml not found!"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "🔑 Connecting to Hostinger VPS..."
|
||||||
|
# Use SSH key if available
|
||||||
|
if [ -f "$SSH_KEY" ]; then
|
||||||
|
SSH_CMD="ssh -p ${REMOTE_PORT} -i ${SSH_KEY} ${REMOTE_USER}@${REMOTE_HOST}"
|
||||||
|
else
|
||||||
|
echo "❌ SSH key not found at $SSH_KEY"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "🚀 Deploying TeleBot with Tor on server..."
|
||||||
|
$SSH_CMD << 'REMOTE_SCRIPT'
|
||||||
|
set -e
|
||||||
|
|
||||||
|
echo "📁 Setting up TeleBot directory..."
|
||||||
|
cd /opt/littleshop
|
||||||
|
|
||||||
|
echo "🐳 Building TeleBot Docker image..."
|
||||||
|
# Build using the telebot-specific Dockerfile
|
||||||
|
sudo docker build -f Dockerfile.telebot -t telebot:latest .
|
||||||
|
|
||||||
|
echo "🏷️ Tagging for registry..."
|
||||||
|
sudo docker tag telebot:latest localhost:5000/telebot:latest
|
||||||
|
|
||||||
|
echo "🔐 Logging into registry..."
|
||||||
|
sudo docker login localhost:5000 -u admin -p Thefa1r1esd1d1t
|
||||||
|
|
||||||
|
echo "📤 Pushing to registry..."
|
||||||
|
sudo docker push localhost:5000/telebot:latest
|
||||||
|
|
||||||
|
echo "📁 Creating data directories..."
|
||||||
|
sudo mkdir -p /opt/telebot/data
|
||||||
|
sudo mkdir -p /opt/telebot/logs
|
||||||
|
sudo mkdir -p /opt/telebot/image_cache
|
||||||
|
sudo chmod 755 /opt/telebot/data
|
||||||
|
sudo chmod 755 /opt/telebot/logs
|
||||||
|
sudo chmod 755 /opt/telebot/image_cache
|
||||||
|
|
||||||
|
echo "🛑 Stopping existing containers if any..."
|
||||||
|
sudo docker-compose -f docker-compose.telebot.yml down 2>/dev/null || true
|
||||||
|
|
||||||
|
echo "🚀 Starting TeleBot with Tor..."
|
||||||
|
sudo docker-compose -f docker-compose.telebot.yml up -d
|
||||||
|
|
||||||
|
echo "⏳ Waiting for services to be healthy..."
|
||||||
|
sleep 10
|
||||||
|
|
||||||
|
echo "📊 Checking deployment status..."
|
||||||
|
echo "=== Container Status ==="
|
||||||
|
sudo docker ps | grep -E "telebot|tor" || echo "No containers found"
|
||||||
|
|
||||||
|
echo ""
|
||||||
|
echo "=== Tor Connectivity Test ==="
|
||||||
|
sudo docker exec telebot-tor curl --socks5 localhost:9050 https://check.torproject.org/api/ip 2>/dev/null | grep -o '"IsTor":[^,]*' || echo "Tor check failed"
|
||||||
|
|
||||||
|
echo ""
|
||||||
|
echo "=== TeleBot Logs (last 20 lines) ==="
|
||||||
|
sudo docker logs telebot 2>&1 | tail -20
|
||||||
|
|
||||||
|
echo ""
|
||||||
|
echo "✅ TeleBot deployment complete!"
|
||||||
|
echo "================================"
|
||||||
|
echo "🤖 Bot is running with Tor protection"
|
||||||
|
echo "🔒 All Telegram traffic routed through Tor"
|
||||||
|
echo "💾 Data stored at: /opt/telebot/data"
|
||||||
|
echo "📝 Logs at: /opt/telebot/logs"
|
||||||
|
echo "================================"
|
||||||
|
|
||||||
|
REMOTE_SCRIPT
|
||||||
|
|
||||||
|
echo "✅ Deployment script completed!"
|
||||||
122
docker-compose.telebot.yml
Normal file
122
docker-compose.telebot.yml
Normal file
@ -0,0 +1,122 @@
|
|||||||
|
version: '3.8'
|
||||||
|
|
||||||
|
services:
|
||||||
|
tor:
|
||||||
|
image: dperson/torproxy:latest
|
||||||
|
container_name: telebot-tor
|
||||||
|
restart: unless-stopped
|
||||||
|
ports:
|
||||||
|
- "127.0.0.1:9050:9050" # SOCKS proxy port
|
||||||
|
- "127.0.0.1:9051:9051" # Control port
|
||||||
|
environment:
|
||||||
|
- TORUSER=telebot
|
||||||
|
- PASSWORD=Thefa1r1esd1d1t
|
||||||
|
- TOR_NewCircuitPeriod=600
|
||||||
|
- TOR_MaxCircuitDirtiness=3600
|
||||||
|
- LOCATION=US
|
||||||
|
volumes:
|
||||||
|
- tor-data:/var/lib/tor
|
||||||
|
networks:
|
||||||
|
- telebot-network
|
||||||
|
healthcheck:
|
||||||
|
test: ["CMD", "curl", "--socks5", "localhost:9050", "https://check.torproject.org/api/ip"]
|
||||||
|
interval: 60s
|
||||||
|
timeout: 10s
|
||||||
|
retries: 3
|
||||||
|
|
||||||
|
telebot:
|
||||||
|
image: localhost:5000/telebot:latest
|
||||||
|
container_name: telebot
|
||||||
|
restart: unless-stopped
|
||||||
|
depends_on:
|
||||||
|
- tor
|
||||||
|
environment:
|
||||||
|
# Bot configuration
|
||||||
|
- BotInfo__Name=LittleShop TeleBot
|
||||||
|
- BotInfo__Description=Privacy-focused e-commerce Telegram bot
|
||||||
|
- BotInfo__Version=1.0.0
|
||||||
|
|
||||||
|
# Telegram settings
|
||||||
|
- Telegram__BotToken=8496279616:AAE7kV_riICbWxn6-MPFqcrWx7K8b4_NKq0
|
||||||
|
- Telegram__AdminChatId=123456789
|
||||||
|
- Telegram__UseWebhook=false
|
||||||
|
|
||||||
|
# LittleShop API connection
|
||||||
|
- LittleShop__ApiUrl=http://littleshop-admin:8080
|
||||||
|
- LittleShop__Username=admin
|
||||||
|
- LittleShop__Password=Thefa1r1esd1d1t
|
||||||
|
- LittleShop__UseTor=false # Don't use Tor for local API
|
||||||
|
|
||||||
|
# Privacy settings with Tor
|
||||||
|
- Privacy__Mode=strict
|
||||||
|
- Privacy__DataRetentionHours=24
|
||||||
|
- Privacy__SessionTimeoutMinutes=30
|
||||||
|
- Privacy__EnableAnalytics=false
|
||||||
|
- Privacy__EphemeralByDefault=true
|
||||||
|
- Privacy__EnableTor=true
|
||||||
|
- Privacy__TorSocksPort=9050
|
||||||
|
- Privacy__TorControlPort=9051
|
||||||
|
- Privacy__OnionServiceDirectory=/var/lib/tor/telebot/
|
||||||
|
|
||||||
|
# Tor proxy settings for Telegram
|
||||||
|
- HTTPS_PROXY=socks5h://tor:9050
|
||||||
|
- HTTP_PROXY=socks5h://tor:9050
|
||||||
|
- ALL_PROXY=socks5h://tor:9050
|
||||||
|
|
||||||
|
# Database
|
||||||
|
- Database__ConnectionString=Filename=/app/data/telebot.db;Password=Thefa1r1esd1d1t;
|
||||||
|
- Database__EncryptionKey=ff34ur340uifoisdjf03uur283hr238n9978sdfgb82rn8dh
|
||||||
|
|
||||||
|
# Features
|
||||||
|
- Features__EnableQRCodes=true
|
||||||
|
- Features__EnablePGPEncryption=true
|
||||||
|
- Features__EnableDisappearingMessages=true
|
||||||
|
- Features__EnableOrderMixing=true
|
||||||
|
- Features__MixingDelayMinSeconds=60
|
||||||
|
- Features__MixingDelayMaxSeconds=300
|
||||||
|
|
||||||
|
# Redis (optional, using local instead)
|
||||||
|
- Redis__Enabled=false
|
||||||
|
|
||||||
|
# Logging
|
||||||
|
- Logging__LogLevel__Default=Information
|
||||||
|
- Logging__PrivacyMode=true
|
||||||
|
|
||||||
|
# Kestrel endpoints
|
||||||
|
- Kestrel__Endpoints__Http__Url=http://+:5010
|
||||||
|
|
||||||
|
# Cryptocurrencies
|
||||||
|
- Cryptocurrencies__0=BTC
|
||||||
|
- Cryptocurrencies__1=XMR
|
||||||
|
- Cryptocurrencies__2=ETH
|
||||||
|
- Cryptocurrencies__3=LTC
|
||||||
|
|
||||||
|
volumes:
|
||||||
|
- /opt/telebot/data:/app/data
|
||||||
|
- /opt/telebot/logs:/app/logs
|
||||||
|
- /opt/telebot/image_cache:/app/image_cache
|
||||||
|
- tor-data:/var/lib/tor
|
||||||
|
networks:
|
||||||
|
- telebot-network
|
||||||
|
- littleshop-network # Connect to LittleShop network
|
||||||
|
healthcheck:
|
||||||
|
test: ["CMD", "pgrep", "-f", "dotnet.*TeleBot"]
|
||||||
|
interval: 30s
|
||||||
|
timeout: 10s
|
||||||
|
retries: 3
|
||||||
|
start_period: 60s
|
||||||
|
logging:
|
||||||
|
driver: "json-file"
|
||||||
|
options:
|
||||||
|
max-size: "10m"
|
||||||
|
max-file: "3"
|
||||||
|
|
||||||
|
volumes:
|
||||||
|
tor-data:
|
||||||
|
driver: local
|
||||||
|
|
||||||
|
networks:
|
||||||
|
telebot-network:
|
||||||
|
driver: bridge
|
||||||
|
littleshop-network:
|
||||||
|
external: true
|
||||||
Loading…
Reference in New Issue
Block a user