Quick Start
Get the Autoscaler running quickly with this guide.
Prerequisites
- Nomad 1.6+ cluster with Autoscaler
- Python 3.12+ and Poetry (for Optimizer)
- Go 1.25+ (for Nomadscaler plugin build)
- Prometheus (for metrics, or use test mode)
Quick Start with Docker
The fastest way to get started using the pre-built Docker images:
1. Build and Run the Optimizer Service
bash
cd autoscaler/optimizer
docker build -t ghcr.io/productifyfw/optimizer:latest .
docker run --rm -p 8015:8015 ghcr.io/productifyfw/optimizer:latest2. Build Nomadscaler Plugin
bash
cd autoscaler/nomadscaler
./build.shThe plugin binary will be in ./bin/nomadscaler.
3. Configure Nomad Job with Scaling
Add scaling block to your Nomad job (based on config/test.hcl):
hcl
job "webapp" {
datacenters = ["dc1"]
group "demo" {
count = 3
network {
port "webapp_http" {}
}
scaling {
enabled = true
min = 0
max = 10
policy {
evaluation_interval = "3s"
cooldown = "10s"
check "productify-scale-check" {
source = "nomad-apm"
query = "avg_cpu-allocated"
strategy "productify-scaler" {
min = 0
max = 10
metric_app_name = "test"
cache_size = 10
}
}
}
}
task "webapp" {
driver = "docker"
config {
image = "hashicorp/demo-webapp-lb-guide"
ports = ["webapp_http"]
}
resources {
cpu = 100
memory = 16
}
}
}
}Manual Build and Run
Build Optimizer Service
bash
cd autoscaler/optimizer
# Install dependencies with Poetry
poetry install
# Run test calculation
poetry run testcalc
# Start the optimizer web service
poetry run webBuild Nomadscaler Plugin
bash
cd autoscaler/nomadscaler
# Build the plugin
./build.sh
# Plugin binary will be in ./bin/nomadscalerDeploy to Nomad
Use the complete autoscaler job from config/autoscaler.hcl:
bash
cd autoscaler/nomadscaler
nomad job run config/autoscaler.hclThis deploys:
- Nomad Autoscaler with productify-scaler plugin
- Optimizer service
- Prometheus for metrics
Configuration
Optimizer Configuration
Create or edit optimizer/config.ini:
ini
[main]
loglevel=debug
api_loglevel=warning
only_test_data=true
enable_test_metrics=true
prometheus_url=http://localhost:9090
token=supersecrettokenAutoscaler Configuration
The autoscaler configuration (from config/autoscaler.hcl):
hcl
plugin_dir = "/plugins"
nomad {
address = "http://nomad-address:4646"
}
apm "nomad" {
driver = "nomad-apm"
config = {
address = "http://nomad-address:4646"
}
}
strategy "productify-scaler" {
driver = "productify-scaler"
config = {
optimizer_token = "supersecrettoken"
optimizer_url = "http://optimizer:8000"
}
}Verify Installation
Test Optimizer Service
bash
curl http://localhost:8015/healthExpected response:
json
{
"response": "ok"
}Check Nomad Autoscaler Logs
bash
nomad alloc logs <autoscaler-alloc-id> autoscalerLook for:
- Plugin loaded:
productify-scaler - Optimizer connection successful
- Policy evaluations running
Next Steps
- Architecture - Understand SARIMAX and MILP optimization
- Nomadscaler Plugin - Configure the Nomad plugin
- Optimizer Service - Optimizer service details
- Scaling Policies - Advanced policy configuration
Troubleshooting
Optimizer not starting
Check:
- Python version is 3.12+
- Poetry installed correctly
config.iniexists and is valid- Port 8015 (or configured port) is available
Debug:
bash
cd autoscaler/optimizer
poetry run web # Check console output for errorsPlugin not loading
Verify:
- Plugin binary exists in
/pluginsdirectory - Binary has execute permissions:
chmod +x nomadscaler - Autoscaler config includes productify-scaler strategy
Check logs:
bash
nomad alloc logs <alloc-id> autoscalerNo scaling actions
Debug:
- Verify
metric_app_namematches your application - Check optimizer has historical metrics (or use
only_test_data=true) - Ensure scaling policy is enabled in job spec
- Check cooldown period hasn't been triggered
- Review autoscaler evaluation logs