Thursday Jul 09, 2009

Sailfin in the Amazon EC2 Cloud

Getting Started with SailFin on Amazon EC2

A few SailFin users have inquired about SailFin hosting. I run one out of my garage. It is free but sorry I do not have the additional capacity :-) I had also rented a dedicated server at GoDaddy ($80/mo) to host our demo server. So far it has worked out well and it is quite a reasonable option. There may be other hosting providers there, we do not know about. Do let us know, if you run into anyone.

Sun ISV Engineering guys stepped up to create a rentable ready-to-go Sailfin AMI for Amazon EC2. This is easier to use because it has SailFin and MySQL pre-installed and pre-configured as services. So when the image comes up, you have a running server. All it needs is your service/application. The downside of any cloud image is that everytime you bring it up, it forgets what was configured. So you will have to write some scripts that start up the image and then deploy your application etc. Not a big deal. I will get you started in a moment...

It is always good to know where additional help is, in case you need it. For me, Getting Started document for EC2 & OpenSolaris [1], was all that was needed. I will condense the steps provided there and add some specific details for using SailFin.

  • First, get yourself an account on Amazon EC2, if you have not already done it. EC2 is not free, nor is it super cheap. Be prepared to supply a credit card number for billing. It appears to be reliable. I have not done any performance testing yet.
  • After you sign up you will get a Private Key and a Certificate. You need to save them as separate files with the .pem extension. The location of these two files needs to be set in the environment for the EC2 command line tools to work.
  • The AMI/API command line tools can be downloaded from the following locations:
    After completing the downloads, follow the instructions in the Amazon Getting Started Guide for setting up the tools to make it available or usable. The guide is available from: You will see how to download and configure the EC2 CLI tools in the the early sections of [1].  Here is what I have in my setup:
export EC2_HOME


export EC2_CERT

export EC2_URL

Just how does one fire up an AMI instance?

The AMI  is called: ami-9df312f4. It is SailFin v2, build 20, which has recent bug fixes. This AMI is provisioned with OpenSolaris, SailFin and MySQL all pre-configured.  When you start the AMI, SailFin and MySQL should both have started up as well and ready to use. I suspect when you have your own application on top of it, you will want to automate the deployment of your application also. 

ElasticFox is a very efficient graphical interface for EC2. When beginning, lets use the command line interface, so you get the hang of what is going under the hood. All the commands are in ${EC2_HOME}/bin directory.

  • First, generate a keypair:
ec2-add-keypair mykeypair

This will produce output which you must copy and paste into a file called mykeypair. Save everything between (and including) the "-----BEGIN RSA PRIVATE KEY-----" and "-----END RSA PRIVATE KEY-----" lines. You can generate as many keypairs as you want. You may want to keep one for sailfin usage.

chmod +x mykeypair 

  • Now start up the SailFin 2.0b20 AMI, for example:
ec2-run-instances ami-9df312f4 -k mykeypair
The output should be something like this:

RESERVATION    r-c73171ae    609350199924    default
INSTANCE    i-dfa197b6    ami-9df312f4            pending    mykeypair    0        m1.small    2009-07-09T22:00:03+0000    us-east-1d    aki-6552b60c    ari-6452b60d        monitoring-disabled

  • It does take a while for the instance to fire up. Check status with the instance id reported above:
ec2-describe-instances | grep i-dfa197b6

INSTANCE    i-dfa197b6    ami-9df312f4            pending    mykeypair    0        m1.small    2009-07-09T22:00:03+0000    us-east-1d    aki-6552b60c    ari-6452b60d        monitoring-disabled

Eventually (5 minutes or less) it will enter running state and is usable. You will then see a public DNS address for the active instance:

INSTANCE    i-dfa197b6    ami-9df312f4    ip-10-244-15-112.ec2.internal    running    mykeypair    m1.small    2009-07-09T22:00:03+0000    us-east-1d    aki-6552b60c    ari-6452b60d        monitoring-disabled

You can see the DNS name of the instance in the command output, in this case: Also note the instance identfier, in this case i-dfa197b6.

Opening Ports

The typical SailFin server needs to open some critical ports for traffic and administration. You can authorize ports explicitly. This profile definition is persistent. Here we use the default security profile.

    • ec2-authorize default -p 22 (opens up SSH port. Otherwise, ssh command above would not work)
    • ec2-authorize default -p 8080 (HTTP traffic)
    • ec2-authorize default -p 4848 (Admin Server Port)
    • ec2-authorize default -p 5060 (SIP Traffic).

    • To allow UDP SIP traffic, ec2-authorize default -p 5060 --protocol udp

Explore the running image

To login, you could use the DNS name of the instance in configuring the SIP phones. I used DynDNS service to point a domain to this Amzon instance. The IP address of the instance is encoded in the DNS name. For example,  the external IP Address of is

You can ssh to our instance. Use the DNS name that was reported by ec2-describe-instances (above)

ssh -i mykeypair -l root

Macintosh-202:ec2-api-tools-1.3-36506 Sreeram$ ssh -i mykeypair -l root
The authenticity of host ' (' can't be established.
RSA key fingerprint is 15:3a:03:d1:b9:3e:2d:37:7f:77:41:05:a2:1e:9a:d6.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added ',' (RSA) to the list of known hosts.
Last login: Thu Jul  9 22:47:48 2009 from sca-ea-fw-1.sun

Sun Microsystems Inc.   SunOS 5.11      snv_101b        November 2008

Welcome to an OpenSolaris on Amazon EC2 instance

Use of this OpenSolaris instance is subject to the license terms found at and in /etc/notices/LICENSE.

Users are advised to protect their MySQL database by following guidelines
mentioned within MySQL 5.1 database documentation

Additional software packages from the OpenSolaris Package Repository are
governed by the licenses provided in the individual software packages which can
be viewed using the package manager graphical user interface.

OpenSolaris 2008.11 AMI contains temporary fix for bug id #6787193 and
For details refer to

For important security information, and image usage instructions please review
the files in /root/ec2sun.

For latest updates and late breaking information, please visit the OpenSolaris
on EC2 blog at

Register at to receive latest
news on OpenSolaris AMIs

For technical questions:
You have new mail.
root@ip-10-244-159-143:~# ls
root@ip-10-244-159-143:~# cd ec2sun
root@ip-10-244-159-143:~/ec2sun# ls
DTrace.README  README  mysql.README  sailfin.README  sysbench.README

Be sure to look at the README files once before you start using the instance. You should see an instance of MySQL and SailFin already running. To check the status you can use:
root@ip-10-244-159-143:~/ec2sun# svcs -a | grep -i mysql
online         22:41:31 svc:/application/mysql:default
root@ip-10-244-159-143:~/ec2sun# svcs -a | grep -i domain1
online         22:42:33 svc:/application/SUNWappserver/domain1:default

You can also point your browser to the administration server: http://<DNS-address>:4848 

For your convenience, as database connection pool and JDBC resource has been configured in SailFin. You can see it by going down to explore JDBC Resources in the Admnin console. Ping the Connection pool named mysql and it should be succesful. Now run your usual asadmin scripts that deploy the service to the SailFin.

Stopping the Instance 

    You can terminate the instance as follows:

    ec2-terminate-instances i-<something>

    Using ElasticFox

    ElasticFox and SailFin

    ElasticFox is a a free FireFox plugin that simplifies dealing with the EC2 cloud. You can search for images, start them up, configure and do most of the management. Download details for ElasticFox are at AWS website. Documentation is great, and you will figure it out quite easily.

    Thursday Feb 12, 2009

    Designing scalable, reliable, and efficient systems

    Designing Scalable, reliable and efficient systems is the goal of systems engineering. We see that in the way Google scales their services to billions or the Amazon cloud. But before the internet big boys, this used to be the sole domain of the telecom guys. Well, it still is their domain because there are nearly 4 billion cell phones and god knows how many landline phones in operation. Switches that set up all these calls are quite hard to build.

    Today, Andreas Burmester sent a link to a paper that appeared in Ericsson Review. It describes how they built a full system for delivering continuous services using only open source components. Notable how they depend on Java EE and GlassFish Communications Server in the middleware tier. They used Open SAF and Linux clustering at the lower levels.

    Tuesday Dec 23, 2008

    2008 is over and SailFin is getting ready to leave the station

    My last post was exulting about JSR289 passing the vote way back in July. We have been moving along since then. I thought SailFin would be the first to pass the JSR289 compatibility tests. But Oracle made sure that they already passed the TCK by the time it was made public! And then we found that there were issues in the TCK that needed discussion with the Spec lead. Thanks to Mihir, we got past all of that and had a clean run in November.

    The economic turmoil and U.S presidential election have taken their share of headline news. It has been a less sensational and productive year for SailFin community. Some major accomplishments:

    • Community membership crossed 200, with over 45 with developer status.
    • Found early adopters through the community. Great interest seen from companies building unified communications solutions and conferencing systems for enterprises and SMBs.
    • Ericsson has been a tremendous partner all along. Ericsson Service Development Studio 4.1 is an Eclipse based IDE that includes SailFin by default.
    • IPTV live field trials with GlassFish and SailFin with Sonaecom in Portugal. I am told some more such things are in progress.
    The GA release of SailFin is planned January 2009. As we approach this big date, there will be many more informative blog entries on the performance, unique features, and the team behind SailFin.

    Friday Jun 30, 2006

    JavaOne 2006 Technical Sessions are now online

    What? You could not attend JavaOne in person? Do not despair. All the JavaOne 2006 Technical Sessions are online now for those who missed the live action.

    They have done a fantastic job this year and very quickly too. Thanks to Annette Vernon and Ralph Crawford (the amazing duo behind JavaOne content planning at Sun

    ) All you need is a Sun Developer Network Login account, which is free. Look for Join SDN link at the top.

    The audience feedbacks also came back very quickly this year. We in the Program Committee were very gratified to see the quality ratings climb significantly this year, from last year. Both Core Enterprise and Web Tier crossed the 4.0 average. Since both cover a lot of terrain, crossing the 4.0 quality average barrier was very signficant. The Top 20 awards should be out there soon...

    For us folks at Sun, the conference was largely about expanding focus on Project GlassFish and Java EE 5 launch. If you want to learn about or get invoved in Java EE platform development, GlassFish Talk talk is worth checking out..

    Wednesday Apr 05, 2006

    JavaOne 2006

    I have been away from blogging for a long time now. Been busy travelling on business and getting some projects around Glassfish off the ground. Expect to see me writing a lot more in the coming weeks.

    Well, JavaOne is almost upon us. This year it is in May, not June. I was on the program committee again this year, responsible for co-ordinating content selection on the core enterprise track. KNowing how much work it was last year, this year I was prudent enough to ask my manager for additional help.

    First we were worried that our Call For proposals which was out in December 2005, was too early and we would not get enough enough proposals. Well, it turned out that our fears were quite unnecessary. The number of proposals in Core Enterprise (Java EE) track were about the same as last year. We have nearly 425 proposals just in this track!

    We had a a budget of 28 talk slots in this track. Waded through nearly 350 proposals for technical sessions. You can see how the odds are? 1 in 12 talk prospoals gets accepted. If your proposal got accepted, congratulations. You now know how hard it is.

    Usually we have the same number of BOFs as Technical Sessions, in each track. But a majority of proposals are for Technical Sessions. We look for the richness of topic and abstract and convert some technical session proposals to BOFs. So if you had a TS proposal, but you got a BOF instead think about your abstract and talk flow in your proposal next year.

    For the first time at JavaOne 2005, we passed around pencils and bubble sheets for audience feedback on each talk. We got thousands of feedback entries, audience ratings. They even scanned the scribbled comments at the bottom and got PDF. All this feedback was unprecedented. We learn a lot about what people like and why. We also learned why some speakers did not quite get it right and connect with audience. The feedback has been shared with the speakers confidentially. Based on attendance counts and quality ratings, we were also able to announce the Top 20 talks awards for 2005.

    All in all the feedback is wonderful and very useful. You can expect the same thing to happen again this year. Keep the feedback coming and help us to make the conference better.

    Oh, one other thing. We did a minor clean up of track titles. We now have an abstract track called "Java EE". Web Tier and Core Enterprise are the real tracks. The major tracks are Java SE (Core Platform), Java EE (Enterprise) and Java ME (Mobility), as you have already guessed.

    Tuesday Jan 04, 2005

    Can you hear me now?

    Checking out the first login to Sun's blog roller. Hello World

    Various things I do at Sun Microsystems.


    « April 2014