Lincoln Stoll github

Ninefold API Action with Fog


I’ve been working on adding support for Ninefold to Fog, and the code is now in a somewhat beta state. It is now possible to create a machine via the library, and set up networking to access it - then tear it all down.

I want to have a look!

I’ve created a sample Rake script to demonstrate this, it can be found at Intstructions on how to use it are included in the gist.

This will start up a server, allocate it a public IP, and map the SSH port. Then when prompted, it will then tear this environment down.

I want to use it myself!

Currently, the code hasn’t been submitted upstream, so you will need to work directly against the git repo. To do this, add this to your Gemfile:

gem 'fog', :git => "", :branch => "ninefold"

You can then bundle install. This is currently a moving target, so you may want to ‘bundle update fog’ often to ensure you’re up to date.

See the gist for an example on how to interact with the API

You can also check out the repository, build install it, but this will override your system install - I’d reccomend using bundler.

If you want an interactive shell to experiment with the API:

git clone ninefold-fog
cd ninefold-fog
bundle install

Then set your API credentials in ~/.fog like in the gist

bundle exec bin/fog

You can then interact with the Ninefold API via Ninefold[:compute]. Some examples:

>> Ninefold[:compute].servers.all

>> Ninefold[:compute].list_networks

>> Ninefold[:compute].list_templates(:templatefilter => 'executable')

>> Ninefold[:compute].list_service_offerings

>> Ninefold[:compute] => 421, :serviceofferingid => 67, :zoneid => 1)

How does this all work anyway?

Via fog, items can be exposed in two ways. Requests, which map directly to the API. For naming convention reasons, we map the CamelCase API methods to underscore_methods. There are also Models, which map items at a higher level, and follow a set of fog conventions to make code somewhat portable across cloud providers.

At all times it will be handy to keep the API reference handy as we are wrapping that, it can be found at

The best way to see the requests in action is via the tests at

For interacting via the models, see the example gist and the fog documentation

I’m having problems!

If you find any bugs or have any feature requests, please log them at If you just want to have a chat about how this works, or how you can use it, feel free to contact me.

blog comments powered by Disqus
Lincoln Stoll

This hCard created with the hCard creator.