Releases for ARM64

Moved from GitHub dgraph/5566

Posted by TiemenSch:

Experience Report

Hi, ARM64 support was already requested and confirmed as a conclusion of #3586, but official releases of Dgraph haven’t been included. It would be awesome if the Docker images of Dgraph would be cross-compiled and included in the manifests so they work on ARM64 out of the box.

What you wanted to do

Run Dgraph on my Raspberry Pi 4 K3s cluster. I believe that the enthousiasts (like me) that want to try out Dgraph might just have an ARM server or cluster at home which requires ARM64 binaries or images.

What you actually did

Currently, I made a pipeline over at Gitlab that compiles to ARM64 and stores a Docker image. That image seems to work on my Raspberry Pi 4’s as a demo cluster. See:

registry.gitlab.com/tiemen/dgraph-aarch64:latest

Why that wasn’t great, with examples

It’s better to have a single “official” source of cross-compiled images in a single manifest. I’m for instance not sure what the compiled binary expects on the system, which is why I don’t know if I can get away with a clean alpine image with the binary dropped in in the long run. (e.g. user rights, folder structure, etc.)

Any external references to support your case

My custom setup uses Docker buildx: Docker Buildx | Docker Documentation
I would be happy to submit a PR that mimics this, but as this influences your release process (and I usually work with Gitlab pipelines) I’m not entirely sure how this should work.

jamesjarvis commented :

+1 this, would be a great (and simple) addition to have multi-arch docker images :grinning_face_with_smiling_eyes:

Edit: Looks like multi-arch compiling would require also modifying the way each of the binaries are compiled, since all releases are built from the same script dgraph/release.sh at master · dgraph-io/dgraph · GitHub

TiemenSch commented :

The most important binary by far is the dgraph one itself, as ratel should be able to run remotely and tap into your database. Compiling ratel was also slightly more tricky in my limited attempt. I think an initial PR for the dgraph binary only would already go a long way!

Really hoping this gets picked up soon, because my custom built pipeline is getting stuck on some peculiar issues.

When ARM64 support has been released, will we see Android and iOS capable of making a Dgraph server? :smiley:

Honestly, that could be one of my big dreams. (So, I don’t have to turn on my computer every time I want to access my Dgraph database.)

Update: I’m also thinking it could be another unique selling point of Dgraph (compared to other database management systems).

1 Like

That seems a bit of a far-fetched use-case to be honest (you would have to design a complete app around this, and somehow maintain a server running on some device that travels throughout the world). Completely different issue, which naturally needs this compilation issue to be completed first ;).

ARM in general is making a good name for itself as far as architectures go and the Go language used to build Dgraph has cross-compilation built in. It does take some effort rewriting the current CI/CD pipelines and optionally finding some ARM hardware for that. Docker buildx may be a short-term alternative to emulate ARM64, too. Also, I wouldn’t mind opening up my three piece RPi4 cluster for some initial CI/CD testing.

Here’s to hoping this gets picked up soon! I think it would be great for enthusiasts to start tinkering on their Raspberries with it.

1 Like

Bumping this issue up as dgraph does is not working on latest t4g instances that AWS has launched with Graviton2 processors based on Arm64. There are other instance types that AWS has launched along with t4g based off Graviton2. This should make enough of a case for this to be fast tracked.

1 Like

It is being worked on :slight_smile:

2 Likes

Very interested in Dgraph on ARM as well.
Is there any timeline of what & when to expect?

A bit of a delay. Recently we decided to focus more on Linux, and given M1 Macs are the only commercially available Arm64 machines (outside Gravitons), there’s gonna be a bit of a delay

Really interested in an ARM binary to use on Graviton instances on AWS. Looking forward for it.

1 Like

Am curious about Graviton myself. We will investigate it in Q3 perhaps.

Note that you can always compile Dgraph yourself. Infact, if you do, let us know how it works on Graviton.

2 Likes

I got it working on arm machine a few months back. Here is a gist if someone wants to try it out themselves. Build DGraph for ARM processor · GitHub

Cannot comment on how it works as it was just a test, nothing production level.

With the latest version of Go, I can happily announce that Dgraph builds and runs. (again, official support is not really there yet, I am speaking on personal capacity)

Yes, I got this to both build with Docker Desktop on a M1 laptop and using crosscompiling on my Linux desktop.

Desktop: Running and Building ARM Docker Containers on x86 | Stereolabs

My dockerfile (grabbed from above):

FROM arm64v8/golang:1.16.5-buster as builder

RUN apt-get update && apt-get install -qy build-essential software-properties-common gcc make sudo

ENV CGO_ENABLED=1 GOOS=linux GOARCH=arm64
RUN go get -u -v google.golang.org/grpc && \
    git clone --depth 1 --branch v21.03.1 https://www.github.com/dgraph-io/dgraph/ && \
    cd dgraph && \
    make dgraph

RUN mkdir -p /dist/bin && \
    mkdir -p /dist/tmp && \
    mv dgraph/dgraph/dgraph /dist/bin/dgraph

FROM arm64v8/debian:buster-slim as dgraph
RUN apt-get update && apt-get install libjemalloc-dev -qy
COPY --from=builder /dist /
ENV PATH=$PATH:/bin/
RUN chmod +x /bin/dgraph
WORKDIR /bin

EXPOSE 5080 6080 7080 8080 8000 9080
COPY --from=builder /go/dgraph/contrib/standalone/run.sh /run.sh
RUN chmod +x /run.sh
CMD ["/run.sh"]

Builds crazy quick on the m1, takes about 2 minutes to build via docker.