Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Custom setting.py not being picked up #285

Closed
Pandry opened this issue Dec 28, 2020 · 3 comments
Closed

Custom setting.py not being picked up #285

Pandry opened this issue Dec 28, 2020 · 3 comments

Comments

@Pandry
Copy link

Pandry commented Dec 28, 2020

Hello there!
I started trying out Zulip using docker and I wanted to integrate a SAML SSO (Keycloak).
I tried setting up a custom settings.py file but unfortunately I'm unable to make il work.

AS a workaround, I temporarily edited the file in the host and then copied it in the container and restarted the server (literally docker exec -u zulip zulip_zulip_1 /home/zulip/deployments/current/scripts/restart-server)

Back to the issue...
This is the zulip container's log when I try to start up the container with the env variables MANUAL_CONFIGURATION and LINK_SETTINGS_TO_DATA set to true in docker-compose.yml file:

=== Begin Initial Configuration Phase ===
Preparing and linking the uploads folder ...
Prepared and linked the uploads directory.
Executing nginx configuration ...
Nginx configuration succeeded.
Certificates configuration succeeded.
Auto backup enabled.
=== End Initial Configuration Phase ===
=== Begin Bootstrap Phase ===
Waiting for database server to allow connections ...
Executing Zulip first start init ...
First Start Init not needed. Continuing.
Migrating Zulip to new version ...
Traceback (most recent call last):
  File "/home/zulip/deployments/current/manage.py", line 44, in <module>
    log_management_command(" ".join(sys.argv), settings.MANAGEMENT_LOG_PATH)
  File "/home/zulip/deployments/2020-12-01-22-47-56/zulip-py3-venv/lib/python3.6/site-packages/django/conf/__init__.py", line 79, in __getattr__
    self._setup(name)
  File "/home/zulip/deployments/2020-12-01-22-47-56/zulip-py3-venv/lib/python3.6/site-packages/django/conf/__init__.py", line 66, in _setup
    self._wrapped = Settings(settings_module)
  File "/home/zulip/deployments/2020-12-01-22-47-56/zulip-py3-venv/lib/python3.6/site-packages/django/conf/__init__.py", line 157, in __init__
    mod = importlib.import_module(self.SETTINGS_MODULE)
  File "/usr/lib/python3.6/importlib/__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 994, in _gcd_import
  File "<frozen importlib._bootstrap>", line 971, in _find_and_load
  File "<frozen importlib._bootstrap>", line 955, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 665, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 678, in exec_module
  File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
  File "/home/zulip/deployments/2020-12-01-22-47-56/zproject/settings.py", line 19, in <module>
    from .configured_settings import *  # noqa: F401,F403 isort: skip
  File "/home/zulip/deployments/2020-12-01-22-47-56/zproject/configured_settings.py", line 8, in <module>
    from .default_settings import *  # noqa: F401,F403 isort: skip
  File "/home/zulip/deployments/2020-12-01-22-47-56/zproject/default_settings.py", line 13, in <module>
    from .prod_settings import EXTERNAL_HOST, ZULIP_ADMINISTRATOR
ImportError: cannot import name 'EXTERNAL_HOST'
Zulip migration failed with exit code 1. Exiting.

Am I missing something?
Unfortunately I had no time to investigate (yet)

Also I would like to highlight that I have a reverse proxy and having DISABLE_HTTPS: "True" (and so a reverse proxy to the HTTP port) results in a AuthFailed: Authentication failed: SAML login failed: ['invalid_response'] (The response was received at https://zulip.example.com:80/complete/saml/ instead of https://zulip.example.com/complete/saml/)

@Pandry Pandry changed the title Custom setting.py not being picken up Custom setting.py not being picked up Dec 29, 2020
@Pandry
Copy link
Author

Pandry commented Dec 29, 2020

Plot twist
I somehome managed to make my installation working
Below are the command I executed (while using nano I'm pretty sure I did not edit the config)

[root@main zulip]# nano settings.py
[root@main zulip]# docker cp settings.py zulip_zulip_1:/etc/zulip/settings.py 
[root@main zulip]# docker exec -u zulip zulip_zulip_1 /home/zulip/deployments/current/scripts/restart-server
[...] # Logs where the server restarts (comes back online nicely as always and SSO works, just like before)
[root@main zulip]# cp settings.py data/zulip/settings/etc-zulip/settings.py                                       
cp: overwrite ‘data/zulip/settings/etc-zulip/settings.py’? y
[root@main zulip]# chmod 444 data/zulip/settings/etc-zulip/settings.py             
[root@main zulip]# docker-compose restart zulip
Restarting zulip_zulip_1 ... done

After this restart the SSO with keycloak was working fine and without any hacky docker cp involved...
I think this deserves more attention tho

@roomcays
Copy link

roomcays commented Dec 9, 2023

Following may or may not help: check if /etc/zulip/settings.py file inside container actually exists and is not empty. Try disabling LINK_SETTINGS_TO_DATA (and/or MANUAL_CONFIGURATION) and check container behavior.

@timabbott
Copy link
Member

This is probably effectively a duplicate of #343, issues folks are having using MANUAL_CONFIGURATION.

@timabbott timabbott closed this as not planned Won't fix, can't repro, duplicate, stale Nov 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants