Giter Club home page Giter Club logo

nubo's Introduction

Nubo

https://secure.travis-ci.org/ema/nubo.png?branch=master
.. module:: nubo

Nubo is a command line program that allows you to start virtual machines on different cloud providers, also making sure you can SSH into those instances once they are available.

As an example, you might want to start a new node on Amazon EC2:

$ export NUBO_CLOUD=EC2_EU_WEST
$ nubo start ami-27013f53
Instance i-4ea89004 available on EC2_EU_WEST. Public IP: 54.247.8.150

And then install puppet on it:

$ ssh [email protected] "apt-get -y install puppet"
Warning: Permanently added '54.247.8.150' (RSA) to the list of known hosts.
Reading package lists...
Building dependency tree...
Reading state information...
The following extra packages will be installed:
[...]

One of the biggest challenges when deploying virtual machines on multiple clouds is ensuring you can actually access those machines after they have started up. For example, different cloud providers allow you to upload your SSH public key in different ways. Certain providers automatically configure firewall rules which by default deny traffic to your instances. If your deployments need to be automated, your infrastructure code has to deal with that.

nubo abstracts away these differences for you. It uses Apache Libcloud to start virtual machines on different cloud providers and Paramiko to establish SSH connections to the instances you start. Its functionalities are also available as a Python library.

Installation

Install nubo with one of the following commands:

$ pip install nubo

Alternatively, use easy_install:

$ easy_install nubo

You need to have ca-certificates installed on your system.

Usage

Invoke nubo without arguments to see the available functionalities:

$ nubo
usage: nubo [-h] {config,clouds,list,images,start,reboot,delete} ...

Start Virtual Machines on multiple clouds

positional arguments:
  {config,clouds,list,images,start,reboot,delete}
    config              set your cloud credentials
    clouds              list available clouds
    list                list running VMs
    images              list available images
    start               start a new VM
    reboot              reboot a given VM
    delete              delete a given VM

optional arguments:
  -h, --help            show this help message and exit

Run nubo config to set your cloud credentials. The following examples shows how we can configure one of the available cloud providers:

$ nubo config
 1 DIGITAL_OCEAN
 2 EC2_AP_NORTHEAST
 3 EC2_AP_SOUTHEAST
 4 EC2_AP_SOUTHEAST2
 5 EC2_EU_WEST
 6 EC2_US_EAST
 7 EC2_US_WEST
 8 EC2_US_WEST_OREGON
 9 OPENNEBULA
10 RACKSPACE
11 RACKSPACE_UK
Please choose the cloud provider you want to setup [1-11] 5
Please provide your API key: MYAPIKEY
Please provide your API secret: MYAPISECRET
EC2_EU_WEST cloud configured properly

To see which virtual machine images are available, we can use nubo images:

$ export NUBO_CLOUD=DIGITAL_OCEAN
$ nubo images
20 images available on DIGITAL_OCEAN
 id              name
===============================
85271   wheezy
85431   postgres-base
1607    Gentoo x64
13632   Open Suse 12.1 x32
13863   Open Suse 12.2 X64
18414   Arch Linux 2012-09 x64
23593   Arch Linux 2012-09 x64
63749   Gentoo 2013-1 x64
1601    CentOS 5.8 x64
1602    CentOS 5.8 x32
1609    Ubuntu 11.10 x32 Server
1611    CentOS 6.2 x64
1615    Fedora 16 x64 Server
1618    Fedora 16 x64 Desktop
2676    Ubuntu 12.04 x64 Server
12573   Debian 6.0 x64
12574   CentOS 6.3 x64
12575   Debian 6.0 x32
12578   CentOS 6.3 x32
14097   Ubuntu 10.04 x64 Server

New virtual machine instances can be started with nubo start. Note that the command will not return until the remote machine has finished booting up and it accepts SSH connections:

$ nubo start 12573
Instance 150843 available on DIGITAL_OCEAN. Public IP: 198.199.72.211

With nubo list we can see the status of our virtual machines on a given cloud provider:

$ nubo list
1 VMs running on DIGITAL_OCEAN
  id     name    state          ip
========================================
150843   test   RUNNING   198.199.72.211

API Reference

All nubo functionalities can be accessed via its Python API. Here is a brief example of how to deploy a new virtual machine:

from nubo.clouds.base import get_cloud

Cloud = get_cloud('EC2_EU_WEST')
ec2 = Cloud()

print ec2.deploy(image_id='ami-27013f53', name='my-new-vm')

Please refer to the following API documentation for further details.

.. automodule:: nubo.clouds.base
   :members:

.. autoclass:: nubo.clouds.base.BaseCloud
   :show-inheritance:
   :members:

.. automodule:: nubo.clouds.digitalocean
   :members:

.. autoclass:: nubo.clouds.digitalocean.DigitalOcean
   :show-inheritance:
   :members:

.. automodule:: nubo.clouds.ec2
   :members:

.. autoclass:: nubo.clouds.ec2.AmazonEC2
   :show-inheritance:
   :members:

.. automodule:: nubo.clouds.rackspace
   :members:

.. autoclass:: nubo.clouds.rackspace.Rackspace
   :show-inheritance:
   :members:

.. automodule:: nubo.clouds.opennebula
   :members:

.. autoclass:: nubo.clouds.opennebula.OpenNebula
   :show-inheritance:
   :members:

nubo's People

Contributors

bsdlp avatar ema avatar prologic avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

Forkers

aawm cloudxtreme

nubo's Issues

Cannot start new servers at digital ocean

I'm connected and can list my current servers (droplets) but I cannot start new ones.

~/Sites/bfnetwork on master $ nubo start --privkey ~/.ssh/id_rsa --name test 10274087
Traceback (most recent call last):
  File "/usr/local/bin/nubo", line 4, in <module>
    __import__('pkg_resources').run_script('nubo==0.7', 'nubo')
  File "build/bdist.macosx-10.10-x86_64/egg/pkg_resources/__init__.py", line 652, in run_script
  File "build/bdist.macosx-10.10-x86_64/egg/pkg_resources/__init__.py", line 1580, in run_script
  File "/usr/local/Cellar/python/2.7.9/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/nubo-0.7-py2.7.egg/EGG-INFO/scripts/nubo", line 201, in <module>

  File "/usr/local/Cellar/python/2.7.9/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/nubo-0.7-py2.7.egg/EGG-INFO/scripts/nubo", line 198, in main

  File "/usr/local/Cellar/python/2.7.9/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/nubo-0.7-py2.7.egg/EGG-INFO/scripts/nubo", line 125, in start

  File "/usr/local/Cellar/python/2.7.9/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/nubo-0.7-py2.7.egg/nubo/clouds/digitalocean.py", line 41, in deploy
  File "/usr/local/Cellar/python/2.7.9/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/apache_libcloud-0.17.0-py2.7.egg/libcloud/compute/drivers/digitalocean.py", line 167, in ex_create_ssh_key
    assert 'ssh_key' in data
AssertionError

RACKSPACE_UK provider broken

Hi
Running
nubo config
typing '12'
and providing API details throw an exception, last line pasted below, looks like it is straight through from libcloud:-

Exception: Provider constant RACKSPACE_UK has been removed. New constant is now called RACKSPACE_FIRST_GEN.

Going to try some workarounds but thought I should report the bug here.

Specify SSH Keys

My default ssh key is a DSA key in ~/.ssh/id_dsa and ~/.ssh/id_dsa.pub. I don't see a way to specify the SSH keys to use.

Error during configuration.

First time trying nubo. This is on Debian 7.1AMD64 release.

Please choose the cloud provider you want to setup [1-11] 1
Please provide your API key: xxx
Please provide your API secret: xxx
Traceback (most recent call last):
  File "/usr/local/bin/nubo", line 206, in <module>
    main()
  File "/usr/local/bin/nubo", line 203, in main
    opts.func(opts)
  File "/usr/local/bin/nubo", line 62, in config
    if Cloud.test_conn(**values):
  File "/usr/local/lib/python2.7/dist-packages/nubo/clouds/base.py", line 120, in test_conn
    return type(driver.list_nodes()) == list
  File "/usr/local/lib/python2.7/dist-packages/libcloud/compute/drivers/digitalocean.py", line 82, in list_nodes
    data = self.connection.request('/droplets').object['droplets']
  File "/usr/local/lib/python2.7/dist-packages/libcloud/common/base.py", line 609, in request
    connection=self)
  File "/usr/local/lib/python2.7/dist-packages/libcloud/common/base.py", line 93, in __init__
    raise Exception(self.parse_error())
Exception: None

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.