File size: 4,333 Bytes
32e4bbf |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 |
#!/bin/bash
# Quick start script for Cloudflare Manager
echo "ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ"
echo "β Cloudflare Manager - Quick Start β"
echo "ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ"
echo ""
# Check if Docker is installed
if ! command -v docker &> /dev/null; then
echo "β οΈ Docker is not installed."
echo " Please install Docker first: https://docs.docker.com/get-docker/"
echo ""
echo "Starting with Python instead..."
# Check if Python is installed
if ! command -v python3 &> /dev/null; then
echo "β Python 3 is not installed either."
echo " Please install Python 3 or Docker."
exit 1
fi
# Check if gradio is installed
if ! python3 -c "import gradio" 2>/dev/null; then
echo "π¦ Installing dependencies..."
pip3 install -r requirements.txt --quiet
fi
echo "π Starting Cloudflare Manager..."
echo " Access at: http://localhost:7860"
echo ""
python3 app.py
exit 0
fi
# Docker is available
echo "Docker detected. Choose deployment method:"
echo ""
echo "1. Docker Compose (recommended)"
echo "2. Docker run"
echo "3. Python (local)"
echo ""
read -p "Enter choice (1-3): " choice
case $choice in
1)
echo ""
echo "π³ Starting with Docker Compose..."
if [ ! -f ".env" ]; then
echo "π Creating .env file..."
cp .env.example .env
echo " Please edit .env with your credentials"
echo " Or enter them in the web interface"
fi
docker-compose up -d
if [ $? -eq 0 ]; then
echo ""
echo "β Service started successfully!"
echo ""
echo "π Status:"
docker-compose ps
echo ""
echo "π Access at: http://localhost:7860"
echo ""
echo "π Useful commands:"
echo " View logs: docker-compose logs -f"
echo " Stop service: docker-compose down"
echo " Restart: docker-compose restart"
else
echo "β Failed to start service"
exit 1
fi
;;
2)
echo ""
echo "π³ Starting with Docker..."
# Check if image exists
if ! docker images | grep -q cloudflare-manager; then
echo "π¦ Building Docker image..."
docker build -t cloudflare-manager .
fi
# Stop existing container if any
if docker ps -a | grep -q cloudflare-manager; then
echo "π Stopping existing container..."
docker stop cloudflare-manager 2>/dev/null
docker rm cloudflare-manager 2>/dev/null
fi
# Run container
docker run -d \
--name cloudflare-manager \
-p 7860:7860 \
cloudflare-manager
if [ $? -eq 0 ]; then
echo ""
echo "β Container started successfully!"
echo ""
echo "π Access at: http://localhost:7860"
echo ""
echo "π Useful commands:"
echo " View logs: docker logs -f cloudflare-manager"
echo " Stop: docker stop cloudflare-manager"
echo " Remove: docker rm cloudflare-manager"
else
echo "β Failed to start container"
exit 1
fi
;;
3)
echo ""
echo "π Starting with Python..."
# Check if dependencies are installed
if ! python3 -c "import gradio" 2>/dev/null; then
echo "π¦ Installing dependencies..."
pip3 install -r requirements.txt
fi
echo "π Starting Cloudflare Manager..."
echo " Access at: http://localhost:7860"
echo ""
python3 app.py
;;
*)
echo "β Invalid choice"
exit 1
;;
esac
|