redimp / otterwiki

A minimalistic wiki powered by python, markdown and git.
https://otterwiki.com
MIT License
202 stars 22 forks source link

Install with docker compose results in error "502 Bad Gateway" #97

Closed tanrak closed 4 months ago

tanrak commented 4 months ago

Hi, i would like to test this promising tool. But the installation with docker compose on my arm64 device results in an nginx error "502 Bad Gateway".

redimp commented 4 months ago

Hey @tanrak, please provide some additional information.

For the most minimal test please run

docker run -p 8080:80 -it --rm redimp/otterwiki:2

Check http://127.0.0.1 and share the output here.

tanrak commented 4 months ago

It works when I run the browser (http://127.0.0.1;8080) on the same computer that Docker is running on. When I access the server/docker (192.168.yyy.yyy:8080) from another computer (192.168.xxx.xxx), the error mentioned above appears.

Here is the output: 2024/03/07 21:26:14 [error] 18#18: *6 recv() failed (104: Connection reset by peer) while reading response header from upstream, client: 192.168.xxx.xxx, server: , request: "GET / HTTP/1.1", upstream: "uwsgi://unix:///tmp/uwsgi.sock:", host: "192.168.yyy.yyy:8080"

shangri26199 commented 4 months ago

Could you give more details about the otter wiki host (OS?), your docker version and the ip addresses used? Since they are local they aren't critical.

redimp commented 4 months ago

Hm, not sure what is happening here. Lets rule out if the uwsgi is part of the problem. Please run a plain nginx

docker run -it --rm -p 8080:80 nginx:1.25.3

and check if you can reach this from a) localhost and b) another computer.

tanrak commented 4 months ago

I have run some tests. It seems the error is platform dependent...

amd64:

docker run -p 8080:80 -it --rm redimp/otterwiki:2

docker run -it --rm -p 8080:80 nginx:1.25.3

arm64:

docker run -p 8080:80 -it --rm redimp/otterwiki:2

docker run -it --rm -p 8080:80 nginx:1.25.3

While researching the error, i found this page. I made the change (add buffer-size=65535) in the file uwsgi.ini and built the image myself. And now it finally works on my arm64 (Raspberry Pi OS Debian 10 Buster) system!

shangri26199 commented 4 months ago

Nice to see you were able to fix this yourself. To prevent this from happening to other users we would like to test this ourselfs. Could you still provide us the information? Also it would be nice to know what your client is running on. Since your header seems to be way bigger than usual.

redimp commented 4 months ago

Awesome! Thank you for sharing the solution. Will try to reproduce this.

And now it finally works on my arm64 (Raspberry Pi OS Debian 10 Buster) system!

Obviously I missed to test this combinaton. I've tested the otterwiki only on Debian 11 Bullseye on Raspberry Pi 1B, and and Debian 12 Bookworm on the Pi 4B and 5.

Which docker --version are you runnning? (Or podman version, or ...)

tanrak commented 4 months ago

Here is some more information. It seems not really be platform-dependent but browser-dependent. The "502 Bad Gateway" only appears at Firefox (Windows 10)! On Edge (Windows 10) it works. And it works also on Android with Firefox!?

Edit: Raspberry Pi 4 with Raspbery Pi OS (Debian 10 Buster) Docker version 25.0.3, build 4debf41

redimp commented 4 months ago

I think we are getting closer to the cause of the problem. I'm unfortunaley not a browser expert. Which Firefox version is causing the problem?

The uwsgi default is buffer-size: 4k.

Can you do some more testing and configure it to

buffer-size=8192

and if this still breaks to

buffer-size=16384

tanrak commented 4 months ago

Oh dear. It seems that the problem is related to my current Firefox profile.

Image with buffer-size=8192 works. The request block size is always around 5400 at my "broken" Firefox profile.

Edit: Sorry for the noise. I'll now take care of the Firefox profile.

EditEdit: After testing the software a bit, i have to say that the Otter Wiki is outstanding. It feels a bit like a lightweight DokuWiki with Markdown syntax. Thanks for it!

redimp commented 4 months ago

Thank you for sharing this!

EditEdit: After testing the software a bit, i have to say that the Otter Wiki is outstanding. It feels a bit like a lightweight DokuWiki with Markdown syntax. Thanks for it!

🥳