Why does everything have to be so hard on arm64? Well, maybe not directly hard, but a lot more work. And the reason is simple, we live almost in a amd64 monoculture. Mobile phones are changing that, as is Apple M1, but also arm64 servers.
Update: GlitchTip now publishes arm64 images on docker hub.
I’ve long been using Sentry. Automated bug reporting and collecting is a very useful tool for developers. But Sentry turned its back on open source and I haven’t upgraded my instance since. There are a lot of alternatives, but few of them are open source.
Enter GlitchTip, a Django-based project that implements the Sentry API, so that the Sentry client libraries just work. Not directly a fork, more of a rewrite, but a nice project in any case. I decided to try running it using Docker on an arm64 server.
GlitchTip seemed pretty easy to build from the Dockerfiles. I just cloned the
backend repository and ran
docker build -t glitchtip-backend . and everything seemed to go smoothly. But
when I tried to run the service I got the error:
django.db.utils.OperationalError: SCRAM authentication requires libpq version 10 or above
As you can read from the bug
report, the
problem is psycopg2-binary on arm64. After some discussion and help from the
GlitchTip project members, the solution turns out to be to build the docker
image with psycopg2 instead of psycopg2-binary. But it wasn’t immediately
obvious that the way to do that was: docker build -t glitchtip-backend --build-arg IS_CI=True ..
Then the frontend files had to be included in the image. I modified the frontend dockerfile a bit:
FROM glitchtip-backend:latest
ARG GLITCHTIP_VERSION=local
ENV GLITCHTIP_VERSION ${GLITCHTIP_VERSION}
COPY dist/glitchtip-frontend /code/dist
RUN SECRET_KEY=ci ./manage.py collectstatic --noinput
And built it using docker build -t glitchtip . in the frontend
repository.
Running the images is quite easy using NixOS, and the needed environment variables are mostly well documented:
virtualisation.oci-containers.containers.glitchtip-web = {
image = "glitchtip:latest";
autoStart = true;
environment = {
GLITCHTIP_DOMAIN = "https://${config.networking.hostName}";
SESSION_COOKIE_SECURE = "true";
DEFAULT_FROM_EMAIL = "noreply@${config.networking.hostName}";
EMAIL_URL = "smtp://172.18.0.1:25";
GLITCHTIP_MAX_EVENT_LIFE_DAYS = "366"; # default 90
REDIS_URL = "redis://redis:6379/1";
ENABLE_OPEN_USER_REGISTRATION = "false";
PORT = "8000"; # reverse proxy this
SECRET_KEY = "..."; # strong random
DATABASE_URL = "postgres://user:pass@host:port/dbnam?options";
};
};
virtualisation.oci-containers.containers.glitchtip-worker = {
image = "glitchtip:latest";
autoStart = true;
cmd = [ "./bin/run-celery-with-beat.sh" ];
environment = { ... };
};
Still had to remember to run the database migrations and it was ready to be configured via the web interface.