blitzem

Simple cloud environment management

Download the beta now! »

Manage whole environments

Blitzem allows you to control your cloud servers and load balancers as a complete environment, rather than requiring you to control nodes individually. Whole environments can be controlled with a single command.

Infrastructure as code

Your environment is specified as a simple, easy-to-read configuration file, allowing you to share, version-control, review and track changes, and replicate an environment's infrastructure configuration as of specific points in time.

Fits with existing tools

You bring your provisioning tool of choice (e.g. Puppet, Chef, CFEngine); blitzem will manage the infrastructure for it to run on.

blitzem has currently been tested with Rackspace Cloud and Amazon EC2, and could support other Infrastructure-as-a-Service providers in the future.


Getting started in four easy steps

  1. Install the latest blitzem release.
  2. Put your cloud server API key settings into your blitzem configuration file.
  3. Describe your full cloud server and load balancer environment in a environment file. (See examples).
  4. Bring your full environment up by typing blitzem up at the terminal. (See other commands).

See the download and setup instructions for more detail.

History

blitzem was created at the end of 2011 following a couple of years' experience with using various cloud providers for development and production infrastructure. We generally controlled our infrastructure via the cloud providers' web consoles or simple API scripting, but wanted a way to reduce the administrative overhead.

blitzem is open source, and released under a BSD Licence (see LICENCE.txt)

Design philosophy

  • To allow cloud servers to be managed in an automated, repeatable way, rather than being created ad-hoc via a web console.
  • To allow environments to be defined in a simple, declarative configuration file, allowing version control, visibility and shared ownership across teams.
  • To allow environments to be managed as a whole, allowing rapid setup/teardown of complete replicas of production for development, testing and experimentation.

Suggested use cases

  • If production infrastructure is cloud-based, refer to or copy the same blitzem configuration file for each different environment (prod, pre-prod, test, etc). This allows confidence that the pre-production environments match production. A different cloud account would be used for each tier to provide isolation and avoid naming conflicts.
  • When diagnosing a production fault, use blitzem to quickly spin up a replica of production infrastructure.
  • Use blitzem to manage continuous integration servers, allowing tear down at the end of each working day, and clean recreation the next morning.
  • Tag certain nodes as 'peak' or 'offpeak', and use blitzem on a scheduled job to spin them up/down around busy periods.
  • Use dynamic scripting within the blitzem environment file to provide fine-tuning over scaling; e.g. detect load average across a tier and instantiate enough servers to handle the load.
  • Keep the blitzem environment file in source control and allow each developer to have their own mini-replica of production. Use dynamic scripting within the environment file to add the developer's username as a prefix to each node/load balancer's name, and to select smaller/fewer nodes.

It is suggested that blitzem always be used in conjunction with a package configuration management tool (e.g. Puppet, Chef, CFEngine) to install packages and detailed configuration files on provisioned nodes.

A load-balanced server environment

  1. See examples/load_balanced/environment.groovy. Hover over the '?' symbols for an explanation of each element:
    import org.blitzem.model.*
    import org.blitzem.model.thirdparty.*
    import static org.blitzem.model.Size.*
    
    /* After raising the load balancer and nodes, requests to the load 
     * balancer on port 80 should be randomly distributed across web1 
     * and web2, and the returned index.html page should be the node hostname.
     *
     * To verify, run `blitzem up` and put the public IP address of the
     * load balancer into a web browser.
     */
    
    Defaults.DEFAULTS["osVersion"] = "11.04"
    Defaults.DEFAULTS["provisioning"] = [new ScriptExecution("apt-get update; apt-get install dtach; mkdir web; cd web; hostname > index.html; dtach -n /tmp/simple_http.worker python -m SimpleHTTPServer 8080")]      // ?
    
    
    new LoadBalancer([                      // ?
        name:"web-lb1",
        tags:["web"],                       // ?
        appliesToTag: "web",                // ?
        protocol: "http",
        port: 80,
        nodePort: 8080
        ])
    
    new Node([                              // ?
        name:"web1",
        tags:["web", "peak"],               // ?
        size:ram(512)                       // ?
        ])
    
    new Node([
        name:"web2",
        tags:["web", "peak"],
        size:ram(256)
        ])
    
  2. In this environment, we have two server nodes and a single load balancer configured to share load between them. A simple script execution performed after node creation is used to create a basic web server on each node
  3. While in the examples/load_balanced folder, execute the command blitzem up
  4. blitzem brings up both server nodes followed by the load balancer:
  5. Afterwards it displays a summary of the currently active devices:
  6. If you visit the load balancer's public IP address and refresh the page, you should see that the traffic has been spread across both server nodes.

Command line syntax

Command Description
help Display a summary of blitzem commands.
status For the current environment file, display the state of all defined nodes and load balancers.
up name/tag If it is not already up, create a new instance of the node(s) or load balancer(s) with the provided name or tag. If no name/tag is provided, this command will apply to all nodes and load balancers.
down name/tag If it is currently up, destroy the instance of the node(s) or load balancer(s) with the provided name or tag.If no name/tag is provided, this command will apply to all nodes and load balancers.

Credentials file syntax

blitzem requires your cloud provider credentials to be stored separately from your environment configuration file. This can be used to enable sensitive credentials to be distributed appropriately, whilst still enabling visibility and reuse of environment configuration across teams. For blitzem to operate, you need to ensure that a file similar to the following is placed at ~/.blitzem/config.properties:

# config.properties template (created for blitzem version 0.3)

# Valid values: cloudservers-uk, aws-ec2
compute-provider=
compute-accesskeyid=
compute-secretkey=

# Valid values: cloudloadbalancers-uk, aws-ec2
loadbalancer-provider=
loadbalancer-accesskeyid=
loadbalancer-secretkey=

# Valid values: rackspace-uk, aws
provider=rackspace-uk

Environment file syntax

The blitzem environment file should be named environment.groovy. It should either be present in the working directory where blitzem is run from, or should be referred to using a command line option: blitzem --source=/some/other/dir/environment.groovy up.

Name Parameters Description
Node A compute node / virtual server
name The name that blitzem should use (may or may not map directly to the name of the compute node in the cloud)
tags Specifies tag groups that this node should respond to, for example when executing commands such as 'blitzem up web'
size A minimum size for this node; e.g.: ram(1024) or ramAndCores(1024,2)
os OS criteria that should be used when selecting a base image, e.g.:
new Os([
  family:  'UBUNTU',
  version: '11.04',
  os64Bit: true
])
LoadBalancer A load balancer distributes incoming requests across compute nodes
name The name that blitzem should use (may or may not map directly to the name of the load balancer in the cloud)
tags Specifies tag groups that this load balancer should respond to, for example when executing commands such as 'blitzem up web'
appliesToTag Specify which tag this load balancer should apply to - all nodes with this tag will be load-balanced
protocol What protocol is being load balanced; either http or tcp
port The externally accessible port the load balancer will listen on
nodePort The port on compute nodes which incoming requests should be routed to
blitzem is currently in early beta release. This means that there may be bugs and missing features, and it may not be ready for use in all contexts. Users of blitzem are wholly responsible for any consequences of its use or misuse.

Linux & OS X Installation and first use

  1. Please ensure that a recent version of Java is installed on your system (e.g. Sun JDK 1.6+)
  2. Unpack the archive to a convenient location (e.g. /usr/local/blitzem or ~/blitzem)
  3. Add the following lines to your .bashrc file:
    export BLITZEM_HOME=/usr/local/blitzem    # (or whereever you unpacked the archive to)
    export PATH=$BLITZEM_HOME/bin:$PATH
  4. Open a new terminal or type . ~/.bashrc
  5. Check that blitzem is installed by typing blitzem help. You should see a help message if it is correctly set up
  6. Try it out
  7. Ensure you have API access to one of the supported cloud providers, and have credentials entered into the ~/.blitzem/config.properties file.
  8. Navigate to one of the provided examples:
    cd $BLITZEM_HOME/examples/load_balanced
  9. Launch blitzem to create the servers and load balancer:
    blitzem up
  10. After a while, you should see success messages followed by a status summary resembling the following:
    Node status
    Node name Status Public IP Address(es) Private IP Address(es)        Tags
    ========= ====== ===================== ====================== ===========
         web1     UP     [164.177.147.234]        [10.177.141.44] [web, peak]
         web2     UP     [164.177.147.237]        [10.177.141.54] [web, peak]
         web3     UP     [164.177.147.239]        [10.177.141.56] [web, peak]
         web4     UP     [164.177.147.241]        [10.177.141.58] [web, peak]
    
    
    Load Balancer status
    LB name Status       IP Address  Tags  Applies to nodes tagged Type Location
    ======= ====== ================ ===== ======================== ==== ========
    web-lb1     UP [31.222.175.127] [web]                      web   LB [GB-SLG]
  11. Take the load balancer IP address and enter it into your web browser (e.g. http://31.222.175.127). You should see the hostname of one of the nodes returned. Refreshing the page should return a different host name on each request, corresponding to each of the four load-balanced nodes.

Windows Installation

Instructions coming soon

blitzem project

Visit the blitzem project on Github or email rich.north+blitzem@gmail.com with any questions or comments.

About the author

The author, Richard North, is an IT Consultant based in London, UK.