Friday, September 23, 2011

Oneiric server, Deploy Server fleets p2

Welcome to the second installment of this article series. In the first part of this article we installed an Ubuntu server instance, made sure it became an orchestra installation server. If this is new to you, Orchestra is a new Oneiric server feature that enables admins to very easily deploy fleets of Ubuntu servers. Let's pick up where the first article stopped

First, let's check where we are. You see installing the orchestra server, it automatically downloads and imports various Ubuntu server ISOs and creates all the needed structure (distros, profiles ...etc) in the underlying cobbler system. Let's see what have we

$ sudo cobbler list





woah! that sure makes my life easier. If you're interested to see where the isos were downloaded (like I was) here you are
ls /var/lib/cobbler/isos/
hardy-i386-mini.iso    lucid-i386-mini.iso    maverick-i386-mini.iso    natty-i386-mini.iso    oneiric-i386-mini.iso
hardy-x86_64-mini.iso  lucid-x86_64-mini.iso  maverick-x86_64-mini.iso  natty-x86_64-mini.iso  oneiric-x86_64-mini.iso

Let's create a new virtual box VM, to serve as our new "server" that needs to be installed. Here's how it looks for me

One thing is worth noting however, it's that the NIC is placed on the "intnet" network, which has the IP range that we configured in the first part of this article

now the only "real" thing you have to do, is to add a profile on the orchestra server for your new bare server. The profile binds its mac address, to a name and an installation profile (think OS to install, kickstart ..etc)

sudo cobbler system add --name="oneiric01.ubuntu.lan" --mac-address="08:00:27:B7:76:2A" --ip-address="" --dns-name="oneiric01.ubuntu.lan" --hostname="oneiric01.ubuntu.lan" --profile="oneiric-x86_64-juju" --mgmt-classes="orchestra-juju-available" --kopts=" DEBCONF_DEBUG=developer netcfg/dhcp_timeout=120 netcfg/choose_interface=eth0"
Boot the server, choose PXE (For vbox that's F12 then "l" that's an L)


Watch the installer fly by (look ma hands free)


and your box is ready!

That's how easy it is to install a fresh server off your orchestra box! So basically the only thing you need to do per server, is to attach it to a profile and that's it. Boot it and it installs whatever you provisioned for it. Of course any good admin already did that manually before, but it took effort and it wasn't standardized. Now you can count on Ubuntu server covering your back when you're tasked with installing a hundred servers

How cool was that! Got thoughts, comments or rotten tomatoes ? Shoot me a comment

Wednesday, September 21, 2011

Oneiric server, Deploy Server fleets p1

I'm gonna be posting a series of articles on new features and cool technology bits that are landing in Ubuntu Oneiric (11.10) server. Why? I like servers, I like cloud, I like Ubuntu, it all mixes well, what's not to like :)

During this first article, I'll be demoing (in a graphically intensive way :) what it takes (hint: not much!) to deploy a server fleet with Oneiric server. Orchestra is the name of a wonderful piece of technology that lands in Oneiric, that's been created on top of the open-source cobbler project. Orchestra is super easy to install and get started with, and enables you to very rapidly deploy tens or hundreds of physical servers. I'll be using virtualbox to build a small test "lab" on my laptop for purposes of this article. I did actually try KVM first, but faced some trouble getting PXE booting reliably, so I opted for virtualbox which worked flawlessly (kudos vbox guys, you rock!)

Let's get started, I created a VM to represent the very first "head node", that will install the rest of all nodes. Here is a summary of its configuration
Pop in the virtual CD, boot it, press F6, add "priority=critical locale=en_US url=" (Thanks Dustin!) so it looks like
The uquick profile answers all the installer questions, such that the installation is fully automatic. Since the VM contains two NICs however, we'll need to select a primary one (eth0 in my case)
The installation runs like a champ, fully automated, give it a few minutes till it finishes everything and reboots into the server OS (oh that was easy!)
Now I configure eth1 to have a static IP address of (I made any address up), here is a snapshot of /etc/network/interfaces and I started eth1 using ifup
At this stage, I rebooted the server but you definitely don't have to. Let's start actually installing Orchestra

sudo apt-get update
sudo apt-get install ubuntu-orchestra-server -y

Everything proceeds automatically, for any question you get during package installation, I'll provide a picture with the answer :)

That's it! You've just installed and configured your first Ubuntu Orchestra server, and you're now ready to install a fleet of Ubuntu servers the easy way! In part 2 of this article, I'll go through creating a second server, PXE booting and installing it from the orchestra server. (Extra credit: If you can't wait, try PXE booting a fresh server right now. Note that after installation, orchestra actually downloads and auto-imports a few Ubuntu mini ISOs, thus will need a few minutes depending on your internet connection speed)

So, what do you think of this coolness? Is this easier than the last time you tried building yourself an automated network installer? Shoot me a comment, let me know what you think

Monday, September 12, 2011

Torrent download Cloud appliance

The Why

A friend of mine who's a Linux systems geek as well, was tasked with building a library of Linux distro ISOs, this involved downloading tens of ISOs many of which were only offered in torrent form. Even if that were not the case, it would still be good practice to download such large binaries from torrent to avoid loading a certain mirror too much. Anyway, we were chatting about it, and since where I live bandwidth (especially upload) is a scarce resource, he was considering paying some service to download the torrents he needed and convert them to HTTP!

I mentioned I could build something to do just that in about an hour! It wouldn't even be complex. Armed with Ensemble I can very simply launch an EC2 instance, install rtorrent (my fav cli torrent client) and rtgui (rtorrent Web UI) and have it ready to crunch on any of your torrenting needs. We both became interested in seeing how well that would work and so here we go...

The How

I'll assume you already know how to get started with Ensemble. Let's see what it takes to deploy my torrent appliance

$ bzr branch lp:~kim0/+junk/rtgui
$ ensemble bootstrap
# Wait for ec2 to catch up (2~5 mins)
$ ensemble deploy --repository . rtgui
$ ensemble expose rtgui

That is basically all you need to "use" this appliance! Give another few minutes for the rtgui appliance to boot, install and configure itself. You can check status with

$ ensemble status 
2011-09-12 13:23:53,868 INFO Connecting to environment.
  0: {dns-name:, instance-id: i-2c37ee4c}
  1: {dns-name:, instance-id: i-1c28f17c}
    exposed: true
    formula: local:rtgui-9
    relations: {}
        machine: 1
        open-ports: [80/tcp, 55556/tcp, 55557/tcp, 55558/tcp, 55559/tcp, 55560/tcp,
        relations: {}
        state: started
2011-09-12 13:24:01,334 INFO 'status' command finished successfully

The import bit to watch for is "state: started", if it's something else, that means the ec2 instance is still being configured. It's nice to note that the following ports have been opened 55556-55560 since rtorrent is configured to use those ports, port 80 was opened for the Web UI, and port 6881 UDP was opened for the DHT network. I am in no way a torrent expert, so this could be completely unoptimized, but hey it seems to work

Ready to test? Machine 1 runs rtgui, so go ahead and visit it in a browser, for me that's (replace that DNS name with the right one for your instance, and don't forget the trailing /rtgui like I always do). Click "Add torrent" and pass it the URL to a torrent file, I'm gonna be testing with Ubuntu 11.10 beta1 amd64 torrent file. Once the torrent is added, click the green play button to start it. Since EC2 instances have quite some bandwidth available to them, this Ubuntu torrent downloaded in a just few seconds. I am shipping a default configuration with rtorrent that limits upload speed to 100KB (since you're paying for bandwidth), but you can change that from the web UI. Here's how the whole thing looks

Once a torrent file is downloaded, you can download it through (again replace the machine DNS name, with the correct name in your case)

A single torrent appliance is not ofcourse limited to a single torrent! You can keep adding as much as you want, however eventually you're going to hit some limit (disk IO, network IO, disk space ...etc). As such (probably only if you're after downloading really large number of torrents) you may need to "scale up" this torrent download appliance (well it's a cloud for God's sake!). If that's what you wish for, you only need to
$ ensemble add-unit rtgui

Simple as that, as with everything Ensemble! So now you know how you can download your 11.10 copy without loading Ubuntu's servers, actually you'd be helping them and all millions of Ubuntu users if you use this method on release day. Once you're done playing with the appliance, you need to destroy it (to stop paying Amazon for the machines)

$ ensemble destroy-environment
WARNING: this command will destroy the 'sample' environment (type: ec2).
This includes all machines, services, data, and other resources. Continue [y/N]y
2011-09-12 13:53:33,018 INFO Destroying environment 'sample' (type: ec2)...
2011-09-12 13:53:36,641 INFO Waiting on 2 EC2 instances to transition to terminated state, this may take a while
2011-09-12 13:54:18,617 INFO 'destroy_environment' command finished successfully

Want to improve it?

Things I wish I had time to improve:
  • Once a file is downloaded, upload it to S3. You can then terminate the appliance, and still download the files at your own pace
  • Parameterize rtorrent rc configuration file, such that you can pass it parameters from Ensemble (such as upload rate...etc)
  • Integrate notification upon download completion (SMS me, email me, IM me ...etc)
  • Add an auto-redirect to /rtgui :)
  • Figure out a way to download completed files from within the rtgui web UI

If you're interested in improving that appliance, drop by in #ubuntu-ensemble on IRC/Freenode and ping me (kim0) or any of the friendly folks around.

What kind of skills do you need to hack on that project? Just bash shell scripting foo! The feature I love most about Ensemble as a cloud orchestration tool, is that it doesn't twist you into using some abstracted syntax. You get to write in whatever language you feel like using, for me that's bash. You can find the script that does all of the above right here.

Interested to learn more about Ensemble and automating Ubuntu server deployments in the cloud or on physical servers ?
Want to hack on this torrent appliance, or do something similar?
Have comments or a better idea?

Let me know about it, just drop me a comment right here! You can also grab me (kim0) over Freenode irc

Sunday, August 21, 2011

Battling Hunger in the Horn of Africa

Hungry children in the Horn of Africa

A humanitarian crisis has slowly unfolded in the Horn of Africa. Drought, conflict, and rising food prices have affected more than 13 million people in the region. On 20 July, famine conditions were declared in several southern regions of Somalia. The Food Security and Nutrition Analysis Unit (FSNAU) forecasts that famine conditions will spread if humanitarian assistance does not increase. In response, WFP is planning to feed over 11.5 million people, including 3.7 million people in Somalia, 3.7 million in Ethiopia, and 2.7 million in Kenya.

Restricted aid access

Access to some vital areas is restricted to humanitarian aid organizations. The hatched area on the map shows areas in which some aid organizations are unable to work— including the places where people are most in need of assistance.

Operational efficiency

The figure of USD $0.50 per person per day is based on the average combined daily costs of World Food Programme's operations within Somalia, Ethiopia, & Kenya, as well as the number of people reached by those efforts.

If you cannot see the embedded map above, click here:

Save a child today!

How can Govs help FOSS businesses

Dear Lazyweb,

A group of FOSS ambassadors (of which I am one) have been invited to visit government officials who are "interested" in open-source. The goal will be to pitch open-source and why adopting it would have various benefits on a national level.

A more specific point that should be discussed is How can the government help local FOSS businesses grow in order to help, support and grow a FOSS-oriented eco-system (Developers, Support professionals, VARs...)

If you were in that meeting, what points would you make ?


Monday, August 8, 2011

Ensemble meets Hadoop on the cloud


So you wanted to play with hadoop to crunch on some big-data problems, except that, well getting a hadoop cluster up and running in not exactly a one minute thing! Let me show you how to make it "a one minute thing" using Ensemble! Since Ensemble now has formulas for creating hadoop master and slave nodes, spinning up a hadoop cluster could not be easier! Check this video out

If you can't see the embedded video, here's a direct link

Yep that's how simple it is! If you want to scale-out the cluster, you only need to ask Ensemble to do it for you:
$ ensemble add-unit hadoop-slave

So is this easier than configuring a hadoop cluster manually? Leave me a comment, let me know your thoughts! Also let me know what you'd like to see deployed next with Ensemble

Friday, July 29, 2011

Ubuntu takes UFOs to the cloud

I've always believed in UFOs as a kid, and while I've never seen one (yet?) I am still more on the believer side! I was interested to stumble upon a database of UFO sightings at A shout-out at infochimps (you guys are great!). Downloading the sightings DB (around 80MB), I found a listing of 60,000 documented sightings, hmm interesting! I started thinking I could crunch on this data in some useful and fun way, what about finding the most commonly spotted UFO shape?! Sounds like I could use hadoop for that, just for the coolness factor really, the data is not that large anyway, but hey why not! I had no-idea how to get started with hadoop though and wasn't really interested in learning up all the gory details!

Well Ensemble to the rescue, hadoop master and slave formulas exist, which means someone else packaged the knowledge needed to setup and run a hadoop cluster for me. All I needed to do was ask Ensemble to deploy me a couple of cloud instances and start playing. Let's see how you can do that for yourself

I won't repeat the instructions to get started with Ensemble, since the documentation is a good place for that (and it's so easy anyway!). If you feel you need more help there, this little video should be helpful. If you're still stuck, you can always drop by on irc/freenode at #ubuntu-ensemble and ask your questions

Hadoop node, with an extra slave please

So, let's start ensembling
bzr branch lp:~negronjl/+junk/hadoop-master
bzr branch lp:~negronjl/+junk/hadoop-slave
ensemble bootstrap
wait a minute or two for EC2 to spin up the instance, then
ensemble status
which’ll give you output like
$ ensemble status
2011-07-12 15:20:54,978 INFO Connecting to environment.
The authenticity of host ' (' can't be established.
RSA key fingerprint is c5:21:62:f0:ac:bd:9c:0f:99:59:12:ec:4d:41:48:c8.
Are you sure you want to continue connecting (yes/no)? yes
  0: {dns-name:, instance-id: i-8bc034ea}
services: {}
2011-07-12 15:21:01,205 INFO 'status' command finished successfully

Now let's deploy a two node hadoop cluster
ensemble deploy --repository . hadoop-master
ensemble deploy --repository . hadoop-slave
ensemble add-relation hadoop-master hadoop-slave

Yeah it's that easy! Ensemble formulas manage all the kung-fu for you. The hadoop cluster is ready, let's ssh into the master node and switch to user hdfs
ensemble ssh hadoop-master/0
sudo -su hdfs

Downloading UFOs

Download the infochimps sightings database here, unzip it and locate the TSV file (tab separated values) file. Note that you can download the file from infochimps without registering on their website (didn't I say these guys were great :)

Upload the TSV DB to hadoop's distributed filesystem
hadoop dfs -copyFromLocal ufo_awesome.tsv ufo_awesome.tsv

Almost ready, the corpus has been uploaded. Now we need to write some map/reduce jobs to do the actual crunching. Not being a pro developer, the thought of writing that in java was like (oh no ew), so python to the rescue! Thanks to the great instructions at Michael Noll's blog, I was able to massage some of that code to get it to do what I wanted. I pushed my code to launchpad, so that you can grab it directly from the hadoop master node

cd /tmp
bzr branch lp:~kim0/+junk/ufo-ensemble-cruncher
cd ufo-ensemble-cruncher

Unleashing the elephant

Now for the big moment, let's launch the elephant
hadoop jar /usr/lib/hadoop-0.20/contrib/streaming/hadoop-streaming-*.jar -file ./ -mapper -file ./ -reducer -input ufo_awesome.tsv -output ufo-output
packageJobJar: [./, ./, /tmp/hadoop-hdfs/hadoop-unjar1418682529553378062/] [] /tmp/streamjob5701745574334998473.jar tmpDir=null
11/07/29 12:27:52 INFO mapred.FileInputFormat: Total input paths to process : 1
11/07/29 12:27:53 INFO streaming.StreamJob: getLocalDirs(): [/tmp/hadoop-hdfs/mapred/local]
11/07/29 12:27:53 INFO streaming.StreamJob: Running job: job_201107290935_0010
11/07/29 12:27:53 INFO streaming.StreamJob: To kill this job, run:
11/07/29 12:27:53 INFO streaming.StreamJob: /usr/lib/hadoop-0.20/bin/hadoop job  -Dmapred.job.tracker=domU-12-31-39-10-81-8E.compute-1.internal:8021 -kill job_201107290935_0010
11/07/29 12:27:53 INFO streaming.StreamJob: Tracking URL: http://domU-12-31-39-10-81-8E.compute-1.internal:50030/jobdetails.jsp?jobid=job_201107290935_0010
11/07/29 12:27:54 INFO streaming.StreamJob:  map 0%  reduce 0%
11/07/29 12:28:11 INFO streaming.StreamJob:  map 10%  reduce 0%
11/07/29 12:28:12 INFO streaming.StreamJob:  map 19%  reduce 0%
11/07/29 12:28:14 INFO streaming.StreamJob:  map 72%  reduce 0%
11/07/29 12:28:16 INFO streaming.StreamJob:  map 100%  reduce 0%
11/07/29 12:28:33 INFO streaming.StreamJob:  map 100%  reduce 100%
11/07/29 12:28:37 INFO streaming.StreamJob: Job complete: job_201107290935_0010
11/07/29 12:28:37 INFO streaming.StreamJob: Output: ufo-output

Woohoo success! Now let's grab the results, sorting it to easily see the most popular sighting shape

Is the answer really 42

hadoop dfs -cat ufo-output/part-00000 | sort -k 2,2 -nr
light   12202
triangle        6082
circle  5271
disk    4825
other   4593
unknown 4490
sphere  3637
fireball        3452
oval    2869
formation       1788
cigar   1782
changing        1546
flash   990
cylinder        982
rectangle       966
diamond 915
chevron 760
egg     664
teardrop        595
cone    265
cross   177
delta   8
round   2
crescent        2
pyramid 1
hexagon 1
flare   1
dome    1
changed 1

The answer is "light" then! Wow that was a blast! I had fun doing this exercise. Now I am no hadoop expert in any way (so direct those hadoopy questions to someone who can actually answer them), however I was quite pleased Ensemble could help me get up and running that fast. The Ensemble community is doing a great job wrapping many free software with formulas, such that you can always get up and running with any app you need in seconds rather than days (months?). You too can write Ensemble formulas for your favorite (server?) application. Hop on to #ubuntu-ensemble and grab me (kim0) or any of the dev team and ask any questions on your mind! We're a happy community

So was that fun? Can you think of something cooler you want to see done? Leave me a comment, let me know about it

Tuesday, June 28, 2011

Ensemble deploy and scale cloud apps

Think deploying and scaling your cloud application is hard ? Think again!


Check out this video demo, where I deploy a multi-tiered cloud application. I'm deploying

  • HAproxy load balancer
  • Memcached caching server
  • MediaWiki application server
  • MySQL DB
connecting them together and getting it working. After which, I'm scaling the whole thing from two application servers, to four

How long it takes me ? Well basically 5 minutes for the whole thing!
The secret: Ensemble !

Here's the video

Here is a direct link if you can't see the player

So what do you guys think, like the demo ? Leave me a comment, let me know which demo you'd like to see next. Also if you'd like to see your favorite application deployed with Ensemble, leave me a comment or ping me (kim0) on freenode irc

Thursday, June 23, 2011

Ensemble user tutorial p2

Welcome to the second part of this Ensemble user tutorial. In part 1 we bootstrapped an Ensemble environment, deployed a sample wordpress service and a MySQL service. Related the two services together and got ourselves a working wordpress installation. In this second part, let's check out viewing the debug-log output to understand the asynchronous nature of hook execution. You'll see how easy it is to "scale-up" a service deployment

Tracing hook execution 
An Ensemble user should never have to trace the execution order of hooks, however if you are the kind of person who enjoys looking under the hood, this section is for you. Understanding hook order execution, the parallel nature of hook execution across instances, and how relation-set in a hook can trigger the execution of another hook is quite interesting and provides insight into Ensemble internals
Here are a few important messages from the debug-log of this Ensemble run. The date field has been deliberately left in this log, in order to understand the parallel nature of hook execution.
Things to consider while reading the log include:
  • The time the log message was generated
  • Which service unit is causing the log message (for example mysql/0)
  • The message logging level. In this run DEBUG messages are generated by the Ensemble core engine, while WARNING messages are generated by calling ensemble-log from inside formulas (which you can read in the examples folder)
Let’s view select debug-log messages which can help understand the execution order:
14:29:43,625 unit:mysql/0: hook.scheduler DEBUG: executing hook for wordpress/0:joined
14:29:43,626 unit:mysql/0: unit.relation.lifecycle DEBUG: Executing hook db-relation-joined
14:29:43,660 unit:wordpress/0: hook.scheduler DEBUG: executing hook for mysql/0:joined
14:29:43,660 unit:wordpress/0: unit.relation.lifecycle DEBUG: Executing hook db-relation-joined
14:29:43,661 unit:wordpress/0: unit.relation.lifecycle DEBUG: Executing hook db-relation-changed
14:29:43,789 unit:mysql/0: unit.hook.api WARNING: Creating new database and corresponding security settings
14:29:43,813 unit:wordpress/0: unit.hook.api WARNING: Retrieved hostname:
14:29:43,976 unit:mysql/0: unit.relation.lifecycle DEBUG: Executing hook db-relation-changed
14:29:43,997 unit:wordpress/0: hook.scheduler DEBUG: executing hook for mysql/0:modified
14:29:43,997 unit:wordpress/0: unit.relation.lifecycle DEBUG: Executing hook db-relation-changed
14:29:44,143 unit:wordpress/0: unit.hook.api WARNING: Retrieved hostname:
14:29:44,849 unit:wordpress/0: unit.hook.api WARNING: Creating appropriate upload paths and directories
14:29:44,992 unit:wordpress/0: unit.hook.api WARNING: Writing wordpress config file /etc/wordpress/
14:29:45,130 unit:wordpress/0: unit.hook.api WARNING: Writing apache config file /etc/apache2/sites-available/
14:29:45,301 unit:wordpress/0: unit.hook.api WARNING: Enabling apache modules: rewrite, vhost_alias
14:29:45,512 unit:wordpress/0: unit.hook.api WARNING: Enabling apache site:
14:29:45,688 unit:wordpress/0: unit.hook.api WARNING: Restarting apache2 service

Scaling the ensemble
Assuming your blog got really popular, is having high load and you decided to scale it up (it’s a cloud deployment after all). Ensemble makes this magically easy. All what is needed is:
$ bin/ensemble add-unit wordpress
INFO Connecting to environment.
INFO Unit 'wordpress/1' added to service 'wordpress'
INFO 'add_unit' command finished successfully
$ bin/ensemble status
  0: {dns-name:, instance-id: i-2a702745}
  1: {dns-name:, instance-id: i-227e294d}
  2: {dns-name:, instance-id: i-9c7e29f3}
  3: {dns-name:, instance-id: i-ba6532d5}
    formula: local:mysql-11
    relations: {db: wordpress}
        machine: 1
          db: {state: up}
        state: started
    formula: local:wordpress-29
    relations: {db: mysql}
        machine: 2
          db: {state: up}
        state: started
        machine: 3
          db: {state: up}
        state: started
The add-unit command starts a new wordpress instance (wordpress/1), which then joins the relation with the already existing mysql/0 instance. mysql/0 notices the database required has already been created and thus decides all needed configuration has already been done. On the other hand wordpress/1 reads service settings from mysql/0 and starts configuring itself and joining the ensemble. Let’s review a short version of debug-log for adding wordpress/1:
14:36:19,755 unit:mysql/0: hook.scheduler DEBUG: executing hook for wordpress/1:joined
14:36:19,755 unit:mysql/0: unit.relation.lifecycle DEBUG: Executing hook db-relation-joined
14:36:19,810 unit:wordpress/1: hook.scheduler DEBUG: executing hook for mysql/0:joined
14:36:19,811 unit:wordpress/1: unit.relation.lifecycle DEBUG: Executing hook db-relation-joined
14:36:19,811 unit:wordpress/1: unit.relation.lifecycle DEBUG: Executing hook db-relation-changed
14:36:19,918 unit:mysql/0: unit.hook.api WARNING: Database already exists, exiting
14:36:19,938 unit:mysql/0: unit.relation.lifecycle DEBUG: Executing hook db-relation-changed
14:36:19,990 unit:wordpress/1: unit.hook.api WARNING: Retrieved hostname:
14:36:20,757 unit:wordpress/1: unit.hook.api WARNING: Creating appropriate upload paths and directories
14:36:20,916 unit:wordpress/1: unit.hook.api WARNING: Writing wordpress config file /etc/wordpress/
14:36:21,088 unit:wordpress/1: unit.hook.api WARNING: Writing apache config file /etc/apache2/sites-available/
14:36:21,236 unit:wordpress/1: unit.hook.api WARNING: Enabling apache modules: rewrite, vhost_alias
14:36:21,476 unit:wordpress/1: unit.hook.api WARNING: Enabling apache site:
14:36:21,682 unit:wordpress/1: unit.hook.api WARNING: Restarting apache2 service

Destroying the environment
Once you are done with an Ensemble deployment, you need to terminate all running instances in order to stop paying for them. The shutdown command helps terminate all running instances:
$ bin/ensemble shutdown
Ensemble will ask for user confirmation of shutdown before proceeding as this will destroy service data in the environment as well.

Hope you enjoyed the article! If you find Ensemble interesting, please do visit us in #ubuntu-ensemble. We're a friendly bunch :) Do you want to write Ensemble formulas? Want to get the satisfaction of Ensemblizing your favorite application, grab me (kim0) on irc, and I will help you do it

Thursday, June 16, 2011

Ensemble user tutorial p1

I've been adding lots of documentation to help a new Ensemble user find her way around Ensemble. I thought it would nice to share this documentation as a series of blog posts, to raise its exposure and help interested users find their way quickly. Here is the first of a series of posts, which I hope you'll enjoy. If you think we can improve the docs in any way, please do let me know


This tutorial demonstrates basic features of Ensemble from a user perspective. An Ensemble user would typically be a devops or a sys-admin who is interested in automated deployment and management of servers and services.

The first step for deploying an Ensemble system is to perform bootstrapping. Bootstrapping launches a utility instance that is used in all subsequent operations to launch and orchestrate other instances:
$ bin/ensemble bootstrap
Note that while the command should display a message indicating it has finished successfully, that does not mean the bootstrapping instance is immediately ready for usage. Bootstrapping an instance can require a couple of minutes. To check on the status of the Ensemble deployment, we can use the status command:
$ bin/ensemble status
If the bootstrapping node has not yet completed bootstrapping, the status command may either mention the environment is not yet ready, or may display a connection timeout such as:
INFO Connecting to environment.
ERROR Connection refused
ProviderError: Interaction with machine provider failed:
ConnectionTimeoutException('could not connect before timeout after 2
ERROR ProviderError: Interaction with machine
provider failed: ConnectionTimeoutException('could not connect before timeout
after 2 retries',)
This is simply an indication the environment needs more time to complete initialization. It is recommended you retry every minute. Once the environment has properly initialized, the status command should display:
  0: {dns-name:, instance-id: i-2a702745}
  services: {}
Note the following, machine “0” has been started. This is the bootstrapping node and the first node to be started. The dns-name for the node is printed. Also the EC2 instance-id is printed. Since no services are yet deployed to the Ensemble system yet, the list of deployed services is empty

Starting debug-log
While not a requirement, it is beneficial for the understanding of Ensemble to start a debug-log session. Ensemble’s debug-log provides great insight into the execution of various hooks as they are triggered by various events. It is important to understand that debug-log shows events from a distributed environment (multiple-instances). This means that log lines will alternate between output from different instances. To start a debug-log session, from a secondary terminal issue:
$ bin/ensemble debug-log
INFO Connecting to environment.
INFO Enabling distributed debug log.
INFO Tailing logs - Ctrl-C to stop.
This will connect to the environment, and start tailing logs.

Deploying service units
Now that we have bootstrapped the Ensemble environment, and started the debug-log viewer, let’s proceed by deploying a mysql service:
$ bin/ensemble deploy --repository=examples mysql
INFO Connecting to environment.
INFO Formula deployed as service: 'mysql'
INFO 'deploy' command finished successfully
Checking the debug-log window, we can see the mysql service unit being downloaded and started:
Machine:1: ensemble.agents.machine DEBUG: Downloading formula
Machine:1: ensemble.agents.machine INFO: Started service unit mysql/0
It is important to note the different debug levels. DEBUG is used for very detailed logging messages, usually you should not care about reading such messages unless you are trying to debug (hence the name) a specific problem. INFO debugging level is used for slightly more important informational messages. In this case, these messages are generated as the mysql formula’s hooks are being executed. Let’s check the current status:
$ bin/ensemble status
  0: {dns-name:, instance-id: i-2a702745}
  1: {dns-name:, instance-id: i-227e294d}
    formula: local:mysql-11
    relations: {}
        machine: 1
        relations: {}
        state: null
We can see a new EC2 instance has now been spun up for mysql. Information for this instance is displayed as machine number 1 and mysql is now listed under services. It is apparent the mysql service unit has no relations, since it has not been connected to wordpress yet. Since this is the first mysql service unit, it is being referred to as mysql/0, subsequent service units would be named mysql/1 and so on.

An important distinction to make is the difference between a service and a service unit. A service is a high level concept relating to an end-user visible service such as mysql. The mysql service would be composed of several mysql service units referred to as mysql/0, mysql/1 and so on.
The mysql service state is listed as null since it’s not ready yet. Downloading, installing, configuring and starting mysql can take some time. However we don’t have to wait for it to configure, let’s proceed deploying wordpress:
$ bin/ensemble deploy --repository=examples wordpress
Let’s wait for a minute for all services to complete their configuration cycle and get properly started, then issue a status command:
$ bin/ensemble status
  0: {dns-name:, instance-id: i-2a702745}
  1: {dns-name:, instance-id: i-227e294d}
  2: {dns-name:, instance-id: i-9c7e29f3}
    formula: local:mysql-11
    relations: {}
        machine: 1
        relations: {}
        state: started
    formula: local:wordpress-29
    relations: {}
        machine: 2
        relations: {}
        state: started
mysql/0 as well as wordpress/0 are both now in the started state. Checking the debug-log would reveal wordpress has been started as well

Adding a relation
While mysql and wordpress service units have been started, they are still isolated from each other. An important concept for Ensemble is connecting various service units together to create a bigger ensemble! Adding a relation between service units causes hooks to trigger, in effect causing all service units to collaborate and work together to reach the desired end state. Adding a relation is extremely simple:
$ bin/ensemble add-relation wordpress mysql
INFO Connecting to environment.
INFO Added mysql relation to all service units.
INFO 'add_relation' command finished successfully
Checking the Ensemble status we see that the db relation now exists with state up:
$ bin/ensemble status
  0: {dns-name:, instance-id: i-2a702745}
  1: {dns-name:, instance-id: i-227e294d}
  2: {dns-name:, instance-id: i-9c7e29f3}
    formula: local:mysql-11
    relations: {db: wordpress}
        machine: 1
          db: {state: up}
        state: started
    formula: local:wordpress-29
    relations: {db: mysql}
        machine: 2
          db: {state: up}
        state: started
You can now point your browser at the public dns-name for instance 2 (running wordpress) to view the wordpress blog

Patience is a virtue, you did read the full thing after all! I would really appreciate some feedback, what you liked, or did not like. And how we can improve the docs. Drop me a comment, shoot what's on your mind

Wednesday, June 8, 2011

Ensemble IRC meeting today

When? Today 6pm-UTC
What? Ensemble cloud community meeting
For? Ensemble simplifies the deployment, management, and scaling of services in the cloud. We've answered the what is Ensemble question previously, but there's nothing like one to one discussions! Interested to learn more? ask your questions ? connect to the development team ? Start writing formulas to deploy your software or even start hacking on Ensemble core? Then this meeting is perfect for you. Join us on IRC in #ubuntu-cloud today 6pm-UTC

Friday, May 20, 2011

Ensemble at UDS-O

UDS-O is now over, I had a chance to meet with the Ensemble team (a bunch of awesome engineers), also had a chance to attend or lead a few sessions concerning future directions of Ensemble. I'll try to summarize UDS outcome wrt Ensemble from a project newcomer perspective

  • Ensemble is now able to do a multi-machine deployment and orchestration
  • It can do Dynamic reconfiguration which means passing parameters to running formulas to adjust behavior. More work needs to land here, but the foundations are there
  • Does formula upgrades, more bits landing soon
  • Firewall auto-configuration (expose, unexpose services). Again, still more bits to land soonish
  • It has a ppa and docs from trunk live at
The focus for the 11.10 Oneiric cycle is going to be stability and polish. While currently Amazon EC2 is the only supported deployment target, the 11.10 cycle should hopefully see more targets added such as Linux Containers (LXC) for local development and testing of Ensemble formulas. Having LXC support in 11.10 is a bit optimistic, so if you can lend a helping hand, please do! Also Eucalyptus cloud support is the works (isn't this just great!)

During 11.10 as well, the infrastructure for Ensemble as a project should be improved. This involves adding better and more structured content to the Ensemble website. Adding more documentation, guides and screencasts. While you can start writing and contributing Ensemble formulas today! (ping me if you're interested) More work will go into refining the process and integrating it into the Ensemble command line tools.

That's mostly it. It is an incredibly interesting time for cloud technologies! Diving into discussions with the Ensemble team about the vision and decisions they have taken, I was blown away. I firmly believe Ensemble is a game changer with respect to rapid provisioning and orchestration. Right now, is such a great time to get involved with Ensemble. If you're interested in joining the Ensemble project, or in learning more about it in any way, please do leave me a comment here, or ping me on irc (kim0)

Wednesday, May 11, 2011

Cloud Portal one-click launch

Announcing two nice little additions to the cloud portal AMI tool that should make everyone's cloud life a little easier

  • Amazon now allows passing parameters to the AWS console to basically be able to choose the region and AMI-ID to launch. This is now integrated in the cloud portal so that you search for the ami, click the link and it's pre-selected, ready to be launched in AWS console. Here's a screenshot


  • As that image shows as well, you can search now for "cluster" to get Ubuntu cloud cluster-ready images!
Interested to add any features? Have any thoughts or comments, let me know, leave me a word

Monday, April 18, 2011

Help Squash Natty Server Bugs

Mirroring a post from Ubuntu Server developer Dave Walker, If you're capable and willing to help squash some server bugs, your effort and contribution is really needed now! Join us on irc #ubuntu-server, ask around if you need help. Thanks in advance

Here is a list of current bugs that should hopefully be fixed for Natty release.  The bugs with "Not assigned to anyone :(", could really do  with someone volunteering to take.  Please feel free to assign yourself, if you are willing to take on working towards a fix. 

If you are an assignee, please make sure that the current status (and comments) accurately represent the status before tomorrows server team meeting. 

== Bugs for the server team == 
[655533] [likewise-open] [master] package likewise-open failed to install/upgrade: subprocess installed post-installation script returned error exit status 1 (
 * Bug Status: Confirmed 
 * Not assigned to anyone :( 
 * Last updated: 2011-04-18 
[726769] [eucalyptus] package eucalyptus-common 2.0.1 bzr1255-0ubuntu1 failed to install/upgrade: subprocess installed post-installation script returned error exit status 1 (
 * Bug Status: Confirmed 
 * Assigned to: Dave Walker 
 * Last updated: 2011-04-18 
[661453] [dovecot] dovecot.conf always shows as having been locally modified on update (
 * Bug Status: Confirmed 
 * Assigned to: Clint Byrum 
 * Last updated: 2011-04-18 
[745946] [cloud-init] cloud-final job did not run in ec2-automated-tests (
 * Bug Status: Confirmed 
 * Not assigned to anyone :( 
 * Last updated: 2011-04-18 
[759943] [mod-wsgi] gives errors (
 * Bug Status: Confirmed 
 * Not assigned to anyone :( 
 * Last updated: 2011-04-15 
[764391] [cobbler] cobbler fails to manage bind9  (
 * Bug Status: Confirmed 
 * Assigned to: James Page 
 * Last updated: 2011-04-18 
[745930] [cloud-init] cloud-init timeout waiting for metadata service on EC2 (
 * Bug Status: New 
 * Not assigned to anyone :( 
 * Last updated: 2011-04-15 
[760288] [Ubuntu] JeOS is oversized (
 * Bug Status: Confirmed 
 * Not assigned to anyone :( 
 * Last updated: 2011-04-15 

 == Bugs being worked on in other areas, more for information == 
[728088] [debian-installer] iscsi root with or without auth fails to boot (
 * Bug Status: Confirmed 
 * Assigned to: Colin Watson 
 * Last updated: 2011-04-14 
[747090] [linux] wrong return address sometimes pushed for INT in kvm (not qemu) (
 * Bug Status: Fix Committed 
 * Assigned to: Andy Whitcroft 
 * Last updated: 2011-04-18 
[566818] [plymouth] Cryptsetup passphrase prompt during boot: every character typed repeats the prompt (
 * Bug Status: Confirmed 
 * Assigned to: Surbhi Palande 
 * Last updated: 2011-04-16 
[580319] [upstart] dhcp3-server launches before upstart brings all interface, thus failing to start (
 * Bug Status: Triaged 
 * Assigned to: James Hunt 
 * Last updated: 2011-04-18 
[759545] [grub2] user prompted to update unmodified grub configuration during Ubuntu server upgrade (
 * Bug Status: New 
 * Last updated: 2011-04-18 

Friday, April 15, 2011

Cloud Portal Intro

Just written a nice introduction to Ubuntu cloud portal on Ubuntu News. If you don't know about that, or are new to the Ubuntu cloud scene, check it out and ping me back for any questions or comments

Thursday, April 14, 2011

Ensemble Cloud Community Meeting Summary

Yesterday was the first Ubuntu Cloud community meeting to include Ensemble. It was such a blast. Personally I find the ensemble project to be incredibly cool, it's such a paradigm shift into how services (rather than servers) should be managed especially in this cloud age. Here's a quick summary of the main points mentioned during yesterday's meeting

  • The ensemble-team just landed some changes to formula authorship, specifically the relation-changed-hook was broken out into three separate hooks the relation-joined, relation-changed, relation-departed
    • joined denotes that a unit of the related service came online
    • changed denotes the unit of a related service changed its settings
    • departed denotes the unit of a related service went offline
  • This hook split is helpful to avoid subtle race conditions, and make formula authorship easier
  • Ensemble team is now working on formula upgrades
    • For now the team is only tackling an initial step of upgrading just the formula itself and only if it's already running
    • Example command would be: ensemble upgrade-formula --repository=examples mydbservice
    • That will look into the repo directory for a formula matching the formula of myblog, verify its a newer revision, upload and it mark the units for upgrade
    • On the unit side, they'll detect they need upgrades, download the formula, and most importantly, execute the upgrade-hook from the new formula
    • A suggestion came up, that the upgrade hook would be informed which version the upgrade process is starting from
  • A Question comes up, whether hooks should be implemented in a specific language. The answer is that all hooks are effectively just executables, those executables can be in any language and use any tools they'd like
  • Ensemble team is also working on orchestrating around firewall addressing such that the firewall is configurable by the ensemble user (ensemble expose, ensemble unexpose), with corresponding hooks (exposed, unexposed), and hook commands  (open-port, close-port)
    • The draft for that is on
    • expose and unexpose are for now operating on top of ec2 security-groups, in the future however multiple backends can be implemented (cisco firewalls..etc)! Without even needing to change the formula, quite impressive!
  • A question was asked whether ensemble is ready for public collaboration, the answer to which is a definite yes!
    • Grab the code today: bzr branch lp:ensemble
    • Join the mailing list:
    • Join IRC channels #ubuntu-cloud, #ubuntu-ensemble
If you liked this, be sure to join the next meeting (Every Wed, 18:00-UTC in #ubuntu-cloud). Have questions or comment? Leave me a comment right here, or ping me (kim0) on IRC

Tuesday, April 12, 2011

Ensemble Cloud Community Meeting

Ensemble is an exciting new cloud technology innovated by Ubuntu. If you’re curious what it does (I bet you are) it is a service orchestration framework with focus on rapid cloud deployment. That is to say, it allows one to rapidly deploy cloud instances, bootstrap them, install software on them, configure them as well as link them all together to provide you (as a sys-admin or DevOp) with an end-user facing high-level “service” (Load Balanced CMS with sharded Database, Multinode email service installation…etc). Ensemble has been compared to being APT for the cloud! Now does that sound interesting, it sure is if you ask me! Welcome to next generation Linux infrastructure automation.

If that got you interested, be sure to attend the weekly IRC meeting on Wed 18:00-UTC on #ubuntu-cloud
Feel free to tweet/dent and spread this around the globe. Got feedback? Leave me comments on or on my blog

Monday, April 11, 2011

Help Shape

About either months ago, I had started on a fun little project to raise awareness of how widely used Ubuntu Server is around the world. The result was a web tool allowing anyone using Ubuntu Server to "mark" his location on a global map. This was launched with celebrations for 10.04.1, and thousands of cities were marked (woohoo). The project code was open-sourced and lives at

It's been a while since the project was last updated, a few days ago, an Ubuntu community member ( hey Ronnie ) stepped up to re-shape the mapuntu project and relaunch it into an inspiring map that helps anyone record and locate Ubuntu events around the globe! The first part of that effort is creating a proper back-end API, everyone is encouraged to click that link and leave comments. If you are inspired by that project, and would like to help, please get involved! Things you can do to help include

  • Review and enhance the proposed API
  • Help write python code to implement the backend api
  • Write html/css/js for the front-end
  • Play with the code, test it, report bugs, adapt to your own website!

If you want to talk more about this, Please join #ubuntu-locoteams on IRC and ping Ronnie or myself (kim0, also on #ubuntu-cloud).

Friday, April 1, 2011

Creating Customized UEC and EC2 Images

Want to create a customized Ubuntu cloud image that you can deploy to EC2 or UEC ? No problem! Check out this 5 min video where I demo everything needed to download, customize, rebundle and publish the new image to EC2! Isn't this just great :)

If you can't see the embedded player, here's a direct link:

Friday, March 25, 2011

Ubuntu Cloud Days, Day-2 Summary

Yesterday was the second and final day of cloud days. It was such a blast! Very interesting stuff, and very cool community to be part of! In case you missed it, you can still read up the logs, and you can reach me and others for questions and comments on #ubuntu-cloud .. Let's quickly zip through yesterday's sessions

16.00 UTC smoser gave a very good introduction to the different ways with which you can rebundle UEC or EC2 images for Ubuntu, how you can customize them and the different pros and cons. Scott also answered lots of questions
17.00 UTC tetet started by presenting some interesting new features and tricks that can be used with UEC namely persistency, which means kexec'ing the kernel to load from an EBS volume resulting in persistent UEC instances. Thorsten zipped through the session quickly, but as a pro instructor, he was very well prepared with links to graphics, links and documentation
18.00 UTC Daviey wowed the crowd with a puppet introductory session, he showed how to configure apache with puppet and what it takes and deploy a basic system to get running fast. It was a great session
19.00 UTC edulix took over to present an awesome session about using hadoop and its map/reduce programming model to crunch on large (we're talking terabytes) of data on lots of machines. Very interesting and useful session
20.00 UTC obino had the final say on cloud days. The session was about UEC/Eucalyptus. He presented a detailed architecture of the system, what each node does, how things work. He also explained how to get started contributing to the eucalyptus community. 

It was a great event. Big Thank-Yous to everyone who presented in UCD. Till next time o/

Thursday, March 24, 2011

Day-2 Ubuntu Cloud Days

Yesterday was great! It was Ubuntu Cloud Days, the event was packed with very interesting sessions, hundreds of attendees, lots of questions got answered, tons of ideas and comments were made. I personally had lots of fun, and was literally stuck to my keyboard the full time of the event

Let's zip through what happened yesterday (If you missed it, Click the time to read the logs!)
16.00 UTC kim0 (me) took-over, gave a quick introduction about cloud computing, differences between public and private clouds and what the cloud fuss is all about
17.00 UTC semiosis started a great session about building scalable distributed storage on the EC2 Cloud using Glusterfs for improving redundancy, and performance
18.00 UTC SpamapS gave a cool presentation and hands-on demo of a new Ubuntu ground breaking "service" management framework called Ensemble. While in early development phase, it's already working well and is changing how we look at server management
19.00 UTC hallyn took over presenting a technically deep discussion and hands-on demo about LXC Linux containers technology. This is a light weight Linux virtualization (or container) technology
20.00 UTC soren took over to talk about OpenStack, one of the cloud stacks that Ubuntu ships with 11.04 that's been getting lots of cloud people excited lately. Soren explained how the whole thing got started, explained the architecture, answered lots of questions and discussed what we should be seeing in the future

Here's a sneak peak of today's sessions

Thu 24th Mar
16.00 UTC rebundling/re-using Ubuntu’s UEC images — smoser
17.00 UTC UEC persistency — tetet
18.00 UTC Puppet Configuration Management — Daviey
19.00 UTC Using hadoop, divide and conquer — edulix
20.00 UTC UEC/Eucalyptus Private Cloud — obino

Let's get crunching on even more cool sessions today! If you’re new to IRC, you can simply use this web page to join. For more information, check out the wiki page, also feel free to ping “kim0″ on IRC!

Wednesday, March 23, 2011

Today is Ubuntu Cloud Days

Today is .. dum roll ... Ubuntu Cloud Days! The event starts at 4pm UTC on irc #ubuntu-classroom. Updates to the schedule include an OpenStack session, a Eucalyptus session and a puppet session! Those attending the Ensemble session are in for a treat :) During Cloud Days, you’ll learn lots of exciting stuff, you’ll interact with tons of smart people, and you’ll just have fun! Spread the word, join in and bring your friends!

Here’s the sessions schedule
Wed 23rd Mar
16.00 UTC
 Cloud Computing 101, Ask your questions — kim0

17.00 UTC Scaling shared-storage web apps in the cloud with Ubuntu & GlusterFS — semiosis
18.00 UTC What is Ensemble? – Presentation and Demo — SpamapS
19.00 UTC Using Linux Containers in Natty — hallyn
20.00 UTC Open-Stack Introduction — soren

Thu 24th Mar
16.00 UTC rebundling/re-using Ubuntu’s UEC images — smoser
17.00 UTC UEC persistency — tetet
18.00 UTC Puppet Configuration Management — Daviey
19.00 UTC Using hadoop, divide and conquer — edulix
20.00 UTC UEC/Eucalyptus Private Cloud — obino

All session happen in IRC (Freenode) in #ubuntu-classroom. If you’re new to IRC, you can simply use this web page to join. For more information, check out the wiki page, also feel free to ping “kim0″ on IRC
Additional links: