wimaha / TeslaBleHttpProxy

TeslaBleHttpProxy is a program written in Go that receives HTTP requests and forwards them via Bluetooth to a Tesla vehicle. The program can, for example, be easily used together with evcc.
Apache License 2.0
24 stars 5 forks source link

Add arm docker image for raspberry pi zero #32

Open nriel opened 1 month ago

nriel commented 1 month ago

I can't use the docker image due to wrong architecture

dglaude commented 1 month ago

I think the image is arm64 and on 32 bit arm (armv6?) like PiZero, you would need armhf. Not sure it will run or it is still possible/easy to run docker on a PiZero. It would be more easy on a PiZero 2W that would be able to run the arm64 container.

Maybe the topic could be enhanced a little bit and also have also a docker image that works on x86-64 to run on an Intel NUC or that kind of small size computer.

nriel commented 1 month ago

I see the following error:

 tesla-ble-http-proxy The requested image's platform (linux/arm64) does not match the detected host platform (linux/arm/v6) and no specific platform
 was requested 0.0s 
Attaching to tesla-ble-http-proxy
tesla-ble-http-proxy  | exec /teslaBleHttpProxy: exec format error
tesla-ble-http-proxy exited with code 0

Docker in general works fine, but only with supported images.

In order to get going, I installed the proxy as a go-application and it is running fine. Only thing I can't get to work is to load it as a systemd service on boot. It always complains about the certificate not being found. I already tried to put it into /root/key/*cert, but that does not seem to be the path being searched for. When building, I added the cert to the /key folder and while running with ./TeslaBleHttpProxy it also does start correctly with the certifcates found in the root folder of TeslaBleHttpProxy

**Edit: moving the files from /root/key to /key worked like a charm :) Not the nicest way, but as the path is hard-coded into to go application, I don't see another solution with my limited knowledge.

little-penguin88 commented 1 month ago

I made a start script which changes to the TeslaBleHttpProxy dir and then in there let ./TeslaBleHttpProxy start. so it works with the /key folder in that dir. And then I added that script to a @reboot cron job

nriel commented 1 month ago

Could you please share the script? Thanks!

little-penguin88 commented 1 month ago

Sure. I called it StartTeslaProxy.sh and it has the following content to start the application and is putting the output into a logfile. And it assumes you have TeslaBleHttpProxy dir in your home folder directly. If that is not the case you just need to specify the whole path to your TeslaBleHttpProxy dir to make it work

cd TeslaBleHttpProxy
./TeslaBleHttpProxy > TeslaProxy.log 2>&1 &

You then need to make it executable with

chmod +x StartTeslaProxy.sh

And then add it to crontab with

crontab -e

and in that file just paste @reboot /Home/UserName/StartTeslaProxy.sh

lemocine commented 1 month ago

got the same problem. i cant work around myself since im to dumb to install go and compile myself. is there a possiblity to make the docker container for armv7? only solution for me i got rn is to make a clean new install with 64bit raspberry pi os and start over with my whole setup.

nvm i upgraded my raspberry4 to 64 bit. worth it, needed to be done anyway :)!

ugoetzen commented 1 month ago

Same here. I got an PiZero 2W and cant get it running due to the wrong platform.

wimaha commented 1 month ago

I will try adding this binarys in the docker image. I come back here, when it‘s completed.

wimaha commented 1 month ago

Can you try via wimaha/tesla-ble-http-proxy:dev if it's working?

ugoetzen commented 1 month ago

Just gave it a try on a PiZero 2W:

root@raspible:/home/udo/TeslaBleHttpProxy# docker pull wimaha/tesla-ble-http-proxy:dev
dev: Pulling from wimaha/tesla-ble-http-proxy
be490e8d6aa6: Pull complete 
6be72e41f1a7: Pull complete 
017206a48663: Pull complete 
Digest: sha256:e910b36091c21b4c45b4b972cc143cce58251f028f45c8958f11fedce1cae296
Status: Downloaded newer image for wimaha/tesla-ble-http-proxy:dev
docker.io/wimaha/tesla-ble-http-proxy:dev
root@raspible:/home/udo/TeslaBleHttpProxy# docker compose up
[+] Running 2/1
 ✔ Container tesla-ble-http-proxy                                                                                                                                    Created                                                   0.5s 
 ! tesla-ble-http-proxy The requested image's platform (linux/arm64) does not match the detected host platform (linux/arm/v7) and no specific platform was requested                                                           0.0s 
Attaching to tesla-ble-http-proxy
tesla-ble-http-proxy  | exec /teslaBleHttpProxy: exec format error
tesla-ble-http-proxy exited with code 0

seems the platform is still not the right one.

swa72 commented 1 month ago

I'm a noob myself when it comes to docker, but ...

services:
  tesla-ble-http-proxy:
    image: wimaha/tesla-ble-http-proxy:dev
    container_name: tesla-ble-http-proxy
    volumes:
      - ~/TeslaBleHttpProxy/key:/key
      - /var/run/dbus:/var/run/dbus
    restart: always
    privileged: true
    network_mode: host
    cap_add:
      - NET_ADMIN

that got me going :-) Note the different image name.

ugoetzen commented 1 month ago

Ok, I was just pulling the Dev image, but obviously not calling it within the docker-compose.yml file. The dev image is working for me as well on a PiZero 2W as swa72 described above.

nriel commented 1 month ago

On Raspberry pi zero W still crashing with error 132

wimaha commented 3 weeks ago

Should be working with Version 1.2.2 now. If there are any other errors, please open new issue.

nriel commented 3 weeks ago

With raspberry pi zero w still getting code error 132.

dpkg --print-architecture shows: armhf

lits101 commented 3 weeks ago

With raspberry pi zero w still getting code error 132.

dpkg --print-architecture shows: armhf

I'm also getting error 132 on a Raspberry Pi Zero W.