Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions specific_task/HyperCoreBalancerv2/.GITIGNORE
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
.env
61 changes: 61 additions & 0 deletions specific_task/HyperCoreBalancerv2/.env.template
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
# =============================================================================
# HyperCore Load Balancer - Environment Configuration
# =============================================================================
# Copy this file to .env and fill in your real values.
# NEVER commit the .env file to version control.
# =============================================================================

# --- HyperCore Cluster Credentials ---
SC_HOST=https://nodeip/rest/v1
SC_USERNAME=admin
SC_PASSWORD=password
SC_VERIFY_SSL=false

# --- InfluxDB ---
DOCKER_INFLUXDB_INIT_USERNAME=admin
DOCKER_INFLUXDB_INIT_PASSWORD=CHANGE_ME
INFLUX_TOKEN=CHANGE_ME
INFLUX_ORG=hypercore
INFLUX_BUCKET=metrics

# Retention & Downsampling
INFLUX_PRIMARY_RETENTION=365
INFLUX_LONGTERM_BUCKET=metrics_longterm
INFLUX_LONGTERM_RETENTION=1825

# --- Grafana ---
GF_SECURITY_ADMIN_PASSWORD=CHANGE_ME

# --- Collector ---
SC_POLL_INTERVAL=30
SC_SLOW_POLL_INTERVAL=300

# --- Balancer: Master Toggles ---
SC_DRY_RUN=true
SC_VERBOSITY=3

# --- Balancer: Reactive Engine ---
SC_AVG_WINDOW_MINUTES=5
SC_SAMPLE_INTERVAL_SECONDS=30
SC_RAM_LIMIT_PERCENT=85.0
SC_RAM_UPPER_THRESHOLD_PERCENT=65.0
SC_CPU_UPPER_THRESHOLD_PERCENT=50.0
SC_MAX_VCPU_RATIO=2.0
SC_VM_MOVE_COOLDOWN_MINUTES=30
SC_MIGRATION_COOLDOWN_MINUTES=5
SC_EXCLUDE_NODE_IPS=

# --- Balancer: Predictive Engine (The Oracle) ---
SC_PREDICTIVE_BALANCING_ENABLED=true
SC_PREDICTIVE_INTERVAL_SECONDS=43200
SC_PREDICTIVE_THRESHOLD=80.0
SC_PREDICTIVE_MIN_HISTORY_HOURS=336
SC_PREDICTIVE_LOOKBACK_DAYS=90
SC_PREDICTIVE_MAX_WORKERS=8
SC_PREDICTIVE_LEAD_TIME_HOURS=1
SC_PREDICTIVE_RESERVATION_MINUTES=5

# --- Dashboard ---
SC_DASHBOARD_STALE_SECONDS=120
SC_DASHBOARD_USER=admin
SC_DASHBOARD_PASSWORD=CHANGE_ME
17 changes: 17 additions & 0 deletions specific_task/HyperCoreBalancerv2/Balancer/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
FROM python:3.11-slim

WORKDIR /app

# Install build dependencies required by Prophet
RUN apt-get update && apt-get install -y build-essential && rm -rf /var/lib/apt/lists/*

COPY requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt

# Copy your scripts into the container
COPY HyperCore_balancer.py .
COPY predictive_engine.py .
COPY config_db.py .

# Run the balancer unbuffered so logs show up immediately in Docker
CMD ["python", "-u", "HyperCore_balancer.py"]
Loading