How to reduce the carbon footprint of your tech stack (without Google)

Building an energy-efficient software stack

When we started out building emails.eco, we set out to create a full tech stack on a green web. With the help of the Green Web Foundation, we started from the foundations with a hosting provider. Our other challenge: we didn't want to build on one of the big baddies (Amazon, Google, Microsoft). Firstly, we were shocked to find that hosting suppliers are in short demand!

Success Awaits

We finally found a hosting company in Germany that runs on renewable energy and offers bare metal servers which was a good starting point for us. Building off that offering we could have gone down the route of installing the usual Linux based hosting environment with Docker, Kubernetes and so on but we decided to look at the energy efficiency of that stack and, combined with our needs, we decided to go another path.

FreeBSD and jails

Our stack is pretty simple. We have a bunch of elixir/phoenix apps plus some monitoring so spinning up a complete hosting environment for massive flexibility when we only run on a single physical server looked like a massive waste of resources. We installed FreeBSD and decided to build on top of FreeBSD jails, ZFS and all the other goodness that comes with the base operating system. The massive plus of that approach is that we don’t waste any energy with abstraction layers. FreeBSD jails are a thin permission layer around the FreeBSD kernel that doesn’t burn any CPU cycles for emulation like docker would and, because our setup is rather small, we don’t need the overhead of Kubernetes to add flexibility to a setup that only needs to change within hours not seconds.

Ansible for good old DevOps

To automate the setup we decided to put everything into Ansible as the good old workhorse in the industry. Having our entire setup in one config management system means we can change hosting companies within about an hour if we find one that has better carbon reporting. We can also add hosts in regions we currently under-serve as we add customers there. Finding a suitable hosting company is reduced to the value alignment with us because all we need on the tech side is an IP address to point our config management to. This gives us the flexibility to work with pretty much anyone. If you are interested in how we built that stack then check the blog frequently as we keep releasing snippets of Ansible config, parts of phoenix code, more in-depth reasons for design decisions and so on.

The final result

Ultimately we're now happy to say we not only have a zero-emissions stack, we also have an energy efficient one! We'll be preparing and publishing our carbon report next year.

Lenz Gschwendtner

Lenz Gschwendtner