goauthentik / authentik

The authentication glue you need.
https://goauthentik.io
Other
13.45k stars 897 forks source link

Upgrading from 2023.8 to 2023.10, container won't start #11484

Open kmccmk9 opened 1 month ago

kmccmk9 commented 1 month ago

Describe the bug I am working on a specific environment where I'm doing version by version upgrades. I'm currently trying to go from 2023.8 to 2023.10 and while I see no breaking changes in release notes, I cannot get the container start back up. My only hunch is that there is something funky going on with the python virtual environment.

To Reproduce Steps to reproduce the behavior:

  1. Start with a 2023.8 install through Docker
  2. Bring down your containers and update the stack to 2023.10 tag
  3. Upon starting the stack, see the error in logs.

Expected behavior With no noted user intervention, I would expect that the container would come up.

Screenshots N/A

Logs

Traceback (most recent call last):

  File "<frozen runpy>", line 198, in _run_module_as_main

  File "<frozen runpy>", line 88, in _run_code

  File "/lifecycle/wait_for_db.py", line 8, in <module>

    from psycopg import OperationalError, connect

ModuleNotFoundError: No module named 'psycopg'

Version and Deployment (please complete the following information):

Additional context N/A

jeffreybarrows commented 1 month ago

I am having maybe similar issue? When I run docker logs (container id) I can see that it is trying to connect to the postgres database but it is failing authentication and thus the container will not launch/start. It eventually just goes into an "unhealthy" status.

jeffreybarrows commented 1 month ago

So this is interesting... I am using Ubuntu 22.04 and Docker (latest version) I had changed to root by doing sudo -s and I was installing and running as such. Every time I did docker-compose up -d, it would pull and try to run the containers but the authentik server and authentik worker containers would always fail to start. After running a docker logs (container ID) I could see that the containers were failing the authentication when trying to connect to the postgres database. I deleted everything and tried again and again and no luck. Same issue every-single-time. I even tried manually editing the docker-compose.yml file and manually typing in a password and ignoring the .env file for that. Still same issue. **Then I destroyed all the containers and images again and deleted everything and I instead just performed the tasks as my normal Ubuntu username and instead did sudo for each docker command (and also for generating the password for the .env file). Voila! It started right up no problem at all. I can also reproduce this. Long Story short, and I know lots of people will say "Never run as root dummy" to which i say "Yeah right...you do you and I'll do me" but for this case, just run as normal user and run your docker command as sudo and it works like a charm.