littleshop/TELEBOT_DEPLOYMENT_INSTRUCTIONS.md

117 lines
3.1 KiB
Markdown

# TeleBot Deployment Instructions - Hostinger Server
## 🚀 Quick Deployment (Manual SSH)
Since SSH automation is not working from this environment, please follow these manual steps to deploy TeleBot with the latest source code:
### Step 1: SSH to the Hostinger Server
```bash
ssh -p 2255 root@srv1002428.hstgr.cloud
```
### Step 2: Run the Deployment Script
Once logged into the server, run these commands:
```bash
# Navigate to the opt directory
cd /opt
# Clone or update the repository
if [ -d "LittleShop" ]; then
cd LittleShop
git pull origin main
else
git clone https://git.silverlabs.uk/SilverLABS/LittleShop.git
cd LittleShop
fi
# Run the deployment script
chmod +x telebot-server-deploy.sh
./telebot-server-deploy.sh
```
## 📋 What the Script Does
The `telebot-server-deploy.sh` script will:
1. **Pull Latest Code** - Gets all recent commits including:
- Fixed duplicate `/review` case (commit 10cd2ac)
- Complete TeleBot improvements and fixes (commit 515ee4d)
- Fixed multiple TeleBot and admin panel issues (commit 524f063)
- Network configuration fixes (commit e7d97f5)
2. **Build from Source** - Creates a fresh Docker image from source code (not pre-compiled binaries)
3. **Deploy Container** - Runs TeleBot with proper configuration:
- Connected to `littleshop-network` for API communication
- Proper environment variables for production
- Volume mounts for logs and data persistence
## 🔍 Verification
After deployment, verify TeleBot is running correctly:
```bash
# Check container status
docker ps | grep telebot
# View recent logs
docker logs --tail 50 telebot
# Monitor live logs
docker logs -f telebot
```
## ✅ Expected Results
After successful deployment, you should see:
- TeleBot container running
- Logs showing "Bot started successfully" or similar
- No compilation errors
- Connection to LittleShop API established
## 🐛 Troubleshooting
If the container fails to start:
```bash
# Check detailed logs
docker logs telebot
# Verify network connectivity
docker network ls | grep littleshop
docker network inspect littleshop-network
# Ensure LittleShop Admin is running
docker ps | grep littleshop-admin
# Check if old container is blocking
docker ps -a | grep telebot
docker rm telebot # if needed
```
## 📦 What's Been Fixed
The new deployment includes all these fixes:
- **Duplicate /review command** - Fixed compilation error
- **Shipping address collection** - No longer asks multiple times
- **Network connectivity** - Proper Docker network configuration
- **API communication** - Fixed connection to LittleShop Admin
- **Error handling** - Improved error messages and logging
## 🎯 Current Status
- **Dockerfile**: ✅ Ready (builds from source)
- **docker-compose.hostinger.yml**: ✅ Created
- **Deployment script**: ✅ Created (telebot-server-deploy.sh)
- **Git repository**: ✅ Updated with all files
- **Awaiting**: Manual SSH execution of deployment script
## 📝 Notes
- The bot token is already configured in the script
- The script creates all necessary directories and permissions
- Old containers and images are automatically cleaned up
- The deployment is idempotent (safe to run multiple times)