zulip / docker-zulip

Container configurations, images, and examples for Zulip.
https://zulip.com/
Apache License 2.0
586 stars 243 forks source link

[BUG] Manual configuration does not work #343

Open zodiac7 opened 2 years ago

zodiac7 commented 2 years ago

Short version - I am trying to use docker zulip with manual config as described at https://github.com/zulip/docker-zulip#manual-configuration but zulip fails to start giving one of the following errors:

  1. ModuleNotFoundError: No module named 'zproject.dev_settings'. "Zulip migration failed with exit code 1"
  2. INFO exited: zulip-django (exit status 1; not expected) INFO gave up: zulip-django entered FATAL state, too many start retries too quickly

Long version -

I am trying to use zulip in docker mode by using docker zulip with my own settings and secret files as described in https://github.com/zulip/docker-zulip#manual-configuration The purpose is to inject a settings.py middleware so that I can use a sso by letting zulip parse my jwt auth token so far the experience has not been easy.

I am using the default code from above and editing the docker-compose.yml and adding the line MANUAL_CONFIGURATION: "True" and LINK_SETTINGS_TO_DATA: "True" as instructed in the docker-zulip documentation.

I have tried the below scenarios. Zulip logs and my files for each scenario are attached here.

Scenario 1: My Settings file and secret files are present in host at /opt/docker/zulip/zulip/settings/etc-zulip/, Root user owns them. Zulip does not start and in the console says ModuleNotFoundError: No module named 'zproject.dev_settings'. "Zulip migration failed with exit code 1".

Scenario 2: I run zulip without the manual config, it runs successfully, I copy the secrets.conf, settings.py and zulip.conf over from the container to /opt/docker/zulip/zulip/settings/etc-zulip/. I then kill zulip, set manual config and link settings to true in the docker-compose.yml, delete all the files except these from /opt/docker/zulip and run zulip again. Zulip does not start but gives a different error this time as shown below. INFO exited: zulip-django (exit status 1; not expected) INFO gave up: zulip-django entered FATAL state, too many start retries too quickly

If i comment out MANUAL_CONFIGURATION in docker-compose.yml then everything runs file. I am running the latest docker-zulip cloned from github on Linux mint cinnamon 20.02 , docker compose 1.25.0-1

zulip_s1.log zulip_s2.log zulip_bug_report_files.zip

zodiac7 commented 2 years ago

FYI anyone who is facing this issue, I was able to make some progress by COPYING all files from the container's etc directory to your host machine at /opt/docker/zulip/zulip/settings/etc-zulip. The files which I copied were nginx_sharding.conf, sharding.json, zulip.conf, settings.py, uwsgi.ini, zulip-secrets.conf

I suggest updating the documentation for docker zulip with this information so others dont face this. Let me know if you would like me to update it and I will be happy to do it.

kuya1284 commented 2 months ago

I know this is old but I just ran into this issue today and just wanted to contribute my solution. I discovered the following issues:

The README says to place the files in /opt/docker/zulip/zulip/settings/etc-zulip/; however, that seems incorrect. What I did to get this to work was to create a bind mount for settings.py, zulip-secrets.conf, and zulip.conf in /data/settings/etc-zulip/ instead.

The second issue is that the README makes no mention of including zulip.conf, which does appear to be needed, especially if copying /etc/zulip/zulip.conf from the container. By omitting this file, a default will get created without the [machine] section and will prevent the container from starting.

The third issue that I ran into is that despite setting both MANUAL_CONFIGURATION and LINK_SETTINGS_TO_DATA, the entrypoint.sh script still expects the SECRETS_postgres_password to be set. The following error appears in the logs:

/sbin/entrypoint.sh: line 338: SECRETS_postgres_password: parameter not set

So what I ended up doing was just set SECRETS_postgres_password, but left it EMPTY.

I'm honestly surprised that this hasn't been addressed since the OP created this issue 2 years ago and the solution to this issue seems relatively easy to fix. The README just needs to be updated to reference to correct path and the entry script just needs to initialize SECRETS_postgres_password in waitingForDatabase() when MANUAL_CONFIGURATION is set.

I hope this helps others.

EDIT: Added zulip.conf to the list of files that need to be included that was missing from the instructions because that needed to be included in the etc-zulip/ directory as well. Without it, a default config file would get created WITHOUT the [machine] section.

atomicthumbs commented 1 month ago

lost several hours of effort to this today