usememos / memos

An open source, lightweight note-taking service. Easily capture and share your great thoughts.
https://usememos.com
MIT License
30.3k stars 2.27k forks source link

Default port is broken #3761

Closed Karitham closed 1 month ago

Karitham commented 1 month ago

Describe the bug

Trying to deploy the app on my kubernetes cluster, I wrote a little manifest for it. The docs say the default port is 5230. When starting up the 0.22.4 container image mentions it's service on port 0 (Aka random on unix at least).

Nothing seems to have been bound on that default port either, since port-forward was broken.

Adding the port env var (to 5230) made it work flawlessly.

Steps to reproduce

Can see the source in https://github.com/karitham/infra apps/memos/deployment.yaml

The image has been upgraded to 0.22.4 currently running and I have not tried debugging that one.

The version of Memos you're using.

stable

Screenshots or additional context

No response

Karitham commented 1 month ago

Hello, I debugged it a ton more and apparently it's because kubernetes inject the service addresses as environment variables. By default, when I had a service named memos, an env MEMOS_PORT=tcp://10.96.96.130:5230 would be injected, which would result in the port being overridden. https://kubernetes.io/docs/concepts/services-networking/service/#environment-variables

I can only blame myself for that bug, hopefully this rundown above helps someone else figure this out, I'd never had any issues with this behavior before.