This commit is contained in:
ilyastar9999
2025-12-02 14:01:34 +03:00
parent 96e1e5a7e0
commit cffbd77b74
31 changed files with 3335 additions and 0 deletions

111
install.sh Normal file
View File

@@ -0,0 +1,111 @@
#!/bin/bash
# One-liner installation script for A/D Infrastructure Control
# Usage: curl -sSL https://raw.githubusercontent.com/YOUR-REPO/main/install.sh | bash
set -e
REPO_URL="https://github.com/YOUR-USERNAME/attack-defence-infr-control.git"
INSTALL_DIR="$HOME/ad-infr-control"
echo "==================================="
echo "A/D Infrastructure Control Installer"
echo "==================================="
echo ""
# Check requirements
echo "Checking requirements..."
if ! command -v docker &> /dev/null; then
echo "Error: Docker is not installed"
echo "Please install Docker first: https://docs.docker.com/get-docker/"
exit 1
fi
if ! command -v docker-compose &> /dev/null; then
echo "Error: docker-compose is not installed"
echo "Please install docker-compose: https://docs.docker.com/compose/install/"
exit 1
fi
if ! command -v git &> /dev/null; then
echo "Error: git is not installed"
exit 1
fi
echo "✓ All requirements satisfied"
echo ""
# Clone or update repository
if [ -d "$INSTALL_DIR" ]; then
echo "Installation directory exists, updating..."
cd "$INSTALL_DIR"
git pull
else
echo "Cloning repository..."
git clone "$REPO_URL" "$INSTALL_DIR"
cd "$INSTALL_DIR"
fi
echo ""
# Create .env file if it doesn't exist
if [ ! -f ".env" ]; then
echo "Creating .env file from template..."
cp .env.example .env
# Generate random secret token
SECRET_TOKEN=$(openssl rand -hex 32)
FLASK_SECRET=$(openssl rand -hex 32)
POSTGRES_PASS=$(openssl rand -hex 16)
# Update .env with generated secrets
sed -i.bak "s/change_me_to_random_string/$SECRET_TOKEN/" .env
sed -i.bak "s/change_me_flask_secret_key/$FLASK_SECRET/" .env
sed -i.bak "s/change_me_secure_password/$POSTGRES_PASS/" .env
rm .env.bak 2>/dev/null || true
echo "✓ .env file created with random secrets"
echo ""
echo "IMPORTANT: Please edit .env file and configure:"
echo " - TELEGRAM_BOT_TOKEN"
echo " - TELEGRAM_CHAT_ID"
echo " - OUR_TEAM_ID"
echo " - SCOREBOARD_WS_URL"
echo ""
read -p "Press Enter to continue after editing .env (or Ctrl+C to exit)..."
fi
# Create services directory
mkdir -p services
# Build and start services
echo ""
echo "Building Docker images..."
docker-compose build
echo ""
echo "Starting services..."
docker-compose up -d
echo ""
echo "==================================="
echo "Installation Complete!"
echo "==================================="
echo ""
echo "Services are running:"
echo " - Web Dashboard: http://localhost:8000"
echo " - Controller API: http://localhost:8001"
echo " - Scoreboard Injector: http://localhost:8002"
echo " - Telegram Bot API: http://localhost:8003"
echo ""
echo "Default web password: admin123 (change in .env: WEB_PASSWORD)"
echo ""
echo "Next steps:"
echo " 1. Access web dashboard at http://localhost:8000"
echo " 2. Run setup script: cd $INSTALL_DIR && ./setuper/setup.sh"
echo " 3. Configure your A/D services (Packmate, Farm, Firegex)"
echo ""
echo "View logs: docker-compose logs -f"
echo "Stop services: docker-compose down"
echo ""