#!/bin/bash # LittleShop + TeleBot Deployment Script for Hostinger # This script deploys both LittleShop and TeleBot to a Hostinger VPS # with BTCPay Server integration set -e # Colors for output RED='\033[0;31m' GREEN='\033[0;32m' YELLOW='\033[1;33m' NC='\033[0m' # No Color echo -e "${GREEN}======================================${NC}" echo -e "${GREEN}LittleShop + TeleBot Hostinger Deploy${NC}" echo -e "${GREEN}======================================${NC}" # Check if .env file exists if [ ! -f .env ]; then echo -e "${YELLOW}Warning: .env file not found!${NC}" echo "Creating .env from template..." cp .env.hostinger.template .env echo -e "${RED}Please edit .env file with your configuration before continuing!${NC}" echo "Required configurations:" echo " - TELEGRAM_BOT_TOKEN" echo " - TELEGRAM_ADMIN_CHAT_ID" echo " - BTCPAY_WEBHOOK_SECRET (generate a secure random string)" echo "" read -p "Press enter after editing .env file to continue..." fi # Load environment variables source .env # Validate required environment variables if [ -z "$TELEGRAM_BOT_TOKEN" ]; then echo -e "${RED}Error: TELEGRAM_BOT_TOKEN not set in .env file${NC}" exit 1 fi if [ -z "$TELEGRAM_ADMIN_CHAT_ID" ]; then echo -e "${RED}Error: TELEGRAM_ADMIN_CHAT_ID not set in .env file${NC}" exit 1 fi echo -e "${GREEN}Configuration validated successfully${NC}" # Build Docker images echo -e "${YELLOW}Building Docker images...${NC}" docker-compose -f docker-compose.hostinger.yml build # Stop existing containers (if any) echo -e "${YELLOW}Stopping existing containers...${NC}" docker-compose -f docker-compose.hostinger.yml down # Start services echo -e "${YELLOW}Starting services...${NC}" docker-compose -f docker-compose.hostinger.yml up -d # Wait for services to be ready echo -e "${YELLOW}Waiting for services to start...${NC}" sleep 10 # Check service health echo -e "${YELLOW}Checking service health...${NC}" # Check LittleShop if curl -f -s http://localhost:8080/health > /dev/null; then echo -e "${GREEN}✓ LittleShop is running${NC}" else echo -e "${RED}✗ LittleShop health check failed${NC}" fi # Check TeleBot logs if docker logs littleshop-telebot 2>&1 | grep -q "Starting TeleBot"; then echo -e "${GREEN}✓ TeleBot is running${NC}" else echo -e "${RED}✗ TeleBot may not be running correctly${NC}" fi # Show container status echo "" echo -e "${GREEN}Container Status:${NC}" docker-compose -f docker-compose.hostinger.yml ps # Show logs echo "" echo -e "${GREEN}Recent logs:${NC}" echo -e "${YELLOW}LittleShop:${NC}" docker logs --tail 10 littleshop echo "" echo -e "${YELLOW}TeleBot:${NC}" docker logs --tail 10 littleshop-telebot echo "" echo -e "${GREEN}======================================${NC}" echo -e "${GREEN}Deployment Complete!${NC}" echo -e "${GREEN}======================================${NC}" echo "" echo "Services are running:" echo " - LittleShop API: http://localhost:8080" echo " - TeleBot: Check your Telegram bot" echo "" echo "BTCPay Server:" echo " - URL: https://thebankofdebbie.giize.com" echo " - Make sure to configure webhook in BTCPay:" echo " Webhook URL: http://your-server-ip:8080/api/orders/payments/webhook" echo "" echo "To view logs:" echo " docker logs -f littleshop" echo " docker logs -f littleshop-telebot" echo "" echo "To stop services:" echo " docker-compose -f docker-compose.hostinger.yml down"