Tuesday, November 20, 2012

Its a free world


Disclaimer: I am not a web developer. Although I am a CS grad and understand all the concepts involved and have worked on a few websites in my unversity days and little afterwards, but I am not employed as a webdeveloper and am out of touch with this subject and the technologies and services involved.

Recently, while working on an eCommerce website for a friend, I came across some amazing free services which can really help a start-up reduce its costs. 
The first and most important one is Heroku. Heroku is a no-hassle hosting solution for Ruby, Node.js, Clojure, Java, Python, and Scala. It helps the developers to focus on the most important thing i.e creating the most amazing web app ever and forget about servers. Your application can be up and running in minutes. All you need to do is create an app on their servers and then push your code to it using git. They provide a handy utility to create and manage applications from command line and it can be installed from www.toolbelt.heroku.com. Once you have installed this, all you need to do to make your application live is to run from command line:
heroku apps:create my_amazing_app
git push heroku master
and twalah, your site is up and running at http://my_amazing_app.heroku.com. You can read more about Heroku here

One thing that Heroku lacks is file storage. File system for your app (slug in Heroku's terms) is readonly. So you cant create and write to files on the server. This means that uploading files e.g images wont work. So you will need some cloud storage to store your assets and this is where Amazon Web Services comes in. Amazon S3 is free for you for 1 year. Upon sign-up, new Amazon Web Services customers receive free 5 GB of Amazon S3 standard storage, 20,000 Get Requests, 2,000 Put Requests, and 15GB of data transfer out each month for one year. So you can host your images or other assets on Amazon's servers and stop worrying. More about AWS Free Tier here.

Once your app is ready and running as you want at http://my_amazing_app.heroku.com, the next thing you need is a domain name. Now, there is no way around it. You will need to buy one but you will also need DNS service so that you can point your new domain to your app on Heroku. This is where Zerigo.net comes in. They offer a starter package which is free and gives you 50,000 DNS queries each month, which is more than what I need for now. Its also realy easy to setup Heroku to use Zerigo. All you need is to use Zerigo DNS add on and configure it to redirect www.my-amazing-app.com to http://my_amazing_app.heroku.com. This is easily done using the following commands:
heroku addons:add zerigo_dns:basic
heroku domains:add www.my-amazing-app.com
More on Zerigo add-on here.

The last thing that I needed, and which you may or maynot need, depending upon the web app, is a mail service. For an ecommerce website you need to be able to send emails to your customers. The free mailing functionality is provided by SendGrid.net. They also offer a free/starter package which allows you to send 200 emails per day for free. Similar to Zerigo addon, Heroku provides an addon to enable this functionality. All you need to set it up is the following command:
heroku addons:add sendgrid:starter
Afther that you need to configure your mailer software to use smtp:sendgrid.net and smtp port 587 to send emails. You will also need the login/password for SendGrid.net which you can get from Heroku using command:
heroku config
And thats it. Your app is up and running without paying a dime.
Isnt it amazing? I think it definitely is.