Skip to content

Commit

Permalink
Merge pull request #47 from onefinestay/libcloud_refactor
Browse files Browse the repository at this point in the history
Libcloud refactor
  • Loading branch information
amitofs committed Apr 16, 2015
2 parents 327aede + 0a6bfed commit 7ac4b4a
Show file tree
Hide file tree
Showing 66 changed files with 779 additions and 2,436 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,5 @@
docs/_build/
.DS_Store
dist
.coverage
.coverage*
htmlcov/
2 changes: 2 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
sudo: false

language: python
python:
- "2.7"
Expand Down
7 changes: 7 additions & 0 deletions CHANGES
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
Version 0.4.0
--------------

- Rewrite cloud backend to use libcloud instead of nova and boto
- Drop support for cloud formation


Version 0.3.1
--------------

Expand Down
101 changes: 17 additions & 84 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,14 @@ Instance and release management made easy
Manage instances running in *Amazon Web Services* or using *Openstack* using
a single consistent interface::

$ gonzo instance-launch production-web-app
$ gonzo launch production-web-app
...
$ gonzo list

production-web-app-001 m1.large ACTIVE david 0d 0h 2m 23s
fullstack-database-006 m1.small ACTIVE fergus 7d 23h 45m 3s
staging-jenkins-slave-003 m1.large ACTIVE matthew 60d 4h 18m 40s
name type status owner uptime location

production-web-app-001 m1.small RUNNING tom 0d 0h 1m 18s eu-west-1b
production-web-db-001 m3.medium RUNNING amit 27d 1h 8m 13s eu-west-1a


Easily target instances or groups of instances with ``fab`` commands
Expand All @@ -38,10 +39,10 @@ config`` command to chose where you want to deploy servers or projects to::
region: None
$ gonzo config --cloud aws
cloud: aws
region: eu-west-1
$ gonzo config --region us-west-1
cloud: aws
region: us-west-1
$ gonzo config --region eu-west-1
cloud: aws
region: eu-west-1

Managing the instance lifecycle
--------------------------------
Expand All @@ -52,14 +53,18 @@ within.
To see a list of all running instance in the region::

$ gonzo list
production-sql-004 m1.small ACTIVE david 20d 20h 4m 23s
production-web-004 m1.small ACTIVE fergus 7d 23h 45m 3s
name type status owner uptime location

production-web-app-001 m1.small RUNNING tom 408d 0h 42m 18s eu-west-1a
production-web-app-002 m3.medium RUNNING amit 27d 1h 8m 13s eu-west-1b
production-web-db-011 m3.medium RUNNING amit 160d 2h 33m 18s eu-west-1c



To add a new instance to the region, specifying the server type - having defined
server types, and their sizes in your config::

$ gonzo instance-launch production-web
$ gonzo launch production-web

To get more info on the commands available::

Expand Down Expand Up @@ -143,7 +148,7 @@ each cloud by using the ``DEFAULT_USER_DATA`` config item in config.py::
Additionally, user data scripts can be specified per instance by using the
launch argument ``--user-data <file | url>``::

# gonzo instance-launch --user-data ~/.gonzo/cloudinit_web_app production-web-app
# gonzo launch --user-data ~/.gonzo/cloudinit_web_app production-web-app

User data scripts can be specified as a file path or URL.

Expand All @@ -165,82 +170,10 @@ defining a ``USER_DATA_PARAMS`` cloud config dictionary::
Again, these parameters can also be supplemented or overridden at launch time
by using the command line argument ``--user-data-params key=val[,key=val..]``::

# gonzo instance-launch --user-data ~/.gonzo/cloudinit_web_app \
# gonzo launch --user-data ~/.gonzo/cloudinit_web_app \
--user-data-params puppet_address=puppetmaster2.example.com \
production-web-app

Launching CloudFormation Stacks with Gonzo
------------------------------------------
Gonzo can be used to launch stacks to CloudFormation compatible APIs. Stacks
can be launched, listed, shown (for individual detail) and terminated.
Launching a stack is as simple as::

# gonzo stack-launch website-stack

This would launch a stack named ``website-stack-001`` (or with another unique
incrementing numeric suffix). The stack's template URI is looked up from the
``ORCHESTRATION_TEMPLATE_URIS`` config dictionary declared within your
cloud's config scope. The template used would be identified by
``website-stack`` or, failing that, ``default``::

CLOUDS = {
'cloudname': {

...
'ORCHESTRATION_TEMPLATE_URIS': {
'default': '~/gonzo/cfn_default',
'website-stack: 'https://example.com/cfn/website-stack.json',
# ^ This one would be used ^
},
...

The template URI can also be overridden on the command line with the
``--template-uri`` option. Template URIs can be a local file path or a
resolvable web request.

Once resolved, templates are parsed as Jinja2 templates. Some variables such as
``stackname``, ``domain`` and ``fqdn`` are provided by default but these
can be supplemented or overridden by a config supplied dictionary and then a
command line argument. Command line provided key-values always override others.
For example, with the following config values defined::

CLOUDS = {
'cloudname': {

...
'ORCHESTRATION_TEMPLATE_URIS': {
'default': '~/gonzo/cfn_default',
'website-stack: 'https://example.com/cfn/website-stack.json',
},
'ORCHESTRATION_TEMPLATE_PARAMS': {
'puppetmaster': 'puppetmaster.example.com',
'db_server': 'db.example.com',
},
...

'DNS_ZONE': 'example.com',

the command::

# gonzo stack-launch \
--template-params db_server=db-secondary.example.com \
website-stack

would result in a stack being launched from a template fetched from
``https://example.com/cfn/website-stack.json``. The template would be
parameterised by the dictionary::

{
'stackname': 'website-stack-001',
'domain': 'example.com',
'fqdn': 'website-stack-001.example.com',
'puppetmaster': 'puppetmaster.example.com',
'db_server': 'db-secondary.example.com',
}

and the stack would be labelled with a unique name prefixed with
``website-stack``.


TODO
----
Expand Down
Empty file removed gonzo/aws/__init__.py
Empty file.
77 changes: 0 additions & 77 deletions gonzo/aws/iam.py

This file was deleted.

105 changes: 0 additions & 105 deletions gonzo/aws/route53.py

This file was deleted.

0 comments on commit 7ac4b4a

Please sign in to comment.