Chapter 8
Coordinating Deployments

A common story we’ve heard from Elixir newcomers is that deployment was particularly challenging. If you’re going to successfully adopt any new language, you need to be able to get that beautiful, powerful code onto production servers, but that’s not enough. You need to do so reliably, without downtime, and with the ability to gracefully recover should things go wrong.

To illustrate this point, meet Tetiana Dushenkivska. She’s a Ruby developer who adopted Elixir early on and was the keynote speaker at ElixirConf Europe 2017. She mastered Elixir concepts when we had one-tenth of the available learning resources that we do today:

Bruce:

How was your first encounter with Elixir?

Tetiana:

I was happily working with Ruby, when a colleague shared his finding, Elixir. At first, I didn’t get too excited. I was thinking: “Those languages and frameworks keep popping up and I don’t have time right now to learn another language.” Regardless of that thought, I still took a quick look. At first glance it looked much like Ruby, but soon enough I started to understand that maybe it looks like Ruby, but it doesn’t behave like Ruby. The more I read about Elixir, however, the more I wanted to keep learning about it. The first thing to motivate me to start building something in Elixir was the ability to do things concurrently. Then I thought: “Oh, this language looks VERY interesting, I should definitely learn more about it.”

Bruce:

How did you move forward from there?

Tetiana:

Programming Elixir by Dave Thomas was my introduction to Elixir, together with the official getting started guide on the website.

The concept of functional languages resonated quickly with me. When I was studying electronic engineering at university I learned about signals and how they’re transformed from one shape to another. Functional programming is somewhat similar. A signal is like data in functional programming which when put through some filters, or functions in Elixir, results in a new signal. You can’t rebind a signal. You just have an input signal and when it comes out of the black box it’s a new signal. And every time we pass the same input to the black box, we get the same output.

Bruce:

Have you had hiccups or roadblocks along the way? How did you overcome them?

Tetiana:

I would say deployment was hard. There are lots of ways to “build releases” and it took a bit of time to research and find a way that would work for me. Thankfully, the Elixir community is a great place to ask questions. Michał Muskała pointed me in the right direction, which helped me solve the deploying applications challenge.

The Elixir community is doing a great job helping people who are stuck, to solve their problems. I am glad that people who have learned something are happy to share their knowledge, so that everyone else can learn faster.

Tetiana is not alone. For new languages, the deployment story almost always takes time to crystallize. We’ve heard story after story from happy early adopters of many emerging languages identifying deployment as a pain point. The same is true with Elixir.

Even so, we’re starting to see some overarching strategies and contenders begin to surface in the deployment space. In this chapter, you’ll learn about these emerging technologies. Elixir developers are moving beyond the Mix tool for deployment, and they’re formally defining releases using tools such as Distillery. Then, rather than focusing on hot-code-swapping, they’re using a technique called blue-green deployments. We’ll walk you through how these tools and techniques work. That’s what we’ll focus on, but there are a few topics we won’t cover.

In this chapter, we won’t discuss any particular stack. We won’t give you specific recipes for deploying to Heroku or using Docker containers, automating with Chef, or managing your cluster with Kubernetes. In fact, we’ve seen all of those options being successfully used to run Elixir systems. Instead of giving a way-too-thin blow by blow for each option out there or anointing a winner when the market has yet to decide, we’re going to focus on the Elixir bits. After all, this book is called Adopting Elixir. Let’s get to it.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset