Files
TG_autoposter/FIRST_RUN.sh
2025-12-18 05:55:32 +09:00

113 lines
3.2 KiB
Bash

#!/bin/bash
# First Run Guide for TG Autoposter
echo "================================================"
echo "🚀 TG Autoposter - Production Ready Bot"
echo "================================================"
echo ""
# Colors
GREEN='\033[0;32m'
YELLOW='\033[1;33m'
RED='\033[0;31m'
NC='\033[0m' # No Color
# Check prerequisites
check_prerequisite() {
if ! command -v $1 &> /dev/null; then
echo -e "${RED}$2 is not installed${NC}"
return 1
fi
echo -e "${GREEN}$2 found${NC}"
return 0
}
echo "Checking prerequisites..."
echo ""
MISSING=0
check_prerequisite "docker" "Docker" || MISSING=1
check_prerequisite "docker-compose" "Docker Compose" || MISSING=1
check_prerequisite "git" "Git" || MISSING=1
echo ""
if [ $MISSING -eq 1 ]; then
echo -e "${RED}Please install missing dependencies and try again${NC}"
exit 1
fi
# Check if .env exists
if [ ! -f .env ]; then
echo -e "${YELLOW}⚠️ .env file not found${NC}"
echo "Creating .env from .env.example..."
cp .env.example .env
echo -e "${GREEN}✓ .env created${NC}"
echo ""
echo -e "${RED}IMPORTANT: Edit .env and add your credentials:${NC}"
echo " - TELEGRAM_BOT_TOKEN"
echo " - TELEGRAM_API_ID"
echo " - TELEGRAM_API_HASH"
echo " - ADMIN_ID"
echo ""
echo "Edit .env now? (y/n): "
read -r edit_env
if [ "$edit_env" = "y" ]; then
nano .env
fi
fi
echo ""
echo "================================================"
echo "📋 Setup Complete! Next Steps:"
echo "================================================"
echo ""
echo "1. Start Docker containers:"
echo " ${YELLOW}docker-compose up -d${NC}"
echo ""
echo "2. Run database migrations:"
echo " ${YELLOW}docker-compose exec bot alembic upgrade head${NC}"
echo ""
echo "3. Check service status:"
echo " ${YELLOW}docker-compose ps${NC}"
echo ""
echo "4. View logs (in new terminal):"
echo " ${YELLOW}docker-compose logs -f${NC}"
echo ""
echo "5. Access Flower monitoring:"
echo " ${YELLOW}http://localhost:5555${NC}"
echo ""
echo "6. Test bot in Telegram:"
echo " - Find your bot by token"
echo " - Send /start command"
echo " - Follow on-screen instructions"
echo ""
echo "================================================"
echo "📚 Useful Documentation:"
echo "================================================"
echo ""
echo "Quick Start: ${YELLOW}DOCKER_QUICKSTART.md${NC}"
echo "Development Guide: ${YELLOW}DEVELOPMENT.md${NC}"
echo "Production Deployment:${YELLOW}PRODUCTION_DEPLOYMENT.md${NC}"
echo "Detailed Guide: ${YELLOW}docs/DOCKER_CELERY.md${NC}"
echo ""
echo "================================================"
echo "🔧 Common Commands:"
echo "================================================"
echo ""
echo "make up # Start services"
echo "make down # Stop services"
echo "make logs # View logs"
echo "make test # Run tests"
echo "make lint # Check code quality"
echo ""
echo "Or use helper script:"
echo "./docker.sh up # Start"
echo "./docker.sh down # Stop"
echo "./docker.sh logs # Logs"
echo ""
echo "================================================"
echo "✅ Ready to launch!"
echo "================================================"
echo ""