yegle / fava-docker

A Dockerfile for beancount-fava
MIT License
94 stars 49 forks source link

Feature Request: Support ARM #7

Closed rlue closed 2 years ago

rlue commented 5 years ago

Just discovered fava, thanks a ton for maintaining this Docker image. Any chance we could get an ARM variant, so that I can run fava on my Raspberry Pi?

I don't know much about writing Docker files, but if you'd like a PR, I can look into it this weekend. (Can't be that hard, right?)

yegle commented 5 years ago

Not really. I chose the distroless as the base image and there's no ARM version for the base image yet. See also: https://github.com/GoogleContainerTools/distroless/issues/377

I would suggest to take a look at https://github.com/beancount/fava/tree/master/contrib/docker. This Docker file does not produce a minimal size image, but it should be easier to make it support ARM.

ngoonee commented 4 years ago

@yegle That docker file doesn't support ARM as-is anyway (at least for fava). Am still looking for a solution, any suggestions? I would guess I could use a buster base and just install fava from pip? Am also trying to get things together for a Pi3 I have lying around, which I think is similar to what you mentioned in the linked question at distroless.

yegle commented 4 years ago

@ngoonee The community wisdom is to use Alpine Linux as base image. You might be able to reuse many of the bits in the Dockerfile.

ngoonee commented 4 years ago

@yegle thanks, have you tried anything along those lines? After I posted the above I tried running fava 'bare' (not dockerised) and found performance to be surprisingly atrocious (not just slow, but close to a minute loading times for pages which normally take less than a second). Unless I can figure out why that happens, dockerising seems like it wouldn't help =(

ngoonee commented 3 years ago

An update on the above - I figured out with yagebu's help what the issue was (cdecimal was abysmally slow, see https://github.com/beancount/fava/issues/1139 ) and the timings have improved tremendously. Now load times are only maybe 5-7 times slower than on a laptop. Still not very useful, but load times of 10 seconds aren't as bad as load times measured in minutes. I've still failed to build off a debian buster base for some reason though =(

fdw commented 3 years ago

Is there any way to help here? I'd love to run Fava on a RasPi.

ngoonee commented 3 years ago

Is there any way to help here? I'd love to run Fava on a RasPi.

Well the advise from yegle is up top. Basically you would need to rebuild off a debian base.

I've given up due to the above-mentioned performance issues. Turns out fava+beancount is a fairly heavy load (though not a consistent one). In the end I'm running it on a salvaged notebook with roughly 20W power draw. Double what my Pi+HDD drew, but much much more capable. Time is money after all.

yegle commented 3 years ago

The recommendation is still use https://github.com/beancount/fava/tree/master/contrib/docker to build an ARM64 version on your RasPi.

fdw commented 2 years ago

I finally had time to play with this, and I was able to build an image for linux/arm64/v8 without any changes. It works quite well on my Pi - a bit slower, but not problematic.

yegle commented 2 years ago

@fdw did you use the Dockerfile in this repo or the one at https://github.com/beancount/fava/tree/master/contrib/docker?

fdw commented 2 years ago

With this one 🙂

fdw commented 2 years ago

As it still works fine on Arm64, do you think you could add official images for that arch?

yegle commented 2 years ago

SGTM.

But I really want to publish a multi-arch image instead of having a separate tag for arm64 version. I'm also considering moving to GitHub Container Registry using GitHub Workflow as it might be challenging to build and push multi-arch image using Docker Hub.

It might take a while to make the switch and add arm64 support.

fdw commented 2 years ago

Both sound good 🙂

I've used docker buildx build... to cross-build for ARM64. From what I can find, that seems to be also work for multi-arch images: https://www.docker.com/blog/multi-arch-build-and-images-the-simple-way/

fdw commented 2 years ago

Have you made any progress here? Anything I can help with?

yegle commented 2 years ago

The work to set up the Github Actions and push to Docker Hub was done.

I have not made any progress on building a multi-arch image.

yegle commented 2 years ago

I'm a bit fuzzy on what architecture is required to run binary on RasPi, but it looks like Distroless only added arm64 support.

docker manifest inspect --verbose gcr.io/distroless/python3-debian10:latest|grep architecture
                                "architecture": "amd64",
                                "architecture": "arm64",

The current published image of yegle/fava:latest should now contain both amd64 and arm64 version.

@rlue @ngoonee @fdw if any of you are still interested please let me know if it works for you.

fdw commented 2 years ago

I'm a bit fuzzy on what architecture is required to run binary on RasPi

You can run it with arm64.

if any of you are still interested please let me know if it works for you.

I've tried it and it seems to work fine. Thank you very much! 🙂

yegle commented 2 years ago

Awesome!