linuxserver / docker-healthchecks

GNU General Public License v3.0
177 stars 38 forks source link

Env var not getting regenerated properly #80

Closed obvionaoe closed 1 year ago

obvionaoe commented 3 years ago

linuxserver.io


Expected Behavior

Environment variables should get correctly regenerated if REGENERATE_SETTINGS=True

Current Behavior

The env var EMAIL_HOST_PASSWORD is not getting regenerated properly:

EMAIL_HOST_PASSWORD = "xxxxxEMAIL_HOST_PASSWORD = "xxxxxxxxxxxxxxxxx"

Steps to Reproduce

  1. docker-compose up -d
  2. docker-compose down
  3. docker-compose up -d with REGENERATE_SETTINGS=True
  4. docker logs -f

Environment

OS: Manjaro Linux CPU architecture: x86_64 How docker service was installed: from the distro repo

Command used to create docker container (run/create/compose/screenshot)

docker-compose up -d

Docker logs

unable to load app 0 (mountpoint='') (callable not found or import error)
*** no app loaded. going in full dynamic mode ***
*** uWSGI is running in multiple interpreter mode ***
spawned uWSGI master process (pid: 313)
spawned uWSGI worker 1 (pid: 329, cores: 1)
[uwsgi-daemons] spawning "/usr/bin/python3 ./manage.py sendalerts" (uid: 1000 gid: 1000)
Traceback (most recent call last):
  File "/app/healthchecks/./manage.py", line 10, in <module>
    execute_from_command_line(sys.argv)
  File "/usr/lib/python3.9/site-packages/django/core/management/__init__.py", line 419, in execute_from_command_line
    utility.execute()
  File "/usr/lib/python3.9/site-packages/django/core/management/__init__.py", line 363, in execute
    settings.INSTALLED_APPS
  File "/usr/lib/python3.9/site-packages/django/conf/__init__.py", line 82, in __getattr__
    self._setup(name)
  File "/usr/lib/python3.9/site-packages/django/conf/__init__.py", line 69, in _setup
    self._wrapped = Settings(settings_module)
  File "/usr/lib/python3.9/site-packages/django/conf/__init__.py", line 170, in __init__
    mod = importlib.import_module(self.SETTINGS_MODULE)
  File "/usr/lib/python3.9/importlib/__init__.py", line 127, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1030, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1007, in _find_and_load
  File "<frozen importlib._bootstrap>", line 986, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 680, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 855, in exec_module
  File "<frozen importlib._bootstrap>", line 228, in _call_with_frames_removed
  File "/app/healthchecks/hc/settings.py", line 279, in <module>
    from .local_settings import *
  File "/app/healthchecks/hc/local_settings.py", line 6
    EMAIL_HOST_PASSWORD = "xxxxxEMAIL_HOST_PASSWORD = "xxxxxxxxxxxxxxxxx"
                                                       ^
SyntaxError: invalid syntax
daemon "/usr/bin/python3 ./manage.py sendalerts" (pid: 330) annihilated
github-actions[bot] commented 3 years ago

Thanks for opening your first issue here! Be sure to follow the bug or feature issue templates!

github-actions[bot] commented 2 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

The-Inamati commented 2 years ago

I have the same issue and after a few tests I found out that at least in my case it's being caused by the use of a secret for that variable. I removed the secret and I don't get the same error.

obvionaoe commented 2 years ago

I'm not using any secrets, and it still doesn't regen properly

immanuelfodor commented 2 years ago

I've bumped into this today, added a new variable to the environment, and it's not present in the local settings py file even with regenerate being true: CSRF_TRUSTED_ORIGINS="['https://example.com']" As of Django 4.0, the http/https should be present before the FQDN.

immanuelfodor commented 2 years ago

Here is a fix for the above CSRF issue: https://github.com/linuxserver/docker-healthchecks/pull/84

github-actions[bot] commented 2 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

obvionaoe commented 2 years ago

not stale, I'll submit a PR, when I have enough time

github-actions[bot] commented 2 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

obvionaoe commented 2 years ago

not stale

gclawes commented 2 years ago

I've noticed that REGENERATE_SETTINGS="True" does not actually delete the local_settings.py file, but just appends to the end, meaning restarts cause the file to keep growing as long as REGENERATE_SETTINGS="True".

Edit: I see this was fixed: https://github.com/linuxserver/docker-healthchecks/issues/70 https://github.com/linuxserver/docker-healthchecks/pull/73

github-actions[bot] commented 2 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

obvionaoe commented 2 years ago

It wasn't totally fixed

github-actions[bot] commented 2 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

github-actions[bot] commented 1 year ago

This issue is locked due to inactivity