#!/bin/bash # CVE-SIGMA Auto Generator Startup Script echo "🚀 Starting CVE-SIGMA Auto Generator..." echo "===============================================" # Check if Docker and Docker Compose are installed if ! command -v docker &> /dev/null; then echo "❌ Docker is not installed. Please install Docker first." exit 1 fi if ! command -v docker-compose &> /dev/null; then echo "❌ Docker Compose is not installed. Please install Docker Compose first." exit 1 fi # Check if .env file exists, if not create from example if [ ! -f .env ]; then echo "📝 Creating .env file from .env.example..." cp .env.example .env echo "✅ .env file created. Please edit it to add your NVD API key for better rate limits." fi # Stop any existing containers echo "🛑 Stopping any existing containers..." docker-compose down # Build and start the application echo "🔨 Building and starting the application..." docker-compose up -d --build # Wait for services to be ready echo "⏳ Waiting for services to start..." sleep 10 # Check if services are running echo "🔍 Checking service status..." if docker-compose ps | grep -q "Up"; then echo "✅ Services are running!" echo "" echo "🌐 Access the application at:" echo " Frontend: http://localhost:3000" echo " Backend API: http://localhost:8000" echo " API Documentation: http://localhost:8000/docs" echo "" echo "📊 The application will automatically:" echo " - Fetch recent CVEs from NVD" echo " - Generate SIGMA rules" echo " - Update every hour" echo "" echo "💡 Tip: Add your NVD API key to .env for higher rate limits" echo " Get one free at: https://nvd.nist.gov/developers/request-an-api-key" else echo "❌ Some services failed to start. Check logs with:" echo " docker-compose logs" fi # Show logs echo "" echo "📋 Recent logs (press Ctrl+C to exit):" docker-compose logs -f --tail=50