Migrating Rails Application to Another Heroku Region

I recently had to migrate a Rails application hosted on Heroku from US-East to EU-West. Heroku provides some decent documentation on the process here but I ran into a few gotchas and I thought I’d share my experience.

Here’s a little background. In general I use Heroku to deploy most of my web applications. Heroku is a platform as a service (PaaS) provider hosted on Amazon EC2. While I am experimenting with provisioning my own EC2 instances and leveraging Amazon RDS for running a Postgres database, for now Heroku is my primary choice for hosting web applications. Why?

  • I can deploy my apps in seconds with the Heroku CLI.
  • I mostly build Ruby apps and Heroku is optimised for Ruby.
  • My dev-ops commitment is minimised so I can focus on building features.
  • The vast majority of my apps work happily on the free tier.
  • The new dyno types will allow me to implement background processing on the free tier.
  • I may need more control over a hosting environment in the future, but for now, Heroku does me just fine.

So why the need to move AWS region? Well, by default, when you deploy an application to Heroku it automatically assigns it to the US-East region unless you explicitly specify the –region eu flag. I wasn’t concerned about this at first, until it came to integrating S3 file storage. My application users are primarily based in Ireland and the UK so when setting up an S3 bucket I obviously chose EU West so as to minimise latency for my end users. Then it clicked. AWS offer free data transfer out of S3 to EC2 instances within the same region. Heroku runs on EC2. My application does some post processing of images following upload to S3 so there would be some data transfer required. I needed my Heroku deployment to be in EU-West. So here is how I did it.

S3 bucket creation

Creating an S3 bucket

Continue reading

Day 1 @WebSummit

After a night crawling the streets of Dublin with 5000 startup founders, I showed up bright eyed and eager to see what was on offer at the 2014 Dublin Web Summit. And I wasn’t left disappointed. Walking around first thing this morning, watching the many companies and startups putting the final touches to their stands, there was a palpable buzz of excitement and anticipation as 22,000 attendees descended on Dublin’s RDS. And enough free coffee to send the most seasoned caffeine addicts to the moon.

I started off with a ramble around the Enterprise Summit checking out some of the startups exhibiting their wears. While I was just strolling through taking it all in, there was a real friendly vibe and I got chatting to a few groups including Sellsy where I got some cool blue shades you might see on my twitter feed (I know, serious overkill for November in Dublin). If you’re attending in the next few days, the best advice I could give you is, know what you’re looking for. There are literally so many startups and such a maze of stands you can easily get lost or overwhelmed by the masses of people. Plan out your where you want to be, what talks you want to catch and what startups you’re interested in checking out.

So after my early morning browsing I moved to the main stage to check out Paddy Cosgrave’s opening speech. Apparently he had Drew Houston, Phil Libin and a few other big shots at his house last night when his chimney went on fire and an evacuation ensued. I’m not sure how serious it actually was but it was a hell of a story to set the tone for the week. I stayed on after to hear from Brendan Iribe talking about Oculus Rift, John Collison speaking about Stripe and then Phil Libin discussing the next 93 years of Evernote. And hey, the stage was pretty cool too.

Web Summit

Web Summit 2014 about to kick off.

I got my free pass to the summit on the back of applying as a volunteer and saved myself a sweet €1,500. But that’s not where the benefits finished. I had an afternoon shift at the Builders Stage and found myself looking after the speakers in the backstage prep area. I’m not sure if I imagined it to be honest but in the space of 2 hours I got to meet John Scully (ex Apple CEO), Des Traynor (intercom.io), Aditya Agarwal (Dropbox) and John Collison (Stripe). Oh and a quick hello with our own Pat Kenny.

By the end of it all, I was all celeb’d out but I’m excited about Day 2. If you’re attending, come visit me at the Builders Stage in the morning. If you have questions you can tweet me at any stage during the day and I’ll be happy to help. Happy Web Summiting.

Hybrid App Development

So there have been mutterings in the developer world lately that hybrid apps are the way of the future as they offer a faster and more flexible approach to multi-platform mobile app development. Who am I kidding here, they are screaming this from the rooftops.

So what are the different types of apps, you ask? Well currently there is Native, HTML5 and Hybrid. Native is your standard iOS app built with Objective-C/Swift or an Android equivalent built with Java. HTML5 apps are composed of HTML, CSS and JavaScript either served through a browser (i.e. a mobile optimised website) or packaged up and distributed through an app store just like native apps. HTML5 apps don’t have access to any of the native device features such as the camera, accelerometer, flashlight and other features. Hybrid apps on the other hand are quite similar to HTML5 apps but with the added bonus of access to native APIs. This is achieved with the use of either the Cordova or PhoneGap platforms and this is what’s getting people excited.

Native HTML5 and Hybrid Apps

An illustration of the various types of apps and corresponding capabilities.

The rise of Hybrid app development means that developers with experience in common web technologies (HTML, CSS and JavaScript) can now build highly advanced apps for distribution on all major platforms. You no longer need to be a specialist in Objective-C or Java. This is good. It means the cost of building applications will drop significantly, the speed of iteration will increase and developers won’t be forced into specialising in native app development. They can easily juggle building websites and apps of varying capabilities.

So what’s my interest in all of this? Well I recently got involved in building a hybrid app for a client (check out the projects section of my main site). We used Ionic which is a front-end framework built on top of Cordova. All I can say is, I was blown away. I have been thinking of getting up to speed with Swift for some time but having worked with Ionic, I just don’t see the point. Hybrid is the future! In my next post I’m going to talk specifically about Ionic, so stay tuned and hit me up on Twitter for any further discussion.

And so it begins.

I’ve been telling myself for over a year now that I’m going to start a blog. Mainly to discuss my experiences as a programmer but also to give people an insight into some of my life experiences.

Of course, there is always something more important or more urgent.

But at last, here it is! And now that I have everything set up and running smoothly, there is nothing to stop me blogging on a regular basis. At least that’s what I’m telling myself.

Me on the Brooklyn Bridge

Me on the Brooklyn Bridge a few years ago.

So what can you expect to see by following this blog?

Well the past 12 months have been an incredibly dynamic period in my life. I got my Ph.D in Engineering in June 2013 and I suppose having accomplished that it was a matter of figuring out what I wanted to do with my life. While I studied civil and structural engineering at university, I gradually found myself navigating towards computer programming. My undergraduate final-year-project and Ph.D thesis were both heavily dominated by programming but I also began to experiment with web development in PHP in my spare time. Having been working in an engineering consultancy for a few months, it was about twelve months ago that I started to get serious about it. I started to learn Rails thanks to the magnificent Ruby on Rails Tutorial by Michael Hartl and received some great advice from a fellow programmer, David Tuite.

So here I am, twelve months later. I’m now a full-time freelance web developer. I’ve done a lot of work in Rails, jQuery, AngularJS and more. Hell, there’s got to be a good story somewhere in all of that.

Some ideas for my first few posts:

  • My experience with the Ionic Framework.
  • How I became a successful Rails Developer in 12 months.
  • Working with the Vimeo API.
  • Startup School London – Summer 2014.
  • Building Podmedics.
  • Working as a freelance web developer.
  • The future of wind turbines.

And hey, if you think I should write about anything in particular, just drop me a mail or catch up with me on Twitter.

So here it goes!