freeleaps-ops/apps/gitea-webhook-ambassador-python/scripts/setup.sh

55 lines
1.5 KiB
Bash
Executable File

#!/bin/bash
# Gitea Webhook Ambassador quick setup script
echo "🚀 Starting Gitea Webhook Ambassador setup..."
# Check Python version
python_version=$(python3 -V 2>&1 | awk '{print $2}')
if [[ "$python_version" < "3.8" ]]; then
echo "❌ Python 3.8 or higher is required, current version: $python_version"
exit 1
fi
echo "✅ Python version check passed: $python_version"
# Create virtual environment
if [ ! -d "venv" ]; then
echo "📦 Creating virtual environment..."
python3 -m venv venv
fi
# Activate virtual environment
echo "🔧 Activating virtual environment..."
source venv/bin/activate
# Upgrade pip
echo "⬆️ Upgrading pip..."
pip install --upgrade pip
# Install dependencies
echo "📚 Installing dependencies..."
pip install -r requirements.txt
# Create config file
if [ ! -f ".env" ]; then
echo "⚙️ Creating environment config file..."
cp env.example .env
echo "📝 Please edit the .env file to configure your Jenkins credentials and other settings"
fi
# Create logs directory
mkdir -p logs
# Create database directory
mkdir -p data
echo "✅ Setup complete!"
echo "📋 Next steps:"
echo "1. Edit the .env file to configure Jenkins credentials"
echo "2. Run: source venv/bin/activate"
echo "3. Start Redis: docker run -d -p 6379:6379 redis:alpine"
echo "4. Start the service: python -m uvicorn app.main:app --reload"
echo "5. Start Celery worker: celery -A app.tasks.jenkins_tasks worker --loglevel=info"
echo "🌐 Access: http://localhost:8000"
echo "📊 Monitoring dashboard: http://localhost:8000/health"