Saturday, March 19, 2011

Amazon ELB HTTPS Stickiness

Stickiness is needed in most of the complex applications when scaled up in cloud. Say one user logs in. Now his information should be attached to him. If not, each time, he would be routed to a random instance, which will not identify him. Attaching a session id would provide the stickiness, where a particular user can be forwarded to the particular instance. 

I tried using amazon elb-api commands using terminal to enable stickiness for the elastic load balancer. it gave error when trying to apply the stickiness for the port 443, and works fine for 80.

Create Stickiness Policy
pradeeban@pradeeban:~/pem$ elb-create-app-cookie-stickiness-policy wso2cloud1-as -p my-app-cookie-lb-policy -c jsessionid -K KEY.pem -C CERT.pem
OK-Creating App Stickiness Policy

Setting the Policy to the Listener - Fails for port 443
pradeeban@pradeeban:~/pem$ elb-set-lb-policies-of-listener wso2cloud1-as --lb-port 443 --policy-names my-app-cookie-lb-policy -K KEY.pem -C CERT.pem
elb-set-lb-policies-of-listener: Service error: aws:Client.InvalidConfigurationRequest AWSRequestId:4b2c7fc3-4fbf-11e0-a778-d17858cabec6

Setting the Policy to the Listener - Works for port 80
pradeeban@pradeeban:~/pem$ elb-set-lb-policies-of-listener wso2cloud1-as --lb-port 80 --policy-names my-app-cookie-lb-policy -K KEY.pem -C CERT.pem
OK-Setting Policies

So it seemed, it was an issue with https/stickiness from the amazon's end. It was not giving any error when tried with amazon management console nevertheless, but simply not allowing to enable stickiness for the listener with the tcp protocol.

It works for --lb-port 80 --lb-port 443, but not for --lb-port 443 --lb-port 80 (since it picks the first entry only, it seems).

Tried the same with elb-create-lb-cookie-stickiness-policy (elb controlled stickiness) and the results was same.

So I felt, https/stickiness is not working for both application based or amazon elb based cookies, while it works for http.

But Amazon announced in Oct, 2010 that they have started supporting HTTPS stickiness.

I reported this in AWS forum, but later found that it (Setting stickiness policy) works. What we had to change was the protocol to https from tcp for the port 443. :)

--listener "lb-port=443,instance-port=9443,protocol=https"

HTTPS/Stickiness is fine with Amazon's, but not TCP/Stickiness. The TCP/Stickiness issue has already been discussed in another thread [1] in AWS forums. Hence we resolved the issue, by changing the protocol from TCP to HTTPS for the port 443. However we also noted that aiCache provides web application HTTPS acceleration and stickiness for TCP too.

[1] Service error when setting LB policies of listener
[2] Elastic Load Balancing with Sticky Sessions
[3] Amazon Makes the Cloud Sticky
[4] jmeter + amazon ec2 + load balancing (elb)
[5] How can I force "non-sticky" connections for my ELB? 
[6] Load Balancer (ELB) - port forwarding on the load balancer itself
[7] "Sticky connection" on ELB for https?  
[8] Using ELB to Serve Multiple Domains Over SSL on EC2 for Giggles and Unicorns
[9] Amazon Simple Monthly Calculator

Friday, March 18, 2011

AbiWord and Google Summer of Code - 2011

AbiWord has been accepted as a mentoring organization for Google Summer of Code 2011. It should also be noted that AbiWord has also been a mentoring organization in the Google Summer of Code for the years 2006, 2007, 2008, 2009, and 2010 too, making this time the 6th consecutive year. As a developer/mentor/past-student of AbiWord, I thought of sharing the presentation that I prepared to assist students getting into Google Summer of Code and AbiWord here.

GSoC 2011 AbiWord
Have a look at the project ideas from AbiWord. List of selected mentoring organizations can be found here.

Update: Pls find the latest revised version of this presentation at 

Monday, March 14, 2011

SSI and Google Summer of Code - 2011

This year OMII-UK is applying for the Google Summer of Code as the Software Sustainability Institute (SSI). It should also be noted that many projects including OGSA-DAI, OGSA-DMI, and GRID-SAM are coming under SSI. OMII-UK has seen many successful student projects for the years 2008, 2009 and 2010, and foresees the same for this year, under the new name!

Last year I had my Google Summer of Code with OGSA-DAI (Open Grid Services Architecture - Data Access Integration), a project by The Edinburgh Parallel Computing Centre (EPCC) and National e-Science Centre Established by a consortium of departments from the universities of Edinburgh and Glasgow (NeSC), which is part of OMII-UK, which has currently been evolved into SSI. It should also be noticed that EPCC and Open Grid Services Architecture (OGSA) are also part of Globus Alliance. Globus Alliance has also applied for Google Summer of Code 2011.

Sunday, March 13, 2011

[Archive] Abi the Ant

I was going through the credentials of AbiWord and noticed, it was mentioned as, written by, "Abi the Ant " I found "Abi the Ant" was employed at AbiSource, Inc. as an open source evangelist. I later realized that it was just a character introduced by Eric Sink, the founder of AbiSource, and others, to represent AbiSource in LinuxExpo, other conferences, and elsewhere, similar to the Linux Tux. Abi the Ant was gladly answering the user queries. There were also discussions on making the Ant appear on the welcome splash screen of AbiWord. Anyway, as I see, unfortunately the life time of the Ant was not pretty high like that of the Linux Tux. Almost everyone has dropped the interest in the ant, unfortunately.

Wednesday, March 9, 2011

Building AbiWord 2.9.0 on Ubuntu 10.04 / 64 bit from Source

Short and sweet information on this can be found from AbiWord wiki. This post just deals with a few commonest errors found in building AbiWord, when it goes wrong.

As we are happily moving towards the release of AbiWord-3.0.0, many developers are joining the effort. With the announcement of Google Summer of Code-2011, many students too are interested in joining the project. This guide targets to help anyone to build AbiWord on Ubuntu 10.04/64 bit. This is still applicable to many other linux distributions too, though it is tested on Ubuntu. Unlike the usual building guides, this one is going to follow the worst-path -- assuming every failed cases, for a complete novice.. :)
So, as mentioned in the AbiWord's wiki page, let's start with installing autoconf.
sudo apt-get install autoconf

pradeeban@pradeeban:~/programs/abiword$ sh
Can't exec "libtoolize": No such file or directory at /usr/bin/autoreconf line 189.
Use of uninitialized value in pattern match (m//) at /usr/bin/autoreconf line 189. error: possibly undefined macro: AC_LIBTOOL_WIN32_DLL
      If this token and others are legitimate, please use m4_pattern_allow.
      See the Autoconf documentation. error: possibly undefined macro: AC_PROG_LIBTOOL
autoreconf: /usr/bin/autoconf failed with exit status: 1
Running ./configure --enable-maintainer-mode ...
configure: error: cannot find install-sh,, or shtool in "." "./.." "./../.."
OK. We need libtool installed!

sudo apt-get install libtool


pradeeban@pradeeban:~/programs/abiword$ sh
checking pkg-config is at least version 0.9.0... yes
checking whether gcc understands -Wall... no
checking whether gcc understands -Wextra... no
checking whether gcc understands -Wsign-compare... no
checking whether gcc understands -Wpointer-arith... no
checking whether gcc understands -Wchar-subscripts... no
checking whether gcc understands -Wwrite-strings... no
checking whether gcc understands -Wmissing-noreturn... no
checking whether gcc understands -Wunused... no
checking whether gcc understands -Wpointer-arith... no
checking whether gcc understands -Wshadow... no
checking for libpng... no
checking for libpng14... no
checking for libpng12... no
checking png.h usability... no
checking png.h presence... no
checking for png.h... no
configure: error: `png.h' not found, install libpng or specify CPPFLAGS to include custom locations

As we can see, we will be installing each of the dependencies one by one, if we follow the same steps like this.
But we actually need not to!
pradeeban@pradeeban:~/programs/abiword$ sudo apt-get build-dep abiword
Reading package lists... Done
Building dependency tree      
Reading state information... Done
Note, selecting libwpd8-dev instead of libwpd-dev
Note, selecting libxslt1-dev instead of libxslt-dev
The following NEW packages will be installed:
  build-essential cdbs cvs debhelper diffstat dpkg-dev fakeroot fdupes g++ g++-4.4 gettext html2text intltool intltool-debian libaiksaurus-1.2-0c2a
  libaiksaurus-1.2-data libaiksaurus-1.2-dev libaiksaurusgtk-1.2-0c2a libaiksaurusgtk-1.2-dev libasio-dev libatk1.0-dev libboost-date-time-dev
  libboost-date-time1.40-dev libboost-date-time1.40.0 libboost-dev libboost-regex-dev libboost-regex1.40-dev libboost-regex1.40.0 libboost-serialization1.40-dev
  libboost-serialization1.40.0 libboost1.40-dev libbz2-dev libcairo2-dev libdbus-1-dev libdbus-glib-1-dev libdirectfb-dev libdirectfb-extra libenchant-dev
  libexpat1-dev libfontconfig1-dev libfreetype6-dev libfribidi-dev libgconf2-dev libgcrypt11-dev libgdome2-0 libgdome2-cpp-smart-dev libgdome2-cpp-smart0c2a
  libgdome2-dev libglade2-dev libglib2.0-dev libgnutls-dev libgoffice-0.8-8 libgoffice-0.8-8-common libgoffice-0.8-dev libgpg-error-dev libgsf-1-dev libgtk2.0-dev
  libgtkmathview-dev libgtkmathview0c2a libgucharmap2-dev libice-dev libicu-dev libidl-dev libidn11-dev libjpeg62-dev liblink-grammar4 liblink-grammar4-dev
  libloudmouth1-dev libmail-sendmail-perl libncurses5-dev liborbit2-dev libots-dev libots0 libpango1.0-dev libpixman-1-dev libpng12-dev libpopt-dev libpsiconv-dev
  libpsiconv6 libpthread-stubs0 libpthread-stubs0-dev libreadline-dev libreadline6-dev librsvg2-dev libsm-dev libsoup2.4-dev libssl-dev libstdc++6-4.4-dev
  libsys-hostname-long-perl libsysfs-dev libt1-dev libt1-doc libtasn1-3-dev libwmf-dev libwpd-stream8c2a libwpd8-dev libwpg-dev libwps-dev libwv-1.2-3 libwv-dev
  libx11-dev libxau-dev libxaw7-dev libxcb-render-util0-dev libxcb-render0-dev libxcb1-dev libxcomposite-dev libxcursor-dev libxdamage-dev libxdmcp-dev libxext-dev
  libxfixes-dev libxft-dev libxi-dev libxinerama-dev libxml2-dev libxmu-dev libxmu-headers libxpm-dev libxrandr-dev libxrender-dev libxslt1-dev libxt-dev
  link-grammar-dictionaries-en orbit2 po-debconf quilt x11proto-composite-dev x11proto-core-dev x11proto-damage-dev x11proto-fixes-dev x11proto-input-dev
  x11proto-kb-dev x11proto-randr-dev x11proto-render-dev x11proto-xext-dev x11proto-xinerama-dev xtrans-dev xz-utils zlib1g-dev
0 upgraded, 140 newly installed, 0 to remove and 3 not upgraded.
Need to get 60.4MB of archives.
After this operation, 269MB of additional disk space will be used.
Do you want to continue [Y/n]? Y
Now again,
pradeeban@pradeeban:~/programs/abiword$ sh
checking for libpng... yes
checking for PNG... yes
checking jpeglib.h usability... yes
checking jpeglib.h presence... yes
checking for jpeglib.h... yes
checking for jpeg_read_header in -ljpeg... yes
checking zlib.h usability... yes
checking zlib.h presence... yes
checking for zlib.h... yes
checking for DEPS... yes
checking for GTK214... yes
checking for GSFGI... yes
checking for PLUGIN... yes
checking for OPENDOCUMENT... configure: error: Package requirements ( libgsf-1 >= 1.12 redland >= 1.0.10 rasqal >= 0.9.17 ) were not met:

No package 'redland' found
No package 'rasqal' found

Consider adjusting the PKG_CONFIG_PATH environment variable if you
installed software in a non-standard prefix.

Alternatively, you may set the environment variables OPENDOCUMENT_CFLAGS
and OPENDOCUMENT_LIBS to avoid the need to call pkg-config.
See the pkg-config man page for more details.

Let's fix the redland RDF dependency issue by installing it.
pradeeban@pradeeban:~$ sudo apt-get install librdf0-dev

again, pradeeban@pradeeban:~/programs/abiword$ sh Now it builds fine!
config.status: creating plugins/ots/xp/Makefile
config.status: creating config.h
config.status: config.h is unchanged
config.status: executing depfiles commands
config.status: executing libtool commands

  host                  x86_64-unknown-linux-gnu
  dynamic binary        yes
  static binary         no
  platform              unix (embedded: no)
  toolkit               gtk
  debug                 no

Optional features:
  menubutton            no
  printing              yes
  spell checking        yes
  status bar            yes
  emacs keybinding      yes
  vi keybinding         yes
  clipart               no
  templates             no

Optional dependencies:
  gtk2 > 2.14           yes
  gnome-vfs             no
  gio            yes
  gsf-gio               yes
  goffice               yes

Builtin plugins        
Plugins                 opendocument

Now type `make' to compile.

pradeeban@pradeeban:~/programs/abiword$ make
"make" goes fine too.
Let's "make install" now!
pradeeban@pradeeban:~/programs/abiword$ make install
test -z "/usr/local/share/abiword-2.9/ui" || /bin/mkdir -p "/usr/local/share/abiword-2.9/ui"
/bin/mkdir: cannot create directory `/usr/local/share/abiword-2.9': Permission denied
make[6]: *** [install-uiDATA] Error 1
make[6]: Leaving directory `/home/pradeeban/programs/abiword/src/af/xap/gtk'
make[5]: *** [install-am] Error 2
make[5]: Leaving directory `/home/pradeeban/programs/abiword/src/af/xap/gtk'
make[4]: *** [install-recursive] Error 1
make[4]: Leaving directory `/home/pradeeban/programs/abiword/src/af/xap/gtk'
make[3]: *** [install-recursive] Error 1
make[3]: Leaving directory `/home/pradeeban/programs/abiword/src/af/xap'
make[2]: *** [install-recursive] Error 1
make[2]: Leaving directory `/home/pradeeban/programs/abiword/src/af'
make[1]: *** [install-recursive] Error 1
make[1]: Leaving directory `/home/pradeeban/programs/abiword/src'
make: *** [install-recursive] Error 1

If this permission issue arises, pls change the write permission of usr/local/share, usr/local/bin, usr/local/include, and usr/include/lib. That will make abiword-2.9 ending up in the above directories respectively.
pradeeban@pradeeban:~/programs/abiword$ make install
Now it goes fine indeed!

Now let's just run AbiWord from terminal and see whether it runs!
pradeeban@pradeeban:~$ abiword 
abiword: error while loading shared libraries: cannot open shared object file: No such file or directory

Typical linking issue.
pradeeban@pradeeban:~$cd /lib
pradeeban@pradeeban:/lib$sudo ln -s /usr/local/lib/

Now again,
pradeeban@pradeeban:~$ abiword

YAYYY! AbiWord-2.9.0 is running!!!

you also can debug AbiWord using gdb.
pradeeban@pradeeban:~$ gdb abiword

However, my apologies for posting this lengthy post for a simple task. Just followed the worst case to cover all the student queries regarding building AbiWord-2.9.0 from trunk using Linux on terminal.

Saturday, March 5, 2011

User Interface ~ The face of your application!

What makes us to love some software at first sight? Obviously it is the user interface. But we do ignore the importance of the user interfaces a lot, assuming we are coding for the smart people. But yes, we may be wrong. Not all smart people like to do stuff in hard way. Specially no one likes to waste their time on some one else's ignorance [1] [2]. Hence here comes the need to design and develop sensible interfaces.

What makes a user interface good? Well. Something has been recorded now. We can't change everything or start from the scratch. Every one has started to accept the current model as a standard one. One with a menu bar, standard buttons (we never see buttons in many different shapes. do we?), and the colours too. Again, you should consider the market too. If you are going to market a product to Arab countries, you have to design the interface to suit their RTL (Right to Left) text and their reading pattern too is RTL.

We recently had a mail thread on user interfaces over the mailing list at WSO2, towards making our user interfaces more and more intuitive and user-friendly. Some of the links from the mail thread on the user interfaces are worth sharing here as well. It was also really interesting to note the usage of Checkboxes vs. Radio Buttons. Again, we are programmed to think that way. Trying to change the usage pattern of the Input Controls - like using a check box to do what a button should do normally, will be a loss for the developer, not for the user.

Sun Web Application Guidelines is a good read, specially the chapters on Simple Elements and Visual Design Elements. Web Design References from University of Minnesota Duluth is yet another nice list of materials on usability, describing even the preferences of the children in the user interfaces. Web form design guidelines: an eyetracking study is also worth mentioning. Poorly constructed interfaces ruin the user experience, making the user seeking more assistance from the documents, finally scaring him away from the product altogether! Interesting posts, indeed!

Amazon Autoscaling ~ Issue uploading payload?

We tried to upload a for the autoscaled load balanced system, with the startup-parameters for our Application Server (using the commands given below). There seems to be some issue for the current Amazon Autoscaling API, that prevents us from uploading the user-data-file. We have reported the issue in the AWS forum, and awaiting their reply. :)

Creating a launch config
pradeeban@pradeeban:~/pem$ as-create-launch-config autoscalelcapp --image-id ami-xxxxxxxx --instance-type m1.large --user-data-file /tmp/ --key "keypair" --group "default" -K KEY.pem -C CERT.pem

Updating Auto Scaling Group
pradeeban@pradeeban:~/pem$ as-update-auto-scaling-group autoscleasg1 --availability-zones us-east-1c --launch-configuration autoscalelcas --min-size 1 --max-size 5 -K KEY.pem -C CERT.pem

However we found that, it works when the payload is sent as a string using the param --user-data, instead of --user-data, so we used that to get appserver running, load balanced and auto scaled.

Launch Config
pradeeban@pradeeban:~/pem$ as-create-launch-config autoscalelcas2 --image-id ami-xxxxxxxx --instance-type m1.large --user-data  "AWS_ACCESS_KEY_ID=xxxxxxxxxxxxxxxx,AWS_SECRET_ACCESS_KEY=xxxxxxxxxxx,AMI_ID=ami-xxxxxxxx,,PRODUCT_MODIFICATIONS_PATH_S3=s3://wso2-stratos-conf-1.0.0/appserver/,COMMON_MODIFICATIONS_PATH_S3=s3://wso2-stratos-conf-1.0.0/stratos/,PRODUCT_PATH_S3=s3://wso2-stratos-products-1.0.0,PRODUCT_NAME=wso2stratos-as-1.0.0,,HTTP_PORT=9763,HTTPS_PORT=9443,STARTUP_DELAY=0" -K KEY.pem -C CERT.pem
OK-Created launch config

Since this works, we are happy to proceed passing the payload as a string, instead of sending it as a zip file. Relevant products will be taken from the S3 buckets and run using the script, hence producing the autoscaled appserver instances.