diericx / bevy

Self hosted software for distibuted video streaming using BitTorrent
74 stars 6 forks source link

exec format error #37

Closed eyal1izhaki closed 3 years ago

eyal1izhaki commented 3 years ago

I tried to run: docker run -it -v $(pwd)/downloads:/downloads -v $(pwd)/internal/app/http/templates:/internal/app/http/templates -v $(pwd)/config.toml:/config.toml -e CONFIG_FILE=/config.toml -p 8080:8080 iceetime/iceetime:latest

but i got this error: docker: Error response from daemon: manifest for iceetime/iceetime:latest not found: manifest unknown: manifest unknown.

So i added the tag 92.18c3978 instead of iceetime/iceetime:latest

Then i got this error: standard_init_linux.go:211: exec user process caused "exec format error"

Machine: Raspberry pi 4 model B OS: ubuntu 20.04 Docker version: 19.03.8 Processor architecture: aarch64

I am very interested in this project, can you help me with that? Thanks a lot!

diericx commented 3 years ago

Thank you for the detailed information! I think this is because at the moment we only build one binary for Linux/amd here: https://github.com/diericx/iceetime/blob/18c39786d1bab619a0ad1610155b3834ec31817f/Makefile#L25

I think a good solution might be to add another build command to the Makefile for the Pi, and then build another Dockerfile. I can try to get that working soon, but might take me a couple days. More than happy to help you try to build a binary for the pi though!

I think the main flags that need to be changed for that build are GOARCH=arm GOARM=5. I'm looking here for that info https://www.thepolyglotdeveloper.com/2017/04/cross-compiling-golang-applications-raspberry-pi/

diericx commented 3 years ago

Small update, was looking this over during lunch and I think it is a Docker issue. Currently trying to set up a pipeline to build Docker images for ARM

diericx commented 3 years ago

Ok here is a link to the images. They now get built on every commit to master, and I fixed that issue you brought up where latest wasn't getting tagged (thanks for bringing that up btw). https://hub.docker.com/repository/docker/iceetime/iceetime/tags?page=1

So you could try with this tag (not sure if Docker will be smart and figure out it needs ARM if it didn't fail earlier before...) iceetime/iceetime:1.b292707 OR specify the ARM image iceetime/iceetime@sha256:dbacd8e031f3d8cca7b491a5fb240691d1dfbbd47a3d0d866fcaf1b227ab3834

eyal1izhaki commented 3 years ago

Thanks! I'll try and update.

diericx commented 3 years ago

!גם... אני ראיתי שאתה מישראל, שלום! אני לומדתי עברית בשביל 2 שנים בבית ספר

eyal1izhaki commented 3 years ago

שלום לך!! You surprised me now :) In which country did you learn hebrew?

eyal1izhaki commented 3 years ago

I'm still getting an error.. /env.sh: line 27: .env: No such file or directory /bin/bash: /server: cannot execute binary file: Exec format error

diericx commented 3 years ago

In the US. I took Hebrew for 2 years at the University of Denver in Colorado. My girlfriend is Israeli, so I was learning to be able to speak to her in Hebrew. Still an ongoing process.. !קשה לדבר על דברים מעניין כש אני רק יודע מלים קטן

Hmm.. that first error was something I just changed, and I think both Docker and the executable need to be in ARM which makes sense... I'll try to test some stuff out in a bit, will probably need to add a new Dockerfile for ARM

diericx commented 3 years ago

Ok this image should have a new binary built for ARM which might fix that issue. https://hub.docker.com/layers/iceetime/iceetime/1.fa328ce/images/sha256-79fcb7f8d4dda5d2888206542d9b82876264dcba9654de84164bd80c52891256?context=repo

So try this:

docker run --entrypoint "/bin/bash" \
iceetime/iceetime@sha256:79fcb7f8d4dda5d2888206542d9b82876264dcba9654de84164bd80c52891256 \
-c "/env.sh /frontend/build/env-config.js && /linux-arm64"
diericx commented 3 years ago

I actually just merged a bunch of cool changes, one of which remove that script. Sorry I can't test myself, don't own a pi 4, but if you don't mind giving it another go it's a much simpler command now! Link to builds on Dockerhub

docker run --entrypoint "/linux-arm64" iceetime/iceetime@sha256:79fcb7f8d4dda5d2888206542d9b82876264dcba9654de84164bd80c52891256
eyal1izhaki commented 3 years ago

I ran the above command and got this:

panic: open : no such file or directory goroutine 1 [running]: main.main() /workspace/cmd/main.go:32 +0x7e0

diericx commented 3 years ago

Perfect! So now that it's finally able to run on the Pi, we just need to add back the volumes it's looking for. I also ran into some issues debugging this locally and made a new build, try this.

It does assume you have a valid config.toml in your current directory and will create /downloads if doesn't exist.

docker run -v $(pwd)/config.toml:/config.toml -v $(pwd)/downloads:/downloads -e CONFIG_FILE=/config.toml iceetime/iceetime:1.48c0a38

Edit: That isn't using the hash-specific image for arm64... might have to get that from docker hub but let's see if it can figure it out on it's own

eyal1izhaki commented 3 years ago

It works, i added the --entrypoint "/linux-arm64" because I got exec foramt error without it. Now i'm getting invalid config error so i need to cofigure it properly.

diericx commented 3 years ago

Ahh right I totally forgot, good catch.

I also updated the Readme and added an example with that flag for running on Pi 4 Model B (which is super cool, thanks for helping with the testing there!!). Let me know if you run into any more issues either here or in a new issue, but I'm going to close this when the PR is merged that successfully adds arm64 support