
E-tailer Loot Crate provides a monthly subscription-based service of licensed, collectible products primarily related to gaming and pop culture. There’s a Stranger Things crate, a Fallout crate, and more recently a bi-monthly crate of Star Trek collectibles. It’s offering a Call of Duty: WWII crate to coincide with the game’s release for the holidays.
The Los Angeles-based company, which launched in 2012, delivers themed swag to 650,000 subscribers each month as well as original digital and film video productions.
Early this year, it reached an agreement with Major League Baseball to offer Sports Crate, monthly swag related to 10 Major League Baseball teams. With the season starting April 2, however, the company’s development team was under a huge time crunch.
At the same time, Greg Brown, Loot Crate director of DevOps, started exploring the possibility of launching Sports Crate using the Kubernetes container orchestration engine and moving from Heroku to Google Container Engine. He calls Sports Crate a “canary release” on GKE, and since has been pulling the API layer and e-commerce API out of Loot Crate to move as well.
“With Heroku, I felt we had turned the dial as far to the right as we could as far as getting our app to perform at scale,” he said.
“Heroku was great in the beginning when developers just wanted to get their app running on [Heroku’s] Dynos, which is their container service. It’s essentially a front end to Amazon Web Services. So we’re essentially using the AWS platform, but getting that abstraction that Heroku provides for that.
“We wanted to move to something that would scale a lot better for our applications as well as lower the cost of hosting our applications. We feel Google has done an amazing job of making containers easy to set up and use. With a simple G Cloud clusters tree, I can be off and running, and we can focus on just getting our application out there rather than having to go through infrastructure,” Brown said.
Beyond better ability to scale, he outlines in a blog post the goals as it built a completely separate Rails application from scratch: the ability to scale the site as traffic increased, automated zero-downtime deployments, effective secret management and to reap the benefits of Docker images.
He also chose Container Engine for the ability to manage resources using a single Google login and better manage costs.
Adding Jenkins
Part of the switch involved adding continuous deployment with Jenkins. The goal was to be able to deploy an application to GKE with a simple git push command, which was achieved using Jenkins Multibranch Pipelines.
Once a Dockerfile was created, including a rake task to precompile assets and upload them, a Jenkins pipeline was used to build the Docker image, push it to Google Container Registry and deploy Kubernetes.
A Jenkinsfile in the company’s GitHub repo determines which Kubernetes namespace to deploy to — there are three QA environments, a staging environment and production environment.
In a process that takes less than 3 minutes, the Jenkins file checks the code from GitHub, builds the Docker image, pushes the image to Container Registry, runs a Kubernetes job that performs any database migrations and runs tests. It then deploys the updated Docker image to Container Engine and reports the status of the deployment to Slack.
And to make the environment variables more secure, the company uses Kubernetes secret that the applications can easily consume, but which keeps the secrets out of the codebase and off developer laptops.
It was the team’s first project using containers, he said.
“Everyone on the Sports Crate team did a good job of learning how containers work, how to build an app with containers. And our QA/Ops team was able to learn how to deploy an application in Kubernetes,” he said.
Brown reports that GKE met all the requirements, and the project was operational within a month.
The company will be pulling its monolithic Loot Crate app off Heroku and into microservices on GKE, he said.
Loot Crate is not yet using Kubernetes 1.7, Brown said, but he looks forward to implementing the security features, especially the alpha encryption secrets.
“I think it’s cool we’re able to do customer resource definitions if we wanted to extend the API,” he said. “It’s great that you can expand on Kubernetes if you want to. I love the open source capabilities of Kubernetes and that it allows you to hack on it and get whatever you need out of it.”
Sports Crate plans to expand with more teams, player-specific boxes and other sports in the future.
Kubernetes is a technology of the Cloud Native Computing Foundation, a sponsor of The New Stack. Google is a sponsor of The New Stack.
The post Loot Crate Launches a Swag Store on Google Container Engine appeared first on The New Stack.