Hula
Hula is ruby client that provides two libraries wrapping the CF and BOSH cli.
It gives a way to programmatically manage your bosh manifest and bosh deployments with
BoshDirector
and BoshManifest
.
Similarly with CF, you can make use of the CloudFoundry
class to call common
CF CLI operations.
Installation
Add this line to your application's Gemfile:
gem 'hula'
And then execute:
$ bundle
Or install it yourself as:
$ gem install hula
Usage
CloudFoundry
A simple scenario of pushing a cf application and binding a service using Hula::CloudFoundry
- Instantiate a Cloudfoundry instance with correct args (domain, api_url etc..).
- Authenticate using the
login
method. - Assuming an org/space, target your org and space using the
target_org
andtarget_space
method respectively. - Push your app with
push_app
. - Assuming an already enabled service, use the
bind_app_to_service
method. - Start your app with
start_app
.
cf = Hula::CloudFoundry.new(domain: 'my.cf.com', api_url: 'api.my.cf.com')
cf.login('admin', 'admin')
cf.target_org('org')
cf.target_space('space')
cf.push_app('./my-app', 'my-app')
cf.bind_app_to_service('my-app', 'my-service')
Bosh
You can use Hula::BoshDirector
to deploy, run errands, get ips from jobs and more:
- Instantiate Hula::Bosh with your director information.
- Use
deploy
with a valid manifest to deploy it. - Use
run_errand
to run the given errand specified in the manifest. - Use
ips_for_job
to get all ips for a given job in the manifest.
bosh = Hula::BoshDirector(target_url: 'bosh_director_url', username: 'user',password: 'pass')
bosh.deploy('./manifests/manifest.yml')
bosh.run_errand('some_errand_name')
puts bosh.ips_for_job('job_name')
Contributing
- Fork it ( https://github.com/[my-github-username]/hula/fork )
- Create your feature branch (
git checkout -b my-new-feature
) - Add tests to your feature
- Commit your changes (
git commit -am 'Add some feature'
) - Push to the branch (
git push origin my-new-feature
) - Create a new Pull Request