static build releases? #871
Labels
No labels
A: API
A: Backend
A: Federation
A: Front-End
A: I18N
A: Meta
A: Security
Build
C: Bug
C: Discussion
C: Enhancement
C: Feature
Compatibility
Dependency
Design
Documentation
Good first issue
Help welcome
Mobile
Rendering
S: Blocked
S: Duplicate
S: Incomplete
S: Instance specific
S: Invalid
S: Needs Voting/Discussion
S: Ready for review
Suggestion
S: Voted on Loomio
S: Wontfix
No milestone
No project
No assignees
3 participants
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference: Plume/Plume#871
Loading…
Add table
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Hi,
would be nice to have a static build without dependencies.
I'm build on alpine which fails.
Have anyone finished a musl based static build of plume?
I use these scripts to build binaries:
Do they help you though they use a Debian Docker image?
I tried to build it with musl target, but instead I think it still try to use the wrong target?!
Tried Debian base and that builder tool: https://github.com/emk/rust-musl-builder
I'm new with compiling binaries and rust, but I know x86_64-unknown-linux-musl is installed...
What about running blow?
You might have to run
cargo install
under Plume directory. Plume project hasrust-tookchain
file which specifies Rust version.Sorry, not
cargo install
butrustup target install
.rust-toolchain file...
I'll test it again with file
rust-toolchain
removed. Thanks for pointing me to that file...I mean doing
Sorry for my unclear instruction.
If you succeeded to build, it's ok. But if not, I did mean
rust-toolchain
rustup target install ...
rust-toolchain
specifies a Rust version, not a build target. I guess installing musl target under Plume directory which hasrust-tookchain
downloads suitable Rust version for musl target. But I cannot try it because I'm not i front of computer now. Just guessing.Don't understand way the rustup target install should help? It's installed before:
Also tried your last instruction (keep rust-toolchain file, install target), but looks like it still ignores musl?
If a remove the rust-toolchain file it use the expected target / toolchain, but fails later during build.
Ah, more my mistake...
This means:
x86_64-unknown-linux-gnu
) binariesYou're right. I was wrong.
What's about to run?
With
rust-toolchain
file--target x86_64-unknown-linux-musl
will be ignored. With file removed I get an error:hmm... I have no idea. Will try myself later.
Thanks! I think something is wrong with my build...
Static release would be nice and much more portable.
After some errors, finally I finished successfully! The point is to use a Docker image of nightly Rust.
nightly-2020-01-26-openssl11
tag just because it's near to our rust-toolechainnightly-2020-01-15
. More later versions might worksudo apt update -y && sudo apt install -y gettext
cargo build --release --no-default-features --features=postgres --target=x86_64-unknown-linux-musl
I got static build of Plume!
I hope this may help you.
we might wanna update our toolchain file
i am looking forward to being able to just use stable rust once we migrate to rocket 0.5
Yes. I'm looking forward to Rocket 0.5 release.
Compile static
plume
binary works fine!Also a
static
directory was created, which should be needed to for a minimal docker image.I think I need to build the plume-cli binary too?
update
Oh, it isn't static!
Created a Dockerfile, but isn't final. Need to be multistage if static build works fine...
used build-arg
FEATURES=sqlite
According to rust-musl-builder's README, you might not have to install SQLite3 by yourself (although I'm not sure).
Hi,
I don't understand way and haven't the experience to compile plume as static binary. I think I'll just bundle the dependencies with my docker image until that problem could be solved...
Details later...
Used plume Dockerfile with modifications in first stage and a
from scratch
final stage.musl musl-dev musl-tools libsqlite3-dev libssl-dev
)RUN rustup target add x86_64-unknown-linux-musl
--target=x86_64-unknown-linux-musl
static/
and binaries to/out
from scratch
, but for example ca-certificates need to copied from build stage.build-arg
to be flexiblestrip
for both binaries which reduces the binary sizeGreat!
I need to add some dependencies to the final Image and some tests are needed. I'll post a modified dockerfile soon...
Need help to optimize the config part of the entrypoint script and test the stability of the static build.
Final stage misses the dependencies:
Needed / used dependencies alpine based:
Full Dockerfile
entrypoint script
Quick and dirty script to initialize plume...
Tested with sqlite.
Are you interested to modify your Docker image to be static with an (improved) entrypoint script?
Build works fine with sqlite, but fails with
--build-arg FEATURES=postgres
. I think a postgres dependency is missing...Yes, I think it's nice if Docker image size is reduced. Once you think your Dockerfile and starter script is enough well, can you make a pull request? Then I will review in detail again (this does not mean I don't see scripts here. But now I'm seeing them roughly).
I'm new with git and need to take a look how to make a pull request... Just worked in my shell to create the Dockerfile and entrypoint script. But I'll take a look.
Before I create a PR I'd try to fix the problem with the postgres version. Any idea about the cause of that error for postgres version (
FEATURE=postgres
) compared to the successfully finished sqlite version (FEATURE=sqlite
)?openssl should also be needed for sqlite I think? So it should be related to a postgres dependency?
sqlite compiles without errors. Static sqlite image:
It seems to be related to openssl / diesel / postgres.
Take a look here:
Tried to add openssl-probe as described here https://crates.io/crates/openssl-probe in main.rs and Cargo.toml.
Compiled with the same error and found
plume-models/src/lib.rs
and also added it there before diesel and to Cargo.toml.Also (re-)installed ca-certificates and ssl-cert just to be sure... but postgres still fails to compile. So only sqlite runs statically for now!
Additional to the postgres compile error there is a frontend error message in web developer tools... Don't know if I'm able to fix the two problems myself...
#887 (comment)