Getting Play Framework running on Kubernetes with Google Cloud Platform

Rowan Laurence
Beyond
Published in
2 min readJan 23, 2018

Part one of a series

Recently I’ve been working on a lot of projects on Google Cloud, but really I’ve never (as in me personally, not our company) quite done a whole project fully end to end, designed with Google Cloud in mind. I’ve done a lot with AWS and App Engine, I’ve worked with SPARC servers and Oracle RAC clusters and the old worldly stuff, but containers?

The ask:
We have a pot of money that we are going to donate across three charities, and we want our clients / our staff to choose where it goes.

We need a website to do that.

I LOVE PLAY FRAMEWORK — For me there was not even a question of what I was going to build this in. I adore this framework, if I could use it to butter my toast in the morning I would.

At the last company I worked for (Wowcher / Living Social) in the UK, we used this extensively to split a monolith app into services and leverage features from AWS. We still ran a hybrid cloud system and to be honest, this thing ran like a dream — I didn’t think we could make that any better than we had it, until now.

Quickly the thought came to mind that we didn’t need a full cloud SQL DB / datastore / spanner / etc., — we needed a counter. We don’t need to store anyone’s info, we don’t need analytics, we don’t need IP addresses being logged, we don’t need anything more than a counter.

I chose the following architecture:

  • Play with Ebean
  • Akka HTTP (Play runs natively in this Actor based Web Server)
  • H2 — in memory
  • Kubernetes

This step-by-step guide will go through how to get an app started with Play and how to deploy it to the Cloud.

Topics covered:

  1. Setting up your local machine with Java and SBT ready for Play development
  2. Calling a database from inside Play using Ebean
  3. Asynchronous programming with Akka and Actors, in Play Framework
  4. Putting it all together — Serving a page from Play
  5. Integration testing with Play
  6. Running Docker locally and debugging with intelliJ
  7. Deploying to the cloud using Google Cloud Platform and Kubernetes
  8. Appendix

Next >>Setting up your local machine with Java and SBT ready for Play development

--

--

Rowan Laurence
Beyond
Writer for

Technical Director at Beyond San Francisco — Interested in all things digital, scalable software, collecting shoes and dance music