Lab Notes

Migrating ODK Aggregate from Fargate to Azure Kubernetes Services (part 1)

March 14, 2019

I’m working on deploying an Aggregate 2.0 instance to Kubernetes in the cleanest possible way, and documenting my progress in these lab notes.

I’m beginning to experiment with migrating a ODK Aggregate instance running on Fargate to Azure Kubernetes Service. These next few posts will log my progress.

Note: this is not a how to.” This is a How I did!” - I’ll be writing down all the steps and missteps in posts like this.

The reasons for this migration are multiple:

Running locally

The first step is getting ODK running locally.

I was delighted to learn that in the many years since I touched ODK Aggregate the docs have improved considerably, and there’s even an official Dockerfile in the repo

They are not, yet, however, releasing images on Docker Hub. I’d like to help them out with this, and after I get it running locally I might submit a PR to add Docker publishing to their CircleCI config.

I cloned down the repo and followed the instructions to build the Docker image:

Failure 1

It turns out I didn’t actually follow the instructions, which require I rename the .example config files to not include the .example.

Configuring ODK has always been a giant PITA — it doesn’t natively support environment variables, so the entrypoint script does a lot of weird Bash things to a some special env vars and place them into configuration files — but it’s possible I might be able to simplify that, so while I could rename those files per the instructions, for now I’m going to change that exception to a warning.

Predictably, this also fails:

Failure 2

I learned here that the Docker build script seems to replace all the values in those files anyway, so I’m safe to do something like this, instead.

And since I know that happens, I can go ahead and do this.

This seems fairly hacky though, so I’m going to submit this as a PR and see what the team says.

(Update: it got accepted! Time to tweak the configuration even more.)