linuxserver / docker-grocy

A container for grocy - the ERP application for your kitchen https://grocy.info
GNU General Public License v3.0
321 stars 44 forks source link

502 Bad Gateway using raspberry pi 3b+ 64bit #53

Closed adrigrillo closed 1 year ago

adrigrillo commented 2 years ago

linuxserver.io


Expected Behavior

Grocy webpage loads and expected, so the user can access to its account.

Current Behavior

When the user tries to connect to Grocy, going to localhost:9283 the browser returns an error 502 Bad Gateway produced by nginx. This error can also be related with https://github.com/hassio-addons/addon-grocy/issues/224 and it seems that it is a problem with the alpine Linux image.

Steps to Reproduce

  1. Install docker and docker compose in the Raspberry Pi 3B+.
  2. Copy the example compose.yml from the README of this repo.
  3. Start the image using docker compose, docker-compose up -d.
  4. Access to Grocy webpage.

Environment

OS: Debian 11 Bullseye CPU architecture: arm64 How docker service was installed:

Using the installation script available in the official docker webpage. Additionally, following this tutorial.

The docker compose was installed using your own tutorial following the recommended first method.

Command used to create docker container (run/create/compose/screenshot)

Using the following compose.yml

version: "2.1"
services:
  grocy:
    image: lscr.io/linuxserver/grocy
    container_name: grocy
    environment:
      - PUID=1000
      - PGID=1000
      - TZ=Europe/London
    volumes:
      - /home/adrigrillo/data/grocy-data-2:/config
    ports:
      - 9283:80
    restart: unless-stopped

and docker-compose up -d

Docker logs


[s6-init] making user provided files available at /var/run/s6/etc...exited 0.
[s6-init] ensuring user provided files have correct perms...exited 0.
[fix-attrs.d] applying ownership & permissions fixes...
[fix-attrs.d] done.
[cont-init.d] executing container initialization scripts...
[cont-init.d] 01-envfile: executing... 
[cont-init.d] 01-envfile: exited 0.
[cont-init.d] 10-adduser: executing... 
-------------------------------------
_         ()
| |  ___   _    __  
| | / __| | |  /  \ 
| | \__ \ | | | () |      
|_| |___/ |_|  \__/
Brought to you by linuxserver.io 
-------------------------------------
To support LSIO projects visit: 
https://www.linuxserver.io/donate/ 
-------------------------------------
GID/UID
-------------------------------------
User uid:    1000 
User gid:    1000 
-------------------------------------   
[cont-init.d] 10-adduser: exited 0.
[cont-init.d] 20-config: executing...
[cont-init.d] 20-config: exited 0. 
[cont-init.d] 30-keygen: executing...
generating self-signed keys in /config/keys, you can replace these with your own keys if required
Generating a RSA private key
....................................................................+++++
....................+++++ 
-----
writing new private key to '/config/keys/cert.key'   
[cont-init.d] 30-keygen: exited 0. 
[cont-init.d] 50-config: executing...
[cont-init.d] 50-config: exited 0. 
[cont-init.d] 90-custom-folders: executing...
[cont-init.d] 90-custom-folders: exited 0. 
[cont-init.d] 99-custom-files: executing...
[custom-init] no custom files found exiting... 
[cont-init.d] 99-custom-files: exited 0. 
[cont-init.d] done.
[services.d] starting services 
[services.d] done. 

However in the NGINX logs we can found:

github-actions[bot] commented 2 years ago

Thanks for opening your first issue here! Be sure to follow the bug or feature issue templates!

adrigrillo commented 2 years ago

I have been testing several images version, as Grocy was working until yesterday. The first image I manage to get it to start properly was the one with the tag v3.1.0-ls116 which is the first that does not use Alpine 3.14 and PHP 8. It is possible that the Alpine and PHP and other dependencies use the latest version available, even the image was published some days ago?

adrigrillo commented 2 years ago

Investigating more, I discovered if I go to the /login page and try to sign in with user admin and password admin, the following error is raised:

imagen

unite42 commented 2 years ago

I have the same problem. Followed the installation instructions for a new installation on a Raspberry Pi 3B+ and got the same errors. Tried to find the reason but didn't find a solution yet.

github-actions[bot] commented 2 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

dersven98 commented 2 years ago

i started an docker container on the latest version today, and i get on all ports (80, 443, 9830) an Bad Gateway the image is not working.

github-actions[bot] commented 2 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

mathmaniac43 commented 2 years ago

This is still not working.

404alex commented 2 years ago

It seems like the docker-compose example is wrong. At least in my test, it is listening on 80 and 443 instead of 9283.

aptalca commented 2 years ago

9283 is the host port that is mapped to 80 inside the container

404alex commented 2 years ago

9283 is the host port that is mapped to 80 inside the container

I wasn't using port mapping. I was using macvlan, so I commented out the port mapping part. And I was not able to access it over 9283, but I was able to over 80 and 443.

aptalca commented 2 years ago

If you didn't use the compose yaml we provided as is, how can you claim it's wrong?

404alex commented 2 years ago

Here is the compose file I was using:

version: "2.1"
services:
  grocy:
    image: lscr.io/linuxserver/grocy
    container_name: grocy
    environment:
      - PUID=1000
      - PGID=1000
      - TZ=America/Toronto
    volumes:
      - grocy_config:/config
    restart: unless-stopped
    network_mode: "macvlan"

volumes:
  grocy_config:
    external: true

I was trying to access through port 9283. But got refused connection. Then I sshed into the docker and run netstat -a:

Active Internet connections (servers and established)
Proto Recv-Q Send-Q Local Address           Foreign Address         State       
tcp        0      0 0.0.0.0:https           0.0.0.0:*               LISTEN      
tcp        0      0 127.0.0.11:37625        0.0.0.0:*               LISTEN      
tcp        0      0 localhost:9000          0.0.0.0:*               LISTEN      
tcp        0      0 0.0.0.0:http            0.0.0.0:*               LISTEN    

It seems like the docker is listening on port 80 and 443. Then I tried to access 80, got the grocy login page.

Therefore, I suspected the port should be 80:80 instead of 9283:80.

aptalca commented 2 years ago

I think you should read up on port mapping: https://docs.docker.com/config/containers/container-networking/

404alex commented 2 years ago

Gotcha, sorry for misunderstood.


From: aptalca @.> Sent: Sunday, April 3, 2022 5:12 PM To: linuxserver/docker-grocy @.> Cc: Alex Chen @.>; Comment @.> Subject: Re: [linuxserver/docker-grocy] 502 Bad Gateway using raspberry pi 3b+ 64bit (Issue #53)

I think you should read up on port mapping: https://docs.docker.com/config/containers/container-networking/

— Reply to this email directly, view it on GitHubhttps://github.com/linuxserver/docker-grocy/issues/53#issuecomment-1086950326, or unsubscribehttps://github.com/notifications/unsubscribe-auth/ADUSAC2WUJCNGPFH4N44UC3VDICTBANCNFSM5IJCLPUQ. You are receiving this because you commented.Message ID: @.***>

franciscobeltran commented 2 years ago

I have tried today to use the docker-compose of the example on my Raspberry Pi 3B+ and it still gives the same error. Bad Gateway 502 appears on both port 80 and 443.

steiditi commented 2 years ago

I have the same issue, but after updating. I tried to update, because my grocy app wanted a newer version of the server. After updating I get 502 Bad Gateway nginx/1.20.2 . Also running on raspberry pi 3b+ with ubuntu 64bit.

steiditi commented 2 years ago

Just to mention it. I took the SD Card and put it into a pi4. Everything works just fine there. No Error anymore.

Krusty27 commented 2 years ago

This still occurs, any workaround?

norweeg commented 2 years ago

oh boy... came here to open this bug, but I see it's been open for a while... It's still broken

techano commented 2 years ago

Just spun this up on a pi 3b+ and still has this issue ongoing. Thought it was my setup for a second!

lghtcrss commented 2 years ago

I have tried today to use the docker-compose of the example on my Raspberry Pi 3B+ and it still gives the same error. Bad Gateway 502 appears.

norweeg commented 2 years ago

It's like the php process doesn't start up or something. It doesn't log a single thing

lghtcrss commented 2 years ago

Unfortunately the latest image with the tag linuxserver/grocy:v3.3.1-ls152@sha256:6e38ea35af9470f33a11966078b2a0c33b8f361cc51a8397135c34521a981f40 produces the same Bad Gateway 502 error.

norweeg commented 2 years ago

according to https://github.com/hassio-addons/addon-grocy/issues/197#issuecomment-879330485 the problem is an upstream problem in alpine's libxml2 package that has since been resolved. When was the last time baseimage-alpine-nginx was built?? This problem would be present in any other images based on that base image. I think if you were to rebuild baseimage-alpine-nginx, then rebuilt all images based on it, including the grocy image, that the problem would be resolved. Other alpine-based grocy builds had the same problem and resolved it by updating their alpine base

norweeg commented 2 years ago

I can confirm that rebuilding the image based off baseimage-alpine-nginx:3.15 resolves this issue. I am able to access the login page without getting a 502 error when running the container on Raspberry Pi 3

norweeg commented 2 years ago

Is this project actively maintained? I get that its a volunteer effort, but this issue has a clear-cut upstream cause with a simple fix with a very small PR that resolves it. over 10 days seems excessive to review such a small PR to resolve an issue that's existed since last year.

Roxedus commented 2 years ago

It is. We currently have our 3.15 nginx base image on hold due to pending rework

norweeg commented 2 years ago

oh good! just glad to hear someone's looking at it. Was worried that the issue would be marked inactive again

github-actions[bot] commented 1 year ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

mathmaniac43 commented 1 year ago

This issue is still relevant, and there is a pending MR to resolve when the maintainers have an opportunity.

norweeg commented 1 year ago

this bug is still present in the latest release because it is still based on the same base image containing the upstream libxml2 bug

github-actions[bot] commented 1 year ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

nemchik commented 1 year ago

https://github.com/linuxserver/docker-grocy/pull/52 (which will rebase this image to our alpine 3.15 image) should be ready to merge. If anyone wants to test lspipepr/grocy:v3.3.1-pkg-e772ab19-pr-52 and leave a comment on #52 confirming if they have any issues that would be helpful.

norweeg commented 1 year ago

I just tested lspipepr/grocy:v3.3.1-pkg-e772ab19-pr-52 on my Pi 3 and all is working

nemchik commented 1 year ago

Closing this now that https://github.com/linuxserver/docker-grocy/pull/52 is merged. There should be a new release shortly.