apollographql / federation-rs

Contains source code for Apollo Federation's Rust<--> JavaScript interop
Other
35 stars 23 forks source link

Build MUSL binaries as well as `glibc` ones #562

Closed jonathanrainer closed 2 weeks ago

jonathanrainer commented 1 month ago

Seems as though we can build musl binaries if we want too, though it requires compiling V8 at source, this PR is an experiment to see if that's possible.

In terms of testing I've done the following:

  1. Spun up a cimg/base:stable Docker image, installed the right tools and built the binary using the same xtask command as is used in CI - ✅
  2. Installed rover in the same Docker image, moved the built supergraph binary into the .rover/bin directory and run supergraph compose against the retail-supergraph example - ✅
  3. Re-done 1. without the --debug flag to ensure that we can get a release binary ✅

I'm happy to do anymore testing we think is a good idea, because supporting a new binary is a big deal so I want to make sure we're ready if we decide to go ahead.

lrlna commented 1 month ago

Oh man I remember us having conversation about how we could no longer support musl (more specifically Alpine) after introducing JS (and v8) to rover from ...maybe 3 years ago. Is the idea to get this musl binary built in federation-rs directly so we don't have to build v8 from source higher upstream in rover and router?

jonathanrainer commented 1 month ago

Oh man I remember us having conversation about how we could no longer support musl (more specifically Alpine) after introducing JS (and v8) to rover from ...maybe 3 years ago. Is the idea to get this musl binary built in federation-rs directly so we don't have to build v8 from source higher upstream in rover and router?

Pretty much yes, this PR was more about me testing assumptions that we couldn't build musl binaries because of v8 (which you can you just have to compile it yourself). If we do this then we remove one of the bricks in the wall to letting rover support composition under musl binaries.

lrlna commented 1 month ago

If we do this then we remove one of the bricks in the wall to letting rover support composition under musl binaries.

what are the implications to upstream dependencies like rover and router with a change like this?

jonathanrainer commented 1 month ago

If we do this then we remove one of the bricks in the wall to letting rover support composition under musl binaries.

what are the implications to upstream dependencies like rover and router with a change like this?

So in the immeadiate term (i.e. on merging this PR) nothing, it's just another option that's available. rover could then start to offer composition on platforms that didn't previously support it as we'd have a supergraph binary we could use. For router I'm not sure there's any impact at all because all of this only affects the supergraph binary, not Harmonizer and the other parts, at least not that I can see?