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

Grocy docker started but shows ERR_TOO_MANY_REDIRECTS #72

Closed jonathansheehy closed 1 year ago

jonathansheehy commented 1 year ago

Is there an existing issue for this?

Current Behavior

When we try to navigate to the webpage, either http or https, it shows ERR_TOO_MANY_REDIRECTS

Expected Behavior

Login Page should come up

Steps To Reproduce

  1. Open URL with Chrome or Edge
  2. No login page
  3. Mobile app not working too

Environment

- OS:Windows 11 and Android App
- How docker service was installed: Unraid dockers, all other are working correctly
- Log file not showing any type or error

CPU architecture

x86-64

Docker creation

Unraid Docker

Container logs

[migrations] started
[migrations] 01-nginx-site-confs-default: skipped
[migrations] 02-default-location: skipped
[migrations] done
───────────────────────────────────────

      ██╗     ███████╗██╗ ██████╗ 
      ██║     ██╔════╝██║██╔═══██╗
      ██║     ███████╗██║██║   ██║
      ██║     ╚════██║██║██║   ██║
      ███████╗███████║██║╚██████╔╝
      ╚══════╝╚══════╝╚═╝ ╚═════╝ 

   Brought to you by linuxserver.io
───────────────────────────────────────

To support LSIO projects visit:
https://www.linuxserver.io/donate/

───────────────────────────────────────
GID/UID
───────────────────────────────────────

User UID:    99
User GID:    100
───────────────────────────────────────

using keys found in /config/keys
**** The following active confs have different version dates than the samples that are shipped. ****
**** This may be due to user customization or an update to the samples. ****
**** You should compare the following files to the samples in the same folder and update them. ****
**** Use the link at the top of the file to view the changelog. ****
┌────────────┬────────────┬────────────────────────────────────────────────────────────────────────┐
│  old date  │  new date  │ path                                                                   │
├────────────┼────────────┼────────────────────────────────────────────────────────────────────────┤
│            │ 2023-04-13 │ /config/nginx/nginx.conf                                               │
│ 2022-08-20 │ 2023-06-24 │ /config/nginx/ssl.conf                                                 │
│            │ 2023-04-13 │ /config/nginx/site-confs/default.conf                                  │
└────────────┴────────────┴────────────────────────────────────────────────────────────────────────┘
[custom-init] No custom files found, skipping...
[ls.io-init] done.
github-actions[bot] commented 1 year ago

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

jakern commented 1 year ago

I also have this issue. I'm running this container behind a reverse proxy and thought that could be the issue at first. Now I'm sure it's because this app has recently added nginx configs to the volume.

aptalca commented 1 year ago

First step would be to update the configs as the log suggests

jonathansheehy commented 1 year ago

Even locally with the IP, the docker is still showing redirection. Do we still have to make modifications to the config? I tried to revert to 4.0.0, and the site now works. So it is something in between.

Jonathan


From: aptalca @.> Sent: Tuesday, August 8, 2023 10:04:25 AM To: linuxserver/docker-grocy @.> Cc: jonathansheehy @.>; Author @.> Subject: Re: [linuxserver/docker-grocy] Grocy docker started but shows ERR_TOO_MANY_REDIRECTS (Issue #72)

First step would be to update the configs as the log suggests

— Reply to this email directly, view it on GitHubhttps://github.com/linuxserver/docker-grocy/issues/72#issuecomment-1669685843, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AMQ5SXEVJ3MOZCUV6CQWIWTXUJBOTANCNFSM6AAAAAA3H2Y3QY. You are receiving this because you authored the thread.Message ID: @.***>

superbreadi commented 1 year ago

Hi i have the same problem with latest:

grocy  | [custom-init] No custom files found, skipping...
grocy  | [ls.io-init] done.
grocy  | [migrations] started
grocy  | [migrations] 01-nginx-site-confs-default: skipped
grocy  | [migrations] 02-default-location: skipped
grocy  | [migrations] done
grocy  | usermod: no changes
grocy  | ───────────────────────────────────────
grocy  |
grocy  |
grocy  |       ██╗     ███████╗██╗ ██████╗
grocy  |       ██║     ██╔════╝██║██╔═══██╗
grocy  |       ██║     ███████╗██║██║   ██║
grocy  |       ██║     ╚════██║██║██║   ██║
grocy  |       ███████╗███████║██║╚██████╔╝
grocy  |       ╚══════╝╚══════╝╚═╝ ╚═════╝
grocy  |
grocy  |
grocy  |    Brought to you by linuxserver.io
grocy  | ───────────────────────────────────────
grocy  |
grocy  |
grocy  | To support LSIO projects visit:
grocy  | https://www.linuxserver.io/donate/
grocy  |
grocy  |
grocy  | ───────────────────────────────────────
grocy  | GID/UID
grocy  | ───────────────────────────────────────
grocy  |
grocy  |
grocy  | User UID:    1000
grocy  | User GID:    1000
grocy  | ───────────────────────────────────────
grocy  |
grocy  |
grocy  | using keys found in /config/keys
grocy  | [custom-init] No custom files found, skipping...
grocy  | [ls.io-init] done.

/stockoverview only shows an barcode if i delete cookies (and login), the login page only shows to many redirects: ERR_TOO_MANY_REDIRECTS

When i fix the container version to 4.0.0 everything works

drizuid commented 1 year ago

disregard the below, i recreated the issue. it only presents on an upgrade.

Are any of you using a reverse proxy? if yes, what is it? Unfortunately, someone on discord also has this issue, but much like you all, did not provide a docker run or compose snippet.

following the readme, i have no issues. I can login and logout without fail and click/use any function. This is a brand new install, i've never use grocy before.

docker run --rm -d \
  --name=grocy \
  -e PUID=1006 \
  -e PGID=996 \
  -e TZ=Etc/UTC \
  -p 9283:80 \
  -v /tmp/grocy:/config \
  lscr.io/linuxserver/grocy:latest
image
superbreadi commented 1 year ago

Hi, I tried to use the same docker run script customized to my directories, same error

docker run --rm -d \
  --name=grocy_test \
  -e PUID=1000 \
  -e PGID=1000 \
  -e TZ=Etc/UTC \
  -p 9283:80 \
  -v /srv/grocy/conf:/config \
  lscr.io/linuxserver/grocy:latest

http://192.168.178.80:9283/login
ERR_TOO_MANY_REDIRECTS

No additional proxy in between I also tried to connect to the container and read the logs, but /var/logs/nginx has an empty error file and /var/log/php82 is also empty.

docker run --rm -d \
  --name=grocy_test \
   -e PUID=1000 \
   -e PGID=1000 \
   -e TZ=Etc/UTC \
   -p 9283:80\ 
   -v /srv/grocy/conf:/config \
  lscr.io/linuxserver/grocy:version-v4.0.0

http://192.168.178.80:9283/login shows login screen, all data is available

drizuid commented 1 year ago

we can reproduce it if we upgrade, we are trying to determine the cause. Ill post the efforts so far.

dznet-nas tmp # diff grocy/nginx/nginx.conf grocy2/nginx/nginx.conf
dznet-nas tmp # diff grocy/nginx/resolver.conf grocy2/nginx/resolver.conf
dznet-nas tmp # diff grocy/nginx/ssl.conf grocy2/nginx/ssl.conf
dznet-nas tmp # diff grocy/nginx/worker_processes.conf grocy2/nginx/worker_processes.conf
dznet-nas tmp # diff grocy/nginx/site-confs/default.conf grocy2/nginx/site-confs/default.conf
dznet-nas tmp # diff grocy/nginx/nginx.conf grocy2/nginx/nginx.conf
dznet-nas tmp # diff grocy/nginx/resolver.conf grocy2/nginx/resolver.conf
dznet-nas tmp # diff grocy/nginx/ssl.conf grocy2/nginx/ssl.conf
dznet-nas tmp # diff grocy/nginx/worker_processes.conf grocy2/nginx/worker_processes.conf
dznet-nas tmp # diff grocy/nginx/site-confs/default.conf grocy2/nginx/site-confs/default.conf
dznet-nas tmp # diff grocy/php/www2.conf grocy2/php/www2.conf
dznet-nas tmp # diff grocy/php/php-local.ini grocy2/php/php-local.ini
dznet-nas tmp # diff grocy/www/index.html grocy2/www/index.html
dznet-nas tmp # diff config.php grocy/data/config.php
17,18c17,19
< // When not "production", authentication will be disabled and
< // demo data will be populated during database migrations
---
> // When not "production", the application will work in a demo mode which means
> // authentication is disabled and some demo data will be generated during the database schema migration
> // (pass the query parameter "nodemodata", e.g. https://grocy.example.com/?nodemodata to skip that)

note that while we see differences in config.php, they're just comments. The other primary files have no differences.

jonathansheehy commented 1 year ago

I use nginx as external proxy.

Jonathan


From: driz @.> Sent: Tuesday, August 8, 2023 4:55:26 PM To: linuxserver/docker-grocy @.> Cc: jonathansheehy @.>; Author @.> Subject: Re: [linuxserver/docker-grocy] Grocy docker started but shows ERR_TOO_MANY_REDIRECTS (Issue #72)

we can reproduce it if we upgrade, we are trying to determine the cause. Ill post the efforts so far.

dznet-nas tmp # diff grocy/nginx/nginx.conf grocy2/nginx/nginx.conf dznet-nas tmp # diff grocy/nginx/resolver.conf grocy2/nginx/resolver.conf dznet-nas tmp # diff grocy/nginx/ssl.conf grocy2/nginx/ssl.conf dznet-nas tmp # diff grocy/nginx/worker_processes.conf grocy2/nginx/worker_processes.conf dznet-nas tmp # diff grocy/nginx/site-confs/default.conf grocy2/nginx/site-confs/default.conf dznet-nas tmp # diff grocy/nginx/nginx.conf grocy2/nginx/nginx.conf dznet-nas tmp # diff grocy/nginx/resolver.conf grocy2/nginx/resolver.conf dznet-nas tmp # diff grocy/nginx/ssl.conf grocy2/nginx/ssl.conf dznet-nas tmp # diff grocy/nginx/worker_processes.conf grocy2/nginx/worker_processes.conf dznet-nas tmp # diff grocy/nginx/site-confs/default.conf grocy2/nginx/site-confs/default.conf dznet-nas tmp # diff grocy/php/www2.conf grocy2/php/www2.conf dznet-nas tmp # diff grocy/php/php-local.ini grocy2/php/php-local.ini dznet-nas tmp # diff grocy/www/index.html grocy2/www/index.html dznet-nas tmp # diff config.php grocy/data/config.php 17,18c17,19 < // When not "production", authentication will be disabled and < // demo data will be populated during database migrations

// When not "production", the application will work in a demo mode which means // authentication is disabled and some demo data will be generated during the database schema migration // (pass the query parameter "nodemodata", e.g. https://grocy.example.com/?nodemodata to skip that)

note that while we see differences in config.php, they're just comments. The other primary files have no differences.

— Reply to this email directly, view it on GitHubhttps://github.com/linuxserver/docker-grocy/issues/72#issuecomment-1670295641, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AMQ5SXALDR4ATEQRPS22K2LXUKRT5ANCNFSM6AAAAAA3H2Y3QY. You are receiving this because you authored the thread.Message ID: @.***>

gensyn commented 1 year ago

I think I kind of have the same problem with 4.0.1 after upgrading. When I try to access Grocy directly and unencrypted on docker-container port 80 with Firefox, I get NS_ERROR_REDIRECT_LOOP. In 4.0.0 everything works as expected.

But even weirder is the behavior in 4.0.1 if I access Grocy through my nginx reverse proxy. As already mentioned, /stockoverview only shows a barcode. I can access other URLs though, but they don't show the correct page. For example, /api shows the calendar and /calendar shows the equipment. Most, but not all subsites seem to be off by one menu entry.

berrnd commented 1 year ago

Technically this is most likely about a not emptied data/viewcache directory during/after the upgrade. See also https://github.com/grocy/grocy/issues/2302.

andreasbrett commented 1 year ago

Technically this is most likely about a not emptied data/viewcache directory during/after the upgrade. See also grocy/grocy#2302.

That is spot on. I shutdown the grocy container, cleared out the data/viewcache folder and restarted it with the 4.0.1 image (tag: latest) and it works.

BOFH90 commented 1 year ago

Technically this is most likely about a not emptied data/viewcache directory during/after the upgrade. See also grocy/grocy#2302.

That is spot on. I shutdown the grocy container, cleared out the data/viewcache folder and restarted it with the 4.0.1 image (tag: latest) and it works.

I also can confirm this fixes it on my install :)

drizuid commented 1 year ago

Technically this is most likely about a not emptied data/viewcache directory during/after the upgrade. See also grocy/grocy#2302.

thank you for sharing this! I dont use grocy, so as you can imagine, my troubleshooting efforts were a bit blind and this is immensely helpful

reading through that i found that this is purely from users doing a major version upgrade without consulting the application documentation at all, as this is covered in their upgrade info which is linked to from our readme. https://github.com/grocy/grocy#how-to-update

PascalLeroi commented 1 year ago

Thanks for the comments! I have Watchtower handle my updates and it normally goes great. The upgrade to 4.0.0 was without problems. Just deleted the contents of the data/viewcache and restarted the container. Lo and behold it works again! Thanks :) When I get home, I'll check what happened with Watchtower and the script I used in the first place.

drizuid commented 1 year ago

We do not recommend or support using watchtower for automated updates. We suggest reviewing changelogs for breaking changes prior to upgrading. Otherwise, things like this happen when people blindly upgrade.

I will close this as it is not a bug and not something we will make changes in regards to.

PascalLeroi commented 1 year ago

We do not recommend or support using watchtower for automated updates. We suggest reviewing changelogs for breaking changes prior to upgrading. Otherwise, things like this happen when people blindly upgrade.

I will close this as it is not a bug and not something we will make changes in regards to.

That is fair. Having my own little Nas is still new to me, so I opted for something that seemed like a good idea. But this has learned me to check before updating.

AD-Wright commented 1 year ago

Technically this is most likely about a not emptied data/viewcache directory during/after the upgrade. See also grocy/grocy#2302.

thank you for sharing this! I dont use grocy, so as you can imagine, my troubleshooting efforts were a bit blind and this is immensely helpful

reading through that i found that this is purely from users doing a major version upgrade without consulting the application documentation at all, as this is covered in their upgrade info which is linked to from our readme. https://github.com/grocy/grocy#how-to-update

Hey @drizuid - These changes actually did not happen on a major version upgrade, they occurred going from 4.0.0 to 4.0.1 (the author made 3 -> 4 because of API tweaks, and then .0.0 -> .0.1 when they restructured caching). This change was not mentioned in the changelog at all.

The author does not respond positively to any suggestions about handling potential issues on their end, and thus I think something like this will probably crop up again in the future. The root of the issue is a difficult one, as Phil Karlton would say: Cache Invalidation.

If this issue does happen again (i.e. I don't have the time now so I'm writing this for my own reference), I would suggest modifying the Docker to empty the cache for Grocy, I think this might be as simple as changing one line in root/etc/s6-overlay/s6-rc.d/init-grocy-config/run (add rm -r /app/www/data/viewcache; before mkdir -p /app/www/data/viewcache || : ) Not familiar enough with Docker to say for sure. A fix could probably be applied to Grocy, but would probably not be accepted by the author.

That all being said, it will probably be something else that breaks next time, meaning these notes are pointless.

If a change is made to this repository that resolves the issue, something similar should also be suggested to https://github.com/grocy/grocy-docker, which might be more accepting.