#!/bin/bash # SMS Campaign Manager - Quick Start Script set -e # Colors GREEN='\033[0;32m' YELLOW='\033[1;33m' BLUE='\033[0;34m' NC='\033[0m' echo -e "${GREEN}๐Ÿš€ SMS Campaign Manager${NC}" echo "=========================" echo # Check if running from project root if [[ ! -f "PROJECT_STRUCTURE.md" ]]; then echo -e "${RED}โŒ Please run this script from the project root directory${NC}" exit 1 fi # Check environment file if [[ ! -f ".env" ]]; then echo -e "${YELLOW}โš ๏ธ Creating .env from template...${NC}" cp config/.env.example .env echo -e "${BLUE}๐Ÿ“ Please edit .env with your settings before continuing${NC}" exit 1 fi # Check Docker if ! command -v docker &> /dev/null; then echo -e "${RED}โŒ Docker not found. Please install Docker first.${NC}" exit 1 fi if ! command -v docker compose &> /dev/null; then echo -e "${RED}โŒ Docker Compose not found. Please install Docker Compose first.${NC}" exit 1 fi # Show current configuration echo -e "${BLUE}๐Ÿ“‹ Current Configuration:${NC}" echo " Phone IP: $(grep PHONE_IP .env | cut -d= -f2)" echo " ADB Port: $(grep ADB_PORT .env | cut -d= -f2)" echo " Termux Port: $(grep TERMUX_API_PORT .env | cut -d= -f2)" echo # Deployment options case "${1:-help}" in "start"|"up") echo -e "${GREEN}๐Ÿ”ง Starting SMS Campaign Manager...${NC}" docker compose up -d echo -e "${GREEN}โœ… Started! Access at: http://localhost:5000${NC}" ;; "stop"|"down") echo -e "${YELLOW}๐Ÿ›‘ Stopping SMS Campaign Manager...${NC}" docker compose down ;; "logs") docker compose logs -f ;; "status") docker compose ps ;; "rebuild") echo -e "${YELLOW}๐Ÿ”จ Rebuilding containers...${NC}" docker compose down docker compose build --no-cache docker compose up -d ;; "dev") echo -e "${BLUE}๐Ÿ‘จโ€๐Ÿ’ป Starting in development mode...${NC}" cd src python app.py ;; "test") echo -e "${GREEN}๐Ÿงช Running tests...${NC}" ./tests/test-docker-setup.sh ;; *) echo -e "${BLUE}Usage: ./run.sh [command]${NC}" echo echo "Commands:" echo " start - Start the application (Docker)" echo " stop - Stop the application" echo " logs - View application logs" echo " status - Show container status" echo " rebuild - Rebuild and restart containers" echo " dev - Run in development mode" echo " test - Run tests" echo echo -e "${GREEN}Quick start: ./run.sh start${NC}" ;; esac