Name: cf-abacus
Owner: Cloud Foundry Incubator
Description: CF usage metering and aggregation
Created: 2015-07-14 20:58:02.0
Updated: 2017-12-04 06:36:06.0
Pushed: 2018-01-18 14:09:58.0
Size: 12960
Language: JavaScript
GitHub Committers
User | Most Recent Commit | # Commits |
---|
Other Committers
User | Most Recent Commit | # Commits |
---|
The Abacus usage metering and aggregation service.
Abacus provides usage metering and aggregation for Cloud Foundry (CF) services. It is implemented as a set of REST micro-services that collect usage data, apply metering formulas, and aggregate usage at several levels within a Cloud Foundry organization.
Abacus is implemented in Node.js and the different micro-services can run as CF apps.
This diagram shows the main Abacus services and their role in the processing of usage data. It also shows the services you can deploy around Abacus to integrate it into your Cloud platform.
Abacus provides a REST API allowing Cloud service providers to submit usage data, and a REST API allowing usage dashboards, and billing systems to retrieve usage reports. The Abacus REST API is described in doc/api.md.
For presentations related to CF-Abacus, see the presentations page.
The Abacus FAQ can be found in doc/faq.md.
Abacus requires Node.js >= 8.9.4 and Yarn > 1.3.2
f-abacus
otstrap the build environment
stall the Node.js module dependencies and run the tests
run build
The Abacus apps can also run on your local host in a shell environment outside of Cloud Foundry, like this:
f-abacus
art the Abacus apps
start
it a bit until all the apps have started
n the demo script
run demo
op everything
stop
Abacus uses yarn
to fix the versions of a package's dependencies. Fixed dependencies are
persisted in yarn.lock
file which is located at the same directory where package.json
file
exists.
Updating dependencies
f-abacus
nerates the yarn.lock files
update-locks
f-abacus/lib/<module>
lete existing dependencies
rf node_modules/
lete existing lock file
arn.lock
stall/Update dependency/cies in package.json file either manually or via yarn
add <dependency>
d dependency
install
f-abacus
n eslint on the Abacus modules
run lint
n the tests
test
For a list of all available tests check doc/tests.md.
Check our wiki on how to deploy Abacus to Cloud Foundry.
You can use Concourse pipelines to test, deploy and monitor Abacus.
The Abacus source tree is organized as follows:
- Start, stop, demo and cf push scripts
/ - Demo apps
client - demo program that posts usage and gets a report
- API documentation
- Abacus modules
metering/ - Metering services
collector - receives and collects service usage data
meter - applies metering formulas to usage data
aggregation/ - Aggregation services
accumulator - accumulates usage over time and applies
pricing to accumulated usage
aggregator - aggregates usage within an organization and applies
pricing to aggregated usage
reporting - returns usage reports
cf/ - CF platform integration
applications - collects CF app usage data
renewer - carries over usage from previous month
services - collects CF service usage data
config/ - Usage formula and pricing configuration
utils/ - Utility modules used by the above
plugins/ - Plugins for provisioning and account services
/ - End to end tests
perf/ - Performance tests
s/ - Build tools
- Misc build scripts
concourse/ - Concourse pipelines
As shown in the above Layout section, Abacus consists of a number of Node.js modules under the lib directory.
When developing on Abacus you may want to quickly iterate through changes to a single module, and run the tests only for that module rather than rebuilding the whole project each time.
Here are the steps most of us follow when we work on a single module, using the collector module as an example.
First, bootstrap your Abacus development environment:
f-abacus
tup the base Node.js tools and dependencies used by the Abacus build
run bootstrap
Then install your module's dependencies as usual with yarn:
f-abacus/lib/metering/collector
install
At this point your development cycle boils down to:
f-abacus/lib/metering/collector
n ESLint on your code and run the module's unit tests
test
To run the collector app you can do this:
f-abacus/lib/metering/collector
start
To push the app to your Cloud Foundry instance, do this:
f-abacus/lib/metering/collector
run cfpush
Finally, to rebuild everything once you're happy with your module:
f-abacus
portant to do at this point as the next step does a git clean
add <your changes>
es a git clean to make sure the build starts fresh
run clean
ild and unit test all the modules
run build
to run what our Travis-CI build runs, including integration tests
run cibuild