Skip to content

A repository showcasing using Renovate on an Elixir project

Notifications You must be signed in to change notification settings

sheerlox/elixir_renovate_demo

Repository files navigation

ElixirRenovateDemo

A repository showcasing using Renovate on an Elixir project (here a Phoenix app deployed to Fly.io).

Renovate is a highly-configurable dependency management bot that automates update PRs.

Despite being written in JavaScript, it runs as a GitHub app (there's also self-hosting options), and is able to manage the dependencies for a lot of languages and tools.

Benefits of this particular config

  • Automatically updates the hexpm/elixir Docker base image tag (for Fly)
  • Keeps Elixir/OTP versions in sync between asdf (.tool-versions) and production Docker

Example commits / PRs

How does it work

  1. We use version comments in Dockerfile to tell Renovate where to find the version information for each part of the image (Debian, OTP & Elixir)
  2. We setup a "Test Docker Build" CI workflow that makes sure the image tag composed from those three versions actually exist (so Renovate doesn't auto-merge an inexistant image, if auto-merge is enabled in the first place)
  3. We add the regexManagers:dockerfileVersions preset and a few package rules for the Debian versioning
  4. That's it :)

When merging update PRs for each component, I find it's best to merge them in this order: Debian > OTP > Elixir.

How to replicate this config

  1. Copy .github/renovate.json5 to your .github/ directory
  2. Copy .github/workflows/test-docker-build.yml to your .github/workflows/ directory
  3. Add the version comments and base build stage in Dockerfile
  4. Pick what you want / customize to your liking. You might also want to copy the rules from my base preset directly in your config
  5. Install Renovate to your repository
  6. Profit!

Notes

  • The "Test Docker Build" workflow targets the base build stage to only test base image existence. The rationale behind this choice is to reduce feedback cycles and cost less Action credits (in this repository the full build is only ~1 min, but once your application grows it can increase significantly). If you want to test the full image build, change the target to builder instead.

Get in touch!

If you're interested in automating your Elixir workflows, don't hesitate to reach out, I'll be glad to give a hand!

Learn more