Code Deployment

It has been a while since I posted something, need to become a bit regular at this. Anyway let us talk about deployment. Once you have built your shiny new app it is time to show case it to the world/client. There are several ways to do so. I would like to share how I had been doing it in the past and how I now do it.

The Old Way

Where everyone seems to start, using an FTP client such as FileZilla. This is pretty simple to do, however it gets tedious over time. The biggest drawback for me was the inability to track changes in the code base, so sometimes I would end up FTPing the whole code base again which really sucks and is a great way to introduce bugs. Granted it does have its advantages for quick fixes and the like.

Introducing GIT FTP

After sometime I started using git for version control but still I was FTPing stuff until I came across git-ftp, it is basically a shell script FTP client but unlike the other desktop FTP clients it can track changes to the code base and upload only files that have changed. This made deployment pretty simple, once I had it setup all I had to do after committing changes was $ git ftp push and am done. You can also setup a git-ftp-ignore file which works the same as the .gitignore file. Until recently this was sufficient for me but still I wanted an easier way deploy code automatically once I had pushed it to Bitbucket or GitHub

Enter Deployment Services

In my search I came across dploy.io which is a code deployment service. One simply links a Bitbucket or GitHub repo, configure a server to deploy to and once you push any code it automatically deploys. One can also setup different servers to deploy to, such as a staging server, a production server and so on. There are several such deployment services but I prefer dploy.io for its simplicity and wide array of server setups supported, plus they have a limited free plan which you can use to test the service to see if it suits your needs.

Honorable mention also goes to ftploy.com which works the same as dploy.io but it doesn't have as much flexibility.

I think such tools makes deployment a breeze.

So what deployment methods or tools are you using?

Read this article

exchangerates.co.ke

Problem

During the development of one Market Information System, the client requested to have an ability to have a currency conversion functionality on their web application. The client specifically requested that the exchange rates be sourced from the Central Bank of Kenya. This thus ruled out using many of the free exchange rate providers that currently exist, since none explicitly states that they get their rates from the Central Bank of Kenya. Unfortunately the Central Bank of Kenya website provides no efficient way to download or access the exchange rates as they are just displayed in a table.

Solution

I did a bit of research and found an excellent article written by Jacob Ward on web scrapping with PHP and Curl. Using the examples and logic I was able to build a simple scrapping function that would extract the exchange rates from the Central Bank website. After examining the url structure of the Central Bank I was able to pull data dating back to 2005. I then created a cron job that ran the script everyday updating the exchange rates on the clients database. Problem solved.

Idea

I then realized I could extract data that could be useful to other developers especially those who are dealing with foreign currency where the Kenya Shilling was the base currency. I decided to build a simple JSON API that could be freely accessed and could give developers access to daily and historical exchange rates.

exchangerates.co.ke

This web application was developed using the slim framework which is an awesome micro framework along with RedBean an easy to use ORM. The rates are extracted daily from the Central Bank website and are stored on the application's database.

The API service requires users to register and receive an API key via their email address. The service is rate limited at 1000 requests monthly. The API allows querying of daily and historical rates dating back to 2005. There are currently exchange rates for over 21 currencies and this includes both the buying and selling rates in comparison to the Kenya Shilling. Head over to exchangerates.co.ke to see the usage details. Currently that is all there is to it, in case you have ideas or suggestions to share to improve this service please let me know.

Read this article

Data Generation Tools

Generatedata.com

I am a big fan of generatedata.com ever since I discovered it a few years ago. Amazing work from the developer behind the project. This tool can generate a variety of data types (30+) such as names, emails, phone numbers, alphanumeric data, number ranges, dates and so on. The data can be exported as CSV, Excel, HTML, JSON, SQL among many other export types. This tool will no doubt save you a great deal of time in generating mock data.

Read this article