25 February 2016

From Google AppEngine to Amazon Beanstalk

Since we launched our Icon Cast website we used Google AppEngine. We have decided to go for Google AppEngine because of super simple deployment of Java-based applications and the fact it had a permanent free tier. We estimated relatively low traffic that would always fit into the free tier. The deployment was really as simple as promised.

The free tier was actually enough for most of the time except for our Christmas giveaway when we faced huge traffic and our website was unavailable for a moment*. After we got alert from New Relic we just enabled AppEngine to go beyond free tier and it worked beautifully without issues. So far so good.

* by "a moment" I mean an hour or so :)

During Christmas giveaway we crossed the line of AppEngine's free tier and our users got this message until we filled the billing info

Our Issues with AppEngine

Our website does not use any storage or anything special. It is actually pretty close to a static HTML. The only thing is that we use parts of Icon Cast code to list and render icons. We have also some future plans but that is not for the moment. AppEngine however imposed some limitations. These were not killers but were not super convenient.

We were especially unhappy about:

  • No Java 8 support. We use Java 8 in Icon Cast and in order to use some functionality on our website we had to have modules shared between web and the application in Java 7 which was not convenient.
  • No Servlet 3 support that forced us to use Wicket 6 UI framework while Wicket 7 was already available.
  • Inability to use java.io. Despite we do not access hard drive we use some utility classes such as Path in other contexts. This led us to use custom simple implementations of some classes providing the same functionality.
Most importantly Google does not seem to even care about AppEngine and our trust in their commitment to support their services and keep them up to date is very low. Just check Java 8 discussion or Servlet 3 discussion. It seems that focus of Google moved to Managed VMs that are in beta and we were frankly not willing to give Google another shot.
AppEngine is incredibly easy to use and start with. It has few restrictions that are easy to met. But failure to support Java 8 and Servlet API 3 makes it feel like an abandonware. Maybe it is an abandonware after all. 

Amazon Beanstalk

I believe there is no need to introduce Amazon. We have ignored Amazon services for a long time as AppEngine was OK for us. As AppEngine was feeling more and more like an abandonware and we were looking around and checked services such as Amazon AWS, Heroku or Digital Ocean to name a few.

To be frank a big kick towards Amazon was a blog post about free SSL/TLS certificates on their platform. Mainly because of the price which is actually not as free as it seems because you have to pay Elastic Load balancer which can be roughly $20 per month for low load applications. We do not use load balancer yet though. Secondly we wanted to have a look how easy it is to deploy a web app when configuring SSL/TLS is that easy.

We didn't want to manage OS or a software stack. We basically wanted something Heroku-like. Just on Amazon to take advantage of their other services in the future. As you see on the image below the list of services may look quite intimidating at first.

We will dig through these after Icon Cast 1.5 release - hopefully, maybe
It took quite a while to find out how to best deploy a web application. As we use Apache Maven for building and deploying the best choice we have found is a Maven plugin called Beanstalker. It basically puts a WAR archive to Amazon S3 and then deploys it to Amazon Beanstalk. You can easily pick what software stack to use - in our case Tomcat 8 with Java 8.

Just an hour after having our website running on Amazon Beanstalk we have migrated it to Java 8 and Wicket 7. Java 8 was just about changing build configuration in Maven. Wicket 7 was slightly trickier but it was just about going to the Wicket 7 migration guide, search for every build error we got in the guide and replacing the uncompilable code according to the guide. Roughly 50 to 100 individual straightforward fixes each taking few seconds. Then just running few tests and voilá.

Domain Transfer

When Amazon Beanstalk was that easy our appetite grew. So we also decided to move the domain registration and DNS to Amazon. We used a local Czech service FORPSI. We have moved the domain just because we wanted to have management of the web stuff on one place and simplify setup of domains, DNS, redirects and similar.

The funny part was that during DNS setup we forgot to add MX records to redirect emails. We continued setup of other things that required email confirmation. Then we spend quite a while wondering why the confirmations are not coming to our inbox.

We also had to setup the naked domain redirection via Amazon S3 and few other details. It took quite some googling here and there to setup everything. At least everything we though of.
Moving from Google AppEngine to Amazon Beanstalk took roughly 4 hours including DNS changes and including being lost in all the Amazon services and preferences.

Conclusion

Moving to Amazon Beanstalk was super easy. When you have a web app that you just need to run Beanstalk is one of the easiest way to go. Amazon also offers first year for free on small instances so there is very little you have to invest at the beginning. We will see how happy with Amazon we will be after using it for a while and especially after we will check the billing section in a month or so.

We use New Relic for our website monitoring and it has not noticed any downtime during the switch from AppEngine to Beanstalk. So we can mark that as a success as well.

After Icon Cast 1.5 release we will have a bit more time to update our website a little. And also deep a bit deeper into what all Amazon has to offer.

Useful Links

You could just google them or find in the article above, just in case:




No comments:

Post a Comment