This commit is contained in:
ilyastar9999
2025-12-02 14:08:59 +03:00
parent a7ee8a0cd6
commit 919115c701
2 changed files with 40 additions and 18 deletions

View File

@@ -2,7 +2,8 @@
# Setuper script for A/D Infrastructure
# Installs and configures: Packmate, moded_distructive_farm, Firegex
set -e
# Don't exit on error - we want to continue even if API registration fails
set +e
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
SERVICES_DIR="${SERVICES_DIR:-$SCRIPT_DIR/../services}"
@@ -126,7 +127,12 @@ EOF
# Register with controller
echo "Registering Packmate with controller..."
call_api "/services" "POST" "{\"name\": \"packmate\", \"path\": \"$packmate_dir\", \"git_url\": \"https://gitlab.com/packmate/Packmate.git\"}"
if call_api "/services" "POST" "{\"name\": \"packmate\", \"path\": \"$packmate_dir\", \"git_url\": \"https://gitlab.com/packmate/Packmate.git\"}" 2>/dev/null; then
echo "✓ Packmate registered with controller"
else
echo "⚠ Warning: Could not register with controller (is it running?)"
echo " You can register manually later via the web dashboard"
fi
cd "$SCRIPT_DIR"
}
@@ -213,13 +219,18 @@ services:
retries: 3
volumes:
- farm-db:/var/lib/postgresql/data
volumes:
farm-db:
EOF
echo "moded_distructive_farm setup complete!"
# Register with controller
echo "Registering farm with controller..."
if call_api "/services" "POST" "{\"name\": \"farm\", \"path\": \"$farm_dir\", \"git_url\": \"https://github.com/ilyastar9999/moded_distructive_farm.git\"}" 2>/dev/null; then
echo "✓ Farm registered with controller"
else
echo "⚠ Warning: Could not register with controller (is it running?)"
echo " You can register manually later via the web dashboard"
fi
cd "$SCRIPT_DIR"
# Register with controller
echo "Registering farm with controller..."
call_api "/services" "POST" "{\"name\": \"farm\", \"path\": \"$farm_dir\", \"git_url\": \"https://github.com/ilyastar9999/moded_distructive_farm.git\"}"
@@ -266,13 +277,18 @@ services:
- SCOREBOARD_URL=\${SCOREBOARD_URL}
container_name: firegex-app
restart: always
ports:
- "\${FIREGEX_PORT:-5000}:5000"
EOF
fi
echo "Firegex setup complete!"
# Register with controller
echo "Registering Firegex with controller..."
if call_api "/services" "POST" "{\"name\": \"firegex\", \"path\": \"$firegex_dir\", \"git_url\": \"https://github.com/Pwnzer0tt1/firegex.git\"}" 2>/dev/null; then
echo "✓ Firegex registered with controller"
else
echo "⚠ Warning: Could not register with controller (is it running?)"
echo " You can register manually later via the web dashboard"
fi
cd "$SCRIPT_DIR"
# Register with controller
echo "Registering Firegex with controller..."
call_api "/services" "POST" "{\"name\": \"firegex\", \"path\": \"$firegex_dir\", \"git_url\": \"https://github.com/Pwnzer0tt1/firegex.git\"}"
@@ -294,11 +310,16 @@ main() {
if [ "$setup_pm" = "y" ]; then
setup_packmate
fi
if [ "$setup_fm" = "y" ]; then
setup_farm
fi
echo ""
echo "=== Setup Complete! ==="
echo "Services have been configured in: $SERVICES_DIR"
echo ""
echo "Next steps:"
echo " 1. Start the infrastructure: docker-compose up -d"
echo " 2. Access web dashboard: http://localhost:8000"
echo " 3. Register services via the dashboard if auto-registration failed"
echo ""
} fi
if [ "$setup_fg" = "y" ]; then
setup_firegex