superfly / litefs

FUSE-based file system for replicating SQLite databases across a cluster of machines
Apache License 2.0
3.78k stars 89 forks source link

Support 32-bit ARM #294

Closed savikko closed 1 year ago

savikko commented 1 year ago

Just wanted to share my experiences running litefs on 32-bit raspbian:

As it is arm7v platform, there are not yet binaries for it. So I had to compile those.

I think I have to mention I have never done anything with Go so this was quite an experiment for me. It might not be wise to run this on 32-bit arch, but here I am.

Build did not succeed first as http.go has this check there:

if len(name) > math.MaxUint32 {
    return fmt.Errorf("database name too long")
}

I think it failed because of architecture, so I brutally just commented that out (and fmt/math imports) and it worked!

Then, Dockerfile needed fuse -> fuse3 change to install the required components.

But, after I got it running my primary litefs had 0.3 version and it seems these are not compatible. So after compiling binaries there from main branch, everything worked!

Now have been running this for few days and I am amazed how well this works.

Thanks for creating litefs!

benbjohnson commented 1 year ago

@savikko That's brave of you to dive into Go! I'm glad to hear it wasn't the most painful. :)

The math.MaxUint32 should be an easy fix. It can just be changed to math.MaxInt32 and I think that should work. The fuse version change is recent because of changes to the underlying FUSE library. I have docs changes that'll go out with v0.4.0 this week.

The main reason I didn't produce 32-bit ARM binaries was because I wasn't sure how many folks would use them. They're pretty easy to make though and I have the GitHub Actions from Litestream that I can reference. I'll see if I can get those binaries produced for v0.4.0.

benbjohnson commented 1 year ago

@savikko I pushed up some changes for ARM:

  1. Docker image includes ARM64 & ARMv7 on major releases only. The multi-arch builds run serially and use QEMU so it's ridiculously slow to build for every PR.

  2. AMD64, ARM64, ARMv7, & ARMv6 builds are available on every PR. Just go the Releases action and go to the bottom of the page and the builds are listed as artifacts. Artifacts are always packaged as zip files so you'll need to unzip & chmod +x on the resulting file.

savikko commented 1 year ago

Thanks, @benbjohnson!

  1. I noticed the same, "ridiculous" is very accurate term here. As these builds are usually used within Dockerfiles (and on "production") this fulfills the need very well.
  2. This is a good bonus!

Anyways, your changes helps my process here as I can now do things more directly.

Thanks again!