Upgrading an Elixir application with edeliver

Previously, we talked about Deploying an Elixir application with edeliver but we just make the release of one feature. So, what happen when you need to release another? How supposed to be deployed?

Well, with our previous setup that deploy will be easy. Why? That’s because erlang/elixir have the ability to do, what they call HOT DEPLOY. With distillery and edeliver included, that will be simple. But, what does it mean HOT DEPLOY?

In a nutshell a HOT DEPLOY is the ability to release a new version of the system without restarting the whole application. Is like fuel filling of an aircraft in air. And for that we are going to fetch the new changes of our system.

This new change is in the tag new_feature placed in github. This version will show the time that tooks for an issue to be finished, for this we are going to take the difference between the first commit and the last commit.

Final Version
Final Version

So, the first thing we are going to do is fetch the new changes and check if everything is OK. After that, the next step is create our binary upgrade. And for that we need to prepare our new version, i.e. modify version in mix.exs

Modify version
Modify version

With that in place we just need to create a new tag called v0.0.2 and then, build our binary upgrade as follows:

Now we check that our system is running with a ping:

❯ mix edeliver ping staging
EDELIVER ISSUE_TIMER WITH PING COMMAND

-----> pinging staging servers

staging node:

user : vagrant
host : 192.168.60.8
path : /home/vagrant/releases
response: pong

PING DONE!

And now we just deploy our new version as follows:

Finally we check that the 0.0.2 version is running on our server:

And that’s all! Now we can check it in the browser and we will see as follows

New Release
New Release

Final Thoughts

Through the past four posts (1, 2, 3, including this one) we have discovered how we can build and deliver an aplication.

But, this is one of many ways to do it. At this time, there are many options to build and deliver this type of system, for example you could use the tools that gitlab or heroku provides you or just keep it simple using an approach with Ansible Chapter 9 — Deployments with Ansible.

The election is up to you, and it will depend on the type of project that you are in.

I hope you can find it interesting and helpful. If you have any comments or any doubts please let me know in the section below.

See you next time. Good luck and have fun!

Show your support

Clapping shows how much you appreciated Felipe Juárez’s story.