Makes deploying Infrastructures and apps on Amazon Easy 2
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.

Hugo (Cloud DSL) 0.4.0

A simple dsl to deploy to the Amazon EC2 cloud

Deploy your your apps ready for scale!

Hugo is a dsl interface built using the amazon-e2 gem, net/ssh and chef-solo. It is opinionated as far as deployment frameworks go. It is designed to launch an infrastructure built using Amazon RDS, Amazon ELB, and 1 - n Ubuntu 9.10 Application servers.


gem install hugo


First, you need a Amazon AWS Account

You need to configure you system to contain AWS info in environment variables.

Make sure you are enabled to generate ELB, RDS, and EC2.

Make sure you have a keypair generated for you AWS Account!

What does it look like?

# mycloud.rb
require 'hugo'

config = YAML.load_file("mycloud.yml")

Hugo do
  cloud "mycloud" do
    aws_access_key_id ENV['AMAZON_ACCESS_KEY_ID']
    aws_secret_access_key ENV['AMAZON_SECRET_ACCESS_KEY']

    database "sample_app_production" do
      server "company_server"
      user "admin"
      password "admin"


    app "sample_app" do
      key_name "my-keypair"
      key_path     "~/.ec2"
      cookbook "git://"          

      run_list ["role[base-rack-apache]"]

      add_recipe 'github_keys', :github => {  
                    :url => "", 
                    :publickey => config["github"]["publickey"], 
                    :privatekey => config["github"]["privatekey"]

      add_recipe 'apache2', :apache => { :listen_ports => ['8080'] }

      add_recipe 'packages', :package_list => config["package_list"]
      add_recipe 'gems', :gem_list => config["gem_list"]          

      add_recipe "hugo_deploy", :hugo => {
        :app => {
          :name => 'myapp',
          :branch => 'HEAD',
          :migrate => true,
          :migration_command => 'rake db:migrate'

        :ssl => {
          :private => config['app']['ssl']['private']
          :public => config['app']['ssl']['public']
          :gd_bundle => config['app']['ssl']['public']
        :web => { :port => '8080' }

      servers 2




What about the config file?

# mycloud.yml

  url: XXXX
  publickey: XXX
  privatekey: XXX

  - name: mysql-client
  - name: libmysqlclient15-dev    
  - name: libmysql-ruby1.8
  - name: libexpat1
  - name: libxml2
  - name: libxml2-dev
  - name: libxslt1-dev
  - name: sqlite3
  - name: libsqlite3-dev

  - name: bundler



The Hugo object is a wrapper to use the DSL, all of the DSL code must be inside of the Hugo block

Hugo do

  # All of your code goes here!


cloud [name]

The cloud object can take a name parameter that allows you to name your cloud and should have a block that defines what artifacts are in you cloud.

Current Artifacts:

  • database
  • balancer
  • app

database [name]

The database artifact currently uses AWS RDS server to deploy your mysql database, but the goal is that the database artiface will support multiple database server api's.


  • zone
  • server
  • user
  • password
  • type [default AWS:RDS]

balancer [name]

The balancer currently uses AWS ELB server to create a load balancer server, but the plans are to enable the artifact to support several options.


  • name
  • zone
  • port - app server port default [8080]
  • ssl - app server ssl port default [8443]
  • web_port - lb server port default [80]
  • web_ssl - lb ssl server port default [443]
  • type default [AWS:ELB]

app [name]

The app artifact is a front end using chef-solo to deploy the application. Chef is a powerful infrastructure deployment to and chef-solo is the command line version. We use AWS:EC2 to build the server and then ssh to connect and configure the server with chef-solo. Then we pull a cookbook down using git and pass chef-sole a json file pointing to the local cookbook. Then we let chef-solo do the rest of the work. The Chef Cookbook is made up of recipes. Using the app artifact you can add recipes to your infrastructure deployment by using the "add_recipe" passing the name and the options in a hash. This feature gives you a great deal of flexability for deploying your applications. In the example above you see that we are passing the github keys, package list, and gem list, as well as other items. We are really excited about this feature and it is proving effective to manage complex deployment strategies.


  • name
  • key_name
  • key_path
  • cookbook
  • run_list
  • add_recipe

Key Name

key_name - name of the key pair that you use to access your amazon infrastructure key_path - path where the file is located cookbook - the github repository of the cookbook that you want to use. run_list - the roles and recipes that you want chef-solo to run. add_recipe - the name of the recipe and a hash of options and settings.

Working with the source

When you pull the source you need to run the following:

gem install bundler
bundle install

# Run Tests

rake spec


Post an issue at