Our Perspective On the Latest Trends in Technology Solutions and Services

also visit us at bluefinassociates.com

Sunday, February 13, 2011

How to deploy Ruby on Rails Application on Amazon EC2

Hello guys,

I am using Ubuntu 10.04, Rails 2.3.8 and Ruby 1.8.7. I want to deploy my rails application on Amazon EC2. But before that we have to create instance on Amazon and configure it. So I will show you how to do this.

First of all I am not using ec2onrails gem because it isn’t maintained regularly and supports old AMI . Then I assume that you are somewhat familiar with Amazon terms and you have account there. If not then please do it first.

After creating account and undestanding Amazon terms you need to have following things which you can find from Security Credentials tab from Here.

1) Amazon Account Number
2) Access Key ID
3) Secret Acsess Key
4) Amazon x.509 Certificate
5) Private Key Certificate

Now download developer tools from Here and then extract it and put it in some folder.

I put certificates and developer tools in /home/pulkit/cert folder.

now install Java if you don’t have.

So after downloading all necessary things, let’s start for setup.

# Set Java Path
1) export JAVA_HOME=/usr/lib/jvm/java-6-openjdk/
2) export PATH=$PATH:$JAVA_HOME/bin

# Set Private Key
3) export EC2_PRIVATE_KEY=/home/pulkit/cert/pk-PUL4MOWVQI4IOOKRV3BRJC2MHXJ2KKIO.pem

# Set Certificate
4) export EC2_CERT=/home/pulkit/cert/cert-PUL4MOWVQI4IOOKRV3BRJC2MHXJ2KKIO.pem

# Set api-tools
5) export EC2_HOME=/home/pulkit/cert/ec2-api-tools-1.3-62308
6) export PATH=$EC2_HOME/bin:$PATH

# add keypair to Amazon
# Save it in /home/pulkit/.ssh folder with name “id_rsa-rails-keypair”
7) ec2-add-keypair rails-keypair

# create instance by choosing AMI
# There are lots of AMI available in the market. Choose it as per your requirement. To see list of AMI and it’s details, visit Here.
8 ) ec2-run-instances ami-66e2130f -k rails-keypair

# See details of instance
# change i-9f57h52f3 with your instance id. You will get it when you will run above command.
9) ec2-describe-instances i-9f57h52f3

# Allow Port 22 and 80
# Unfortunately If you will get error
# “Client.InvalidPermission.Duplicate: The permission ’0.0.0.0/0-1-22-22′ has already been authorized on the specified group” for ec2-authorize default -p 22
# OR
# “Client.InvalidPermission.Duplicate: The permission ’0.0.0.0/0-1-80-80′ has already been authorized on the specified group” for ec2-authorize default -p 80
# it means that your ports are already allowed. You can move to next steps.
10) ec2-authorize default -p 22
11) ec2-authorize default -p 80

# If you are using git repository then copy your id_rsa.pub(github key) to Amazon Instance.
# As per your instance, username can be different(root or ubuntu). Make sure that you set name as “authorized_keys2″ not “authorized_keys”. Because ”authorized_keys2″ is already there.
12) scp -i ~/.ssh/id_rsa-rails-keypair ~/.ssh/id_rsa.pub ubuntu@ec2-XX-XX-XXX-XXX.compute-1.amazonaws.com:.ssh/authorized_keys2

# login to Amazon Instance using SSH command.
13) ssh -i /home/pulkit/.ssh/id_rsa-rails-keypair ubuntu@ec2-XX-XX-XXX-XXX.compute-1.amazonaws.com

Now you should be in Amazon Instance. Install all necessary packages and gems as per your requirements.

In next post I will show you how to deploy rails application using capistrano on Amazon Instance.

Thanks & Regards,
Pulkit J. Pancholi

Tuesday, April 27, 2010

Web User Interface Best Practices


When we look at a web page, a uniform style helps maintain a consistent message throughout our visit. Sometimes though, this doesn’t always mean we should experience a consistent UI. What’s the difference? The UI is more than just colors, fonts, link styles, and navigation arrangement. Through best practices, we can standardize – for your own web site – all the elements of your UI for a consistent and user-friendly experience.

CSS is king. I’ve seen many CSS files that act as a dumping ground for every random bit of style – even to the point of duplicating styles. Cleaning up and consolidating your CSS will give you a good view of what you have and what you are missing in your stylesheet. If you have more than one stylesheet, consider combining them into one global stylesheet. It takes less resources to load styles you aren’t using than to load additional stylesheets. Every stylesheet should have the basic elements at the top to redefine the default browser styles based on your UI or Theme. These include the body, links, h1, h2, h3, form, img, div, p, table, and form elements to name a few. I like to start out with zeroing out margin, padding, and border styles followed with defining the body tag. By defining the body style, we set the groundwork for our site. As a rule of thumb, this is where you will set the default font size, font family, font weight, font color, and background color. We then follow this with a definition of the styles intended for all of the other elements we’ll use on your site. Being able to keep a clean and consistent stylesheet will go greatly towards creating a stable UI.

Recycle as a way of life. It may seem monotonous, but one of the keys to a consistent UI is that elements look and act in a similar manner. Forms should be laid out like every other form, tables like every other table, and lists like every other list. When users are presented with a form, they should be given a clear path to submitting the form. Elements of the UI should also be familiar to your users. It’s great to be unique, but users have become accustomed to seeing things, like the footer at the bottom, the header at the top, and identifiable navigation in the obvious and familiar places. If you use widgets and third party functionality, make sure the style fits your UI. Otherwise it will stick out and distract from the flow of your UI.

Tables aren’t dead.
I see a lot of job descriptions for UI Developers requiring tableless web pages. Of course, this means that the general layout of the web page is not contained in one big table. We all remember those days, but fortunately we’ve all learned better. Unfortunately, some developers have taken to trying to reproduce tables in divs. Tables have their uses and should be used when appropriate. Displaying content in tables is clean and easily formatted without the extra effort of cross browser compatibility issues. This isn’t limited to data, but using tables to display forms produces a clean and consistent UI.

Search engines count.
 Are users finding you or are you finding your users? Making your site searchable and easy to understand by text only browsers will increase the relevance of your search placement. If I search for light bulbs and you sell tulip bulbs, you don’t want to focus on bulbs in your keywords and content. Organizing your content using h1 and h2 tags will help a search engine index the content on your site. Think of a word document’s table of contents. By focusing on these header tags, a search engine better understands the different sections of your site and can break them up into primary and secondary content while adding weight accordingly. Researching and understanding how search engines find and index sites will go a long ways toward getting more eyes on your homepage. Having a dynamic sitemap that updates when your site changes will also increase search engine visits.

Posted by Jeremy Bolanos

Monday, April 26, 2010

Supply Chain Systems, The Road Ahead

Supply chain management and execution systems continue evolving to better support ever-changing business drivers. Current supply chain systems primarily focus on:

  • Improving availability and reducing out-of stock situations
  • Reducing overall cost and driving sound financial returns
  • Fulfillment efficiency

Because of global economic trends, energy consumption awareness, increasing customer empowerment, changing customer behavior and several other factors, future supply chain systems will be required to take the following into account:

  • Collaborative approaches for warehousing, transportation and information sharing
  • Built-in intelligence for better inventory tracking, in-store and pipeline availability and fulfillment details, etc
  • Flexible planning at a raw material level to cater to fluctuating customer demand and trends
  • Reduced energy consumption and traffic


When the game changes, so do the rules that measure it. This includes KPIs that measure current supply chain design, for example, inventory availability, fulfillment efficiency and cost reduction; as well as financial KPIs like ROI, gross margin, etc. These will all be augmented with energy consumption, traffic congestion, infrastructure utilization, information and systems utilization, etc. Future supply chain systems will provide clear benefits to society, industries, companies and end consumers who are doing their part to help make the planet a better place to live and thrive.

Posted by: Padman Kurumpanai