BigBang
What is BigBang?
Bigbang is a tool to create clusters using Amazon EC2 in a scriptable way. You create a descriptor file (called universe file) which describes your whole cluster and then you can launch it on EC2 with a single command. Bigbang allows you to use the same “universe” file to create multiple “universes”, say for example a live, a QA and staging clusters. You can even use it to automate the creation of a cluster for performance testing purposes.
What can it do for you?
BigBang can do the following:
-
startup ec2 instances
-
allocate and assign elastic ip’s to instances
-
assign instances to load balancer
-
create DNS record entries (Amazon and Zerigo supported).
-
shutdown your whole cluster
How does it work?
As stated before, all you have to do is create a “universe.rb” file which describes your cluster. You then run “bigbang explode <cluster-name>” and it will “explode your universe” :).
Installation
$> gem install bigbang
How does it bootstrap the boxes?
Bigbang uses a “git-based” bootstraper. What it means it that you configure a git repo which contains a “run” script. Bigbang will make sure this repo is cloned inside your ec2 instance and executed. What this script does is up to you. It can then for example install and setup puppet or chef which will continue the provisioning of the instance.
A simple example
Consider the following universe file:
BigBang::DSL::Universe.new do
config do |c|
c.access_key_id = "YOUR-AMAZON-ACCESS_KEY"
c.secret_key = "YOUR-AMAZON-SECRET_KEY"
c.dns :provider => 'Zerigo',
:zerigo_email => "[email protected]",
:zerigo_token => 'xxxxxxxxxxxxx'
c.domain = "example.com"
end
# describe your instance
instance "ubuntu" do |i|
i.ami = "ami-e2af508b"
i.key_name = "dev"
i.type = "m1.small"
i.bootstrap_repo = "git://github.com/giorgenes/ec2-chef-bootstrap.git"
end
# run a single instance
run_single_instance("ubuntu") do |r|
r.domain = ["db"]
r.wildcard_domain = true
r.elastic_ip = true
end
# runs a cluster of db instances
run_cluster("ubuntu") do |r|
r.domain = ["app"]
availability_zone "us-east-1a" => 1
availability_zone "us-east-1b" => 1
r.load_balancer("app") do |lb|
lb.domains = ["app"]
lb.listeners = [
{ :protocol => 'http', :load_balancer_port => 80, :instance_port => 80 }
]
lb.availability_zones = ["us-east-1a", "us-east-1b"]
end
end
end
In this example we have a single instance of “ubuntu” AND a cluster of “ubuntu”. So if you run for example “bigbang explode live” it will do the following:
-
For the single instance:
-
create an ec2 instance with type “m1.small” and ami and key as stated.
-
allocate an elastic ip and associate with the intance.
-
clone the specified repo inside the box and run it (in this example, it will install chef).
-
create DNS records pointing to the instance: live.db.example.com
-
it will also create wildcard DNS records: *.live.db.example.com
-
-
For the cluster
-
create 2 ec2 instances on the specified availability zones.
-
clone the repo in the boxes and install chef
-
create DNS records to the boxes: live.app0.example.com and live.app1.example.com
-
create a load balancer called “app” for the http protocol mapping ports 80 to 80.
-
assign the cluster instances to the created load balancer
-
create a CNAME record for the load balancer: live.app.example.com
-
Commands
-
creates a universe called <universe-name>
bigbang explode <universe-name>
-
list universes
bigbang list
-
kill a universe
bigbang kill <universe-name>
-
test configuration
bigbang test
IMPORTANT
This gem is still in very early development stage.