Ergo: Automated utilities for the daily release workflow

Christos Papidas
Beat Engineering Blog
4 min readJun 20, 2019

--

Backend workflow at Beat reminds that of a highway. Servers run in a high traffic pace to support the multiple processes needed for all our projects. For that reason, we implement an island-based architecture to help us manage the traffic and scale our services according to market needs. Each market for us is a unique, isolated stack. In order to deploy to production, we have to push to a specific branch per market.

For the deployment process, we use continuous delivery and integration tools to run tests and feed code to our live servers. The process is completely automated using GitHub, Kubernetes and Jenkins as CI/CD tools.

Ergo (έργο): greek name for work

Facing the challenge of scaling

Scaling our services to new markets meant that our deployment process was getting longer and longer as the number of branches to push kept increasing. This created the need to automate the steps, in order to make the procedure faster and less error-prone.That’s why we built Ergo.

Ergo: A tool developed by Team Beat

Ergo is a command line application that handles the deployment process by getting the different commits from the development branch and automatically adding them to the release branches.

Ergo pushes the commits to the release branches sequentially, with a customizable interval between them. This serial procedure gives us ample time to monitor the release per market and be able to revert to the previous state, if something occurs.

Ergo is written in Go and is responsible for creating draft releases and deploying them to production. The tool communicates with GitHub, has no local dependencies and can, therefore, run as a standalone application from anywhere.

Ergo in action

Ergo has three main commands:

  1. status, for monitoring multiple branches
  2. draft, for drafting a release
  3. deploy, for deploying a draft release
ergo status --owner githubOwnerName --repo repoName

We use the status command before a release to compare branches from multiple production environments (Peru, Chile, Colombia, Mexico, Argentina, Greece) with our base branch and the staging branch. This is crucial when the above environments are not in sync, due to the imminent release, hotfixes or experiments in a production environment.

Εrgo status command

We start by creating a draft release:

ergo draft --base master --owner githubOwnerName --repo repoName --branches release-mx,release-pe,release-cl,release-co

The draft command will find the different commits, according to the base branch and create a draft release with a new tag, according to Semantic Versioning. After that, we should publish the release, when we are ready to deploy, by running the deploy command.

ergo deploy --releaseInterval 25m --owner githubOwnerName --repo awesomeApp --branches release-mx,release-pe,release-cl,release-co

The command above will deploy awesomeApp in all markets with an interval of 25 minutes. Under the hood, Ergo will push the different commits from the draft release to release-mx, release-pe , release-cl and release-co branches, one after the other.

How to setup Ergo

The installation process of Ergo is really simple.

To communicate with GitHub you will need a personal access token added on the configuration file, as access-token on GitHub.

configuration should be located at $HOME/.ergo.yaml

You must have a configuration file, in order to provide Ergo with:

  1. Your GitHub access token
  2. Default values (for the CLI commands you may skip some of the parameters, in case there are default values set)
  3. Information about the draft release body and what will be updated at the time of the release.

Sample config file: https://github.com/beatlabs/ergo/blob/master/.ergo.yml.dist

Looking into the future

At Beat, we strongly believe in knowledge sharing; that’s why we love open source projects. From the very beginning of Ergo development, we wanted to make it open to everyone, attract more ideas and make it better over time.

We have several ideas for Ergo’s future development, including:

  • An HTTP webhook server which will act as an auto-draft process that will create and edit the draft release the moment you merge a branch to your master
  • Integration with Project Management Tools (Jira)
  • Integration with other git providers (gitlab, plain git)
  • Automated repository creation (very useful in a microservices architecture)
  • CLI integration to create a Pull Request with default reviewers, approve a PR and easily navigate through multiple PRs
  • Integration with messaging platforms, like Slack or Mattermost, for notifications

Our vision is to create a handy tool for the developer’s daily workflow. We aspire to be facilitators, problem-solvers and improve the ways of working, so that we can contribute to better and even more powerful project handling for the backend community.

We love comments, suggestions and -more than anything- Pull Requests! Feel free to contribute to the tool at GitHub. 🙂

GitHub: https://github.com/beatlabs/ergo

Interested in contributing to opensource software projects while building the future of urban mobility? Check out our Engineering job openings.

Christos Papidas is a Senior Backend Developer in the Beat Payments Team. He has experience in distributed systems and programming best practices. A constant learner and passionate Engineer who loves solving complicated problems.

--

--