linuxserver / docker-grocy

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

[BUG] Container does not start up with "Grocy\Middleware\ReverseProxyAuthMiddleware" #83

Closed ServusNL closed 11 months ago

ServusNL commented 11 months ago

Is there an existing issue for this?

Current Behavior

When setting "AUTH_CLASS" to "Grocy\Middleware\ReverseProxyAuthMiddleware" the container fails to start up. No error found in the log. Last line: "[ls.io-init] done." Container stays in state "deploying".

Kubernetes events: 2023-12-30 22:14:09 Readiness probe failed: Get "http://172.16.11.193:80/": dial tcp 172.16.11.193:80: connect: connection refused 2023-12-30 22:13:59 Container grocy failed liveness probe, will be restarted 2023-12-30 22:13:59 Readiness probe failed: Get "http://172.16.11.193:80/": EOF 2023-12-30 22:13:19 Liveness probe failed: HTTP probe failed with statuscode: 500 2023-12-30 22:13:14 Readiness probe failed: HTTP probe failed with statuscode: 500

Tried to set the setting in both env variables and in the config file. After changing the setting to "Grocy\Middleware\DefaultAuthMiddleware" all works fine.

Other Proxy settings: `// Either "Grocy\Middleware\DefaultAuthMiddleware", "Grocy\Middleware\ReverseProxyAuthMiddleware" // or any class that implements Grocy\Middleware\AuthMiddleware Setting('AUTH_CLASS', 'Grocy\Middleware\ReverseProxyAuthMiddleware');

// Options when using ReverseProxyAuthMiddleware Setting('REVERSE_PROXY_AUTH_HEADER', 'X-authentik-username'); // The name of the HTTP header which your reverse proxy uses to pass the username (on successful authentication) Setting('REVERSE_PROXY_AUTH_USE_ENV', false); // Set to true if the username is passed as environment variable`

Expected Behavior

A working container using configured proxy setting.

Steps To Reproduce

Change config to: `// Either "Grocy\Middleware\DefaultAuthMiddleware", "Grocy\Middleware\ReverseProxyAuthMiddleware" // or any class that implements Grocy\Middleware\AuthMiddleware Setting('AUTH_CLASS', 'Grocy\Middleware\ReverseProxyAuthMiddleware');

// Options when using ReverseProxyAuthMiddleware Setting('REVERSE_PROXY_AUTH_HEADER', 'X-authentik-username'); // The name of the HTTP header which your reverse proxy uses to pass the username (on successful authentication) Setting('REVERSE_PROXY_AUTH_USE_ENV', false); // Set to true if the username is passed as environment variable`

Start up container.

Environment

- OS: TrueNAS-SCALE-23.10.1
- How docker service was installed: TrueCharts

CPU architecture

x86-64

Docker creation

See screenshot

Container logs

2023-12-30 22:21:28.702531+01:00[migrations] started
2023-12-30 22:21:28.716091+01:00[migrations] 01-nginx-site-confs-default: skipped
2023-12-30 22:21:28.723434+01:00[migrations] 02-default-location: skipped
2023-12-30 22:21:28.723638+01:00[migrations] done
2023-12-30 22:21:29.255955+01:00───────────────────────────────────────
2023-12-30 22:21:29.256047+01:002023-12-30T22:21:29.256047563+01:00
2023-12-30 22:21:29.256097+01:00██╗     ███████╗██╗ ██████╗ 
2023-12-30 22:21:29.256117+01:00██║     ██╔════╝██║██╔═══██╗
2023-12-30 22:21:29.256134+01:00██║     ███████╗██║██║   ██║
2023-12-30 22:21:29.256151+01:00██║     ╚════██║██║██║   ██║
2023-12-30 22:21:29.256169+01:00███████╗███████║██║╚██████╔╝
2023-12-30 22:21:29.256198+01:00╚══════╝╚══════╝╚═╝ ╚═════╝ 
2023-12-30 22:21:29.256214+01:002023-12-30T22:21:29.256214967+01:00
2023-12-30 22:21:29.256233+01:00Brought to you by linuxserver.io
2023-12-30 22:21:29.256250+01:00───────────────────────────────────────
2023-12-30 22:21:29.256360+01:002023-12-30T22:21:29.256360739+01:00
2023-12-30 22:21:29.256420+01:00To support LSIO projects visit:
2023-12-30 22:21:29.256440+01:00https://www.linuxserver.io/donate/
2023-12-30 22:21:29.256457+01:002023-12-30T22:21:29.256457581+01:00
2023-12-30 22:21:29.256474+01:00───────────────────────────────────────
2023-12-30 22:21:29.256490+01:00GID/UID
2023-12-30 22:21:29.256506+01:00───────────────────────────────────────
2023-12-30 22:21:29.263774+01:002023-12-30T22:21:29.263774236+01:00
2023-12-30 22:21:29.263829+01:00User UID:    568
2023-12-30 22:21:29.263848+01:00User GID:    568
2023-12-30 22:21:29.263867+01:00───────────────────────────────────────
2023-12-30 22:21:29.263883+01:002023-12-30T22:21:29.263883748+01:00
2023-12-30 22:21:29.422408+01:00using keys found in /config/keys
2023-12-30 22:21:29.620284+01:00chown: cannot dereference '/var/lib/nginx/run': No such file or directory
2023-12-30 22:21:29.620853+01:00**** Permissions could not be set. This is probably because your volume mounts are remote or read-only. ****
2023-12-30 22:21:29.620905+01:00**** The app may not work properly and we will not provide support for it. ****
2023-12-30 22:21:30.106630+01:00[custom-init] No custom files found, skipping...
2023-12-30 22:21:30.126958+01:00[ls.io-init] done.
github-actions[bot] commented 11 months ago

Thanks for opening your first issue here! Be sure to follow the relevant issue templates, or risk having this issue marked as invalid.

ServusNL commented 11 months ago

Setting "Setting('BASE_URL', '/');" to the url fixed the issue.