Skip to content

dan-kirberger/app-autoscaler

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

[![Build Status](https://runtime-og.ci.cf-app.com/api/v1/pipelines/autoscaler/jobs/unit-tests/badge?ts=1)](https://runtime-og.ci.cf-app.com/pipelines/autoscaler)

CF-AutoScaler

This is an incubation project for Cloud Foundry. You can follow the development progress on Pivotal Tracker.

The CF-AutoScaler provides the capability to adjust the computation resources for Cloud Foundry applications through

  • Dynamic scaling based on application performance metrics
  • Scheduled scaling based on time

The CF-AutoScaler is provided as a Cloud Foundry service offering. Any application bound with CF-AutoScaler service will be able to use it.

Getting Started

System requirements:

Database requirement:

The CF-AutoScaler uses Postgres as the backend data store.

To get started, clone this project:

$ git clone https://github.com/cloudfoundry-incubator/app-autoscaler.git
$ cd app-autoscaler

The AutoScaler has multiple components.

  • api : provides public APIs to manage scaling policy
  • servicebroker: implements the Cloud Foundry service broker API
  • metricscollector: collect container's memory usage

CF-AutoScaler invokes Cloud controller API to trigger scaling on target application. To achieve this, a UAA client id with authorities cloud_controller.read,cloud_controller.admin is needed for the Cloud Foundry environment CF-AutoScaler is registered with. You can create it using UAA command line client, make sure the client ID and secret are the ones you configured when you package the .war files

uaac target http://uaa.<cf-domain>
uaac token client get admin -s <cf uaa admin secret>
uaac client add cf-autoscaler-client \
	--name cf-autoscaler \
    --authorized_grant_types client_credentials \
    --authorities cloud_controller.read,cloud_controller.admin \
    --secret cf-autoscaler-client-secret

The following sections describe how to test, deploy and run CF-AutoScaler service manually.

Initialize the Database

createuser postgres -s
psql postgres://[email protected]:5432 -c 'DROP DATABASE IF EXISTS autoscaler'
psql postgres://[email protected]:5432 -c 'CREATE DATABASE autoscaler'

mvn package
java -cp 'db/target/lib/*' liquibase.integration.commandline.Main --url jdbc:postgresql://127.0.0.1/autoscaler --driver=org.postgresql.Driver --changeLogFile=api/db/api.db.changelog.yml update
java -cp 'db/target/lib/*' liquibase.integration.commandline.Main --url jdbc:postgresql://127.0.0.1/autoscaler --driver=org.postgresql.Driver --changeLogFile=servicebroker/db/servicebroker.db.changelog.json update
java -cp 'db/target/lib/*' liquibase.integration.commandline.Main --url jdbc:postgresql://127.0.0.1/autoscaler --driver=org.postgresql.Driver --changeLogFile=scheduler/db/scheduler.changelog-master.yaml update
java -cp 'db/target/lib/*' liquibase.integration.commandline.Main --url jdbc:postgresql://127.0.0.1/autoscaler --driver=org.postgresql.Driver --changeLogFile=scheduler/db/quartz.changelog-master.yaml update
java -cp 'db/target/lib/*' liquibase.integration.commandline.Main --url jdbc:postgresql://127.0.0.1/autoscaler --driver=org.postgresql.Driver --changeLogFile=src/autoscaler/metricscollector/db/metricscollector.db.changelog.yml update
java -cp 'db/target/lib/*' liquibase.integration.commandline.Main --url jdbc:postgresql://127.0.0.1/autoscaler --driver=org.postgresql.Driver --changeLogFile=src/autoscaler/eventgenerator/db/dataaggregator.db.changelog.yml update
java -cp 'db/target/lib/*' liquibase.integration.commandline.Main --url jdbc:postgresql://127.0.0.1/autoscaler --driver=org.postgresql.Driver --changeLogFile=src/autoscaler/scalingengine/db/scalingengine.db.changelog.yml update

Generate TLS Certificates

./scripts/generate_test_certs.sh

Run Unit Tests

For all these three CF-AutoScaler components, a unit test unittest.properties under 'profiles' directory has been created to define the settings for unit test.

Unit tests

pushd api
npm install
npm test
popd

pushd servicebroker
npm install
npm test
popd

go install github.com/onsi/ginkgo/ginkgo
export DBURL=postgres://postgres@localhost/autoscaler?sslmode=disable
pushd src/autoscaler
ginkgo -r -race -randomizeAllSpecs
popd

pushd scheduler
mvn test
popd

Integration tests

pushd api
npm install
popd

pushd scheduler
mvn package -DskipTests
popd

go install github.com/onsi/ginkgo/ginkgo
export DBURL=postgres://postgres@localhost/autoscaler?sslmode=disable
ginkgo -r -race -p -randomizeAllSpecs src/integration

License

This project is released under version 2.0 of the Apache License.

About

Auto Scaling for CF Applications

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Go 49.6%
  • Java 33.2%
  • JavaScript 17.0%
  • Shell 0.2%