The Application Autoscaler provides the capability to adjust the computation resources for Cloud Foundry applications through:
- Dynamic scaling based on application performance metrics
- Dynamic scaling based on custom metrics
- Scheduled scaling based on time
This repository contains the core Application Autoscaler source code, extracted and refactored from app-autoscaler-release.
The Application Autoscaler consists of several microservices and are deployed as CF Applications
| Component | Description |
|---|---|
api |
Public-facing API server for policy management and scaling history |
servicebroker |
Cloud Foundry service broker implementation |
scheduler |
Manages scheduled scaling policies and triggers scaling actions |
eventgenerator |
Evaluates scaling rules and generates scaling events based on metrics |
scalingengine |
Executes scaling decisions by adjusting application instances |
metricsforwarder |
Forwards custom application metrics to the autoscaler |
operator |
Manages autoscaler operations and instance synchronization |
OpenAPI specifications are available in the openapi/ directory:
application-metric-api.openapi.yaml- Application metrics APIcustom-metrics-api.openapi.yaml- Custom metrics submission APIpolicy-api.openapi.yaml- Scaling policy management APIscaling-history-api.openapi.yaml- Scaling history query APIinternal-scaling-history-api.openapi.yaml- Internal scaling history API
- Go 1.24.3 or later
- Docker to spin up required databases
- devbox (optional but recommended) - starts a shell with all required tools
- Maven for building the Java-based scheduler component
- direnv (optional) to automatically configure the development environment
| Target | Description |
|---|---|
make generate-fakes |
Generate test mocks/fakes |
make test |
Run unit tests against PostgreSQL |
make integration |
Run integration tests against PostgreSQL |
make acceptance-tests |
Run acceptance tests (see acceptance/README.md) |
make lint |
Check code style |
OPTS=--fix make lint |
Check code style and apply auto-fixes |
make fmt |
Format Go code |
make clean |
Remove build artifacts and generated code |
make mta-build |
Build MTA archive for deployment |
make mta-deploy |
Deploy to Cloud Foundry using MTA |
Refer to user guide for the details of how to use the Auto-Scaler service, including policy definition, supported metrics, public API specification and command line tool.
The app-autoscaler provides a number of health endpoints that are available externally that can be used to check the state of each component. Each health endpoint is protected with basic auth (apart from the api server), the usernames are listed in the table below, but the passwords are available in credhub.
| Component | Health URL | Username | Password Key |
|---|---|---|---|
| eventgenerator | https://autoscaler-eventgenerator.((system_domain))/health | eventgenerator | /autoscaler_eventgenerator_health_password |
| metricsforwarder | https://autoscaler-metricsforwarder.((system_domain))/health | metricsforwarder | /autoscaler_metricsforwarder_health_password |
| scalingengine | https://autoscaler-scalingengine.((system_domain))/health | scalingengine | /autoscaler_scalingengine_health_password |
| operator | https://autoscaler-operator.((system_domain))/health | operator | /autoscaler_operator_health_password |
| scheduler | https://autoscaler-scheduler.((system_domain))/health | scheduler | /autoscaler_scheduler_health_password |
# Run all unit tests
make test
# Run integration tests
make integration
# Run acceptance tests (requires deployed autoscaler)
make acceptance-testsNote: Running tests will automatically spin up the PostgreSQL database via Docker.
The autoscaler supports PostgreSQL.
To manually start a local database for development:
make start-db # Start PostgreSQLTo stop the database:
make stop-db # Stop PostgreSQL- Acceptance Tests - Guide for running acceptance tests
- Scheduler Component - Scheduler-specific documentation
- OpenAPI Specifications - API documentation and schemas
- app-autoscaler-release - BOSH release for deploying the Application Autoscaler
This project is released under version 2.0 of the Apache License.