Netflix is known as a place to binge watch television, but behind the scenes, there’s much going on before everyone’s favorite shows can be streamed. There are many tools and techniques the company uses to go from source code to a deployed service that sends shows and movies to more than 75 million global Netflix subscribers.
Some of the engineers at Netflix teamed up to write a blog post that gives developers and Netflix enthusiasts an inside look at what happens before a line of code is deployed to the cloud. This is just one of the many technical posts the Netflix engineering team will release to the public.
(Related: Netflix previews Falcor)
According to Netflix’s blog, Netflix engineers have to do the following things before deploying code to Spinnaker, the Continuous Delivery platform they use:
- Code is built and tested locally using Nebula
- Changes are committed to a central Git repository
- A Jenkins job executes Nebula, which builds, tests and packages the application for deployment
- Builds are “baked” into Amazon Machine Images
- Spinnaker pipelines are used to deploy and promote the code change
Netflix’s culture is based on “freedom and responsibility,” said the Netflix engineers, and it empowers them to figure out which tools are best for each task. Before they accept a tool, they consider the value and determine if it reduces the overall cognitive load for the majority of Netflix engineers. Back in 2008, Netflix began migrating to its streaming service to Amazon Web Services (AWS) as it converted its monolithic, datacenter-based Java application to the cloud.
The first step to deploying an application or service is building. Netflix created Nebula, a set of plug-ins for the Gradle build system, that “help with the heavy-lifting around building applications,” said the engineers.
“Gradle provides first-class support for building, testing and packaging Java applications, which covers the majority of our code. Gradle was chosen because it was easy to write testable plug-ins, while reducing the size of a project’s build file. Nebula extends the robust build automation functionality provided by Gradle with a suite of open-source plug-ins for dependency management, release management, packaging, and much more.”
The team wrote that a future blog post will dive into Nebula and the features they’ve open-sourced.
Once the code has been built and tested locally using Nebula, the team pushes the updated source code to a Git repository. Jenkins is used throughout Netflix for automation tasks, so once a change is committed, a Jenkins job is triggered.
Every deployment at Netflix begins with the creation of an Amazon Machine Image, and to generate them from source, Netflix created what it calls “the Bakery.” It exposes an API that facilitates the creation of AMIs globally, according to the blog.
When it comes time to deploy and after the “baking” is complete, teams will use Spinnaker to manage multi-region deployments, canary releases, and red/black deployments.
“Suffice to say that Spinnaker pipelines provide teams with immense flexibility to control how they deploy code,” said the engineers.
Netflix is continuing to look at the developer experience and determine how it can improve. One challenge it faces is managing binary dependences and addressing the bake time. Netflix said that containers could provide a solution, and the engineering team is looking into how containers can help improve the current build, bake and deploy experience.
In the future, the Netflix engineering team will release updates to address other challenges it faces.