felixschndr / mealie-bring-api

A simple webserver that allows ingredients sent by mealie to be added to a bring shopping list
7 stars 2 forks source link

no docker image for raspberry pi #3

Open Menthe11 opened 3 months ago

Menthe11 commented 3 months ago

it would be much helpful if there would be an docker image for raspberry pi.

felixschndr commented 3 months ago

I have a lot going on at the moment. In two weeks I will have some time to take a closer look at this and implement a solution. I have not worked with docker images for raspberry and multi arch Dockerfiles but I will figure it out =)

felixschndr commented 2 months ago

Hey @Menthe11

As I see it the docker image currently is not made for your architecture. I guess I have to build an image for ARM. Can you please send me the output of uname -p on your RPI, so I can see which architecture I have to work with.

Menthe11 commented 2 months ago
uname -p
unknown

uname -r
6.6.20+rpt-rpi-v8

uname -m
aarch64

I hope this helps. "uname -p" is unfortunately "unknown".

It's a Raspberry Pi 3.

felixschndr commented 2 months ago

Okay thank you. I guess I will take a closer look at this on the weekend. Since I don't have a pi at hand would you be willing try one or two docker images?

Menthe11 commented 2 months ago

Yeah, of course.

felixschndr commented 2 months ago

Hey @Menthe11, sorry I only now came around to do this. I build an image that should work. Please try to use ghcr.io/felixschndr/mealie-bring-api:3-no-docker-image-for-raspberry-pi-linux-arm and report if it works on your RPi

Menthe11 commented 2 months ago

I can't get the right image downloaded. I don't know if this is something image/repository related or something on my end. I have no experience with the "--platform" switch in docker, because on all other images i've downloaded it always gets the right architecture automatically.

image

felixschndr commented 2 months ago

You are running the latest release (which is for x64 based systems), however you should run ghcr.io/felixschndr/mealie-bring-api:3-no-docker-image-for-raspberry-pi-linux-arm. Don't use the --platform argument. Run sudo docker run -e ... -p ... ghcr.io/felixschndr/mealie-bring-api:3-no-docker-image-for-raspberry-pi-linux-arm

Menthe11 commented 2 months ago

Oh ok :) Sadly i now get the following error exec /bin/sh: exec format error

felixschndr commented 2 months ago

geeeez, I don't know where this issue comes from. I guess I have to spin up my own pi to debug this.

In the meantime you should be able to run this code without docker or build it yourself (just docker build . in the root directory of the repository).

felixschndr commented 2 months ago

@Menthe11 can please try again with this image ghcr.io/felixschndr/mealie-bring-api:3-no-docker-image-for-raspberry-pi-linux-aarch64?

Menthe11 commented 2 months ago

Same error :(

felixschndr commented 2 months ago

Hmmm, okay. Does

In the meantime you should be able to run this code without docker or build it yourself (just docker build . in the root directory of the repository).

work for you?

L3-N0X commented 2 months ago

Hi, I just started with my installation of mealie and found this repo as I wanted to connect bring as well to my mealie instance. I've made the following changes and the container works on my raspberry pi 5:

And then the container works just fine!

My Dockerfile after the mentioned changes:

FROM python:3.10-bookworm

LABEL org.opencontainers.image.source="https://github.com/felixschndr/mealie-bring-api"
LABEL org.opencontainers.image.description="The container image of the mealie bring api integration (https://github.com/felixschndr/mealie-bring-api)"

WORKDIR /app

EXPOSE 8742/tcp

COPY source/*.py ./
COPY source/requirements.txt ./

RUN pip install -r requirements.txt

CMD python main.py

Thanks for this api connection!

felixschndr commented 2 months ago

@Menthe11 does this work for you as well?

Menthe11 commented 2 months ago

Yes, image is building. Container is starting as well. But i get an authorization error in the logs:

[2024-07-29 16:31:18,180] [BringHandler] [DEBUG] [Bring credentials and list name are set] [2024-07-29 16:31:18,181] [BringHandler] [INFO] [The variable IGNORED_INGREDIENTS is not set. All ingredients will be added. Consider adding something like "Salt,Pepper"] [2024-07-29 16:31:18,181] [BringHandler] [INFO] [Attempting the login into Bring] [2024-07-29 16:31:19,065] [python_bring_api.bring] [DEBUG] [Response from https://api.getbring.com/rest/v2/bringauth: 401] [2024-07-29 16:31:19,068] [python_bring_api.bring] [ERROR] [Exception: Cannot login: email password combination not existing] Traceback (most recent call last): File "/app/main.py", line 61, in <module> bring_handler = BringHandler() File "/app/bring_handler.py", line 23, in __init__ self.bring = self.login_into_bring() File "/app/bring_handler.py", line 44, in login_into_bring bring.login() File "/usr/local/lib/python3.10/site-packages/python_bring_api/bring.py", line 85, in login return asyncio.run(_async()) File "/usr/local/lib/python3.10/asyncio/runners.py", line 44, in run return loop.run_until_complete(main) File "/usr/local/lib/python3.10/asyncio/base_events.py", line 649, in run_until_complete return future.result() File "/usr/local/lib/python3.10/site-packages/python_bring_api/bring.py", line 82, in _async res = await self.loginAsync() File "/usr/local/lib/python3.10/site-packages/python_bring_api/bring.py", line 123, in loginAsync raise BringAuthException('Login failed due to authorization failure, please check your email and password.') python_bring_api.exceptions.BringAuthException: Login failed due to authorization failure, please check your email and password.

[2024-07-29 16:31:19,068] [python_bring_api.bring] [ERROR] [Exception: Cannot login: email password combination not existing]

raise BringAuthException('Login failed due to authorization failure, please check your email and password.')

Email and password works just fine on the homepage of bring.

L3-N0X commented 2 months ago

For me login works just fine! The only thing that comes to my mind are special characters which break your password, for example dollar sign Are you using docker-compose or how do you set the environment variables?

Menthe11 commented 2 months ago

Ok... it works now. I've used an googlemail address with a "+". Apparently the bring API doesn't like that. Changed the email and now it works :)

Thanks @felixschndr and @L3-N0X