Open krystofbe opened 1 year ago
It looks like you don't have the SECRET_KEY
environment variable set, it's required for running PostHog, alongside SITE_URL
. See docs: https://posthog.com/docs/self-host/configure/environment-variables
Let me know if adding those variables fixes the deployment @krystofbe!
Having similar issues setting up the hobby deploy.
I tried modifying the docker compose manually to set the SECRET_KEY, but then
ubuntu-temporal-django-worker-1 | Traceback (most recent call last):
ubuntu-temporal-django-worker-1 | File "/python-runtime/django/core/management/__init__.py", line 237, in fetch_command
ubuntu-temporal-django-worker-1 | app_name = commands[subcommand]
ubuntu-temporal-django-worker-1 | KeyError: 'start_temporal_worker'
ubuntu-temporal-django-worker-1 |
ubuntu-temporal-django-worker-1 | During handling of the above exception, another exception occurred:
ubuntu-temporal-django-worker-1 |
ubuntu-temporal-django-worker-1 | Traceback (most recent call last):
ubuntu-temporal-django-worker-1 | File "/code/manage.py", line 21, in <module>
ubuntu-temporal-django-worker-1 | main()
ubuntu-temporal-django-worker-1 | File "/code/manage.py", line 17, in main
ubuntu-temporal-django-worker-1 | execute_from_command_line(sys.argv)
ubuntu-temporal-django-worker-1 | File "/python-runtime/django/core/management/__init__.py", line 419, in execute_from_command_line
ubuntu-temporal-django-worker-1 | utility.execute()
ubuntu-temporal-django-worker-1 | File "/python-runtime/django/core/management/__init__.py", line 413, in execute
ubuntu-temporal-django-worker-1 | self.fetch_command(subcommand).run_from_argv(self.argv)
ubuntu-temporal-django-worker-1 | File "/python-runtime/django/core/management/__init__.py", line 244, in fetch_command
ubuntu-temporal-django-worker-1 | settings.INSTALLED_APPS
ubuntu-temporal-django-worker-1 | File "/python-runtime/django/conf/__init__.py", line 82, in __getattr__
ubuntu-temporal-django-worker-1 | self._setup(name)
ubuntu-temporal-django-worker-1 | File "/python-runtime/django/conf/__init__.py", line 69, in _setup
ubuntu-temporal-django-worker-1 | self._wrapped = Settings(settings_module)
ubuntu-temporal-django-worker-1 | File "/python-runtime/django/conf/__init__.py", line 170, in __init__
ubuntu-temporal-django-worker-1 | mod = importlib.import_module(self.SETTINGS_MODULE)
ubuntu-temporal-django-worker-1 | File "/usr/local/lib/python3.10/importlib/__init__.py", line 126, in import_module
ubuntu-temporal-django-worker-1 | return _bootstrap._gcd_import(name[level:], package, level)
ubuntu-temporal-django-worker-1 | File "<frozen importlib._bootstrap>", line 1050, in _gcd_import
ubuntu-temporal-django-worker-1 | File "<frozen importlib._bootstrap>", line 1027, in _find_and_load
ubuntu-temporal-django-worker-1 | File "<frozen importlib._bootstrap>", line 1006, in _find_and_load_unlocked
ubuntu-temporal-django-worker-1 | File "<frozen importlib._bootstrap>", line 688, in _load_unlocked
ubuntu-temporal-django-worker-1 | File "<frozen importlib._bootstrap_external>", line 883, in exec_module
ubuntu-temporal-django-worker-1 | File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
ubuntu-temporal-django-worker-1 | File "/code/posthog/settings/__init__.py", line 25, in <module>
ubuntu-temporal-django-worker-1 | from posthog.settings.celery import *
ubuntu-temporal-django-worker-1 | File "/code/posthog/settings/celery.py", line 6, in <module>
ubuntu-temporal-django-worker-1 | from posthog.settings.data_stores import REDIS_URL
ubuntu-temporal-django-worker-1 | File "/code/posthog/settings/data_stores.py", line 95, in <module>
ubuntu-temporal-django-worker-1 | raise ImproperlyConfigured(
ubuntu-temporal-django-worker-1 | django.core.exceptions.ImproperlyConfigured: The environment vars "DATABASE_URL" or "POSTHOG_DB_NAME" are absolutely required to run this software
ubuntu-temporal-django-worker-1 | ./bin/temporal-django-worker: line 1: kill: (-6) - No such process
Relevant docker-compose section (only modification was the addition of the secret-key):
temporal-django-worker:
command: /compose/temporal-django-worker
extends:
file: docker-compose.base.yml
service: temporal-django-worker
volumes:
- ./compose:/compose
image: posthog/posthog:latest
environment:
SENTRY_DSN: 'https://public@sentry.example.com/1'
SITE_URL: https://posthog.ambiencehealthcare.com
SECRET_KEY: 00000000000000000000000000000000000000000000000000000000
@JDongian Try setting the following postgres and redis environment variables. Started working for me after this
DATABASE_URL: 'postgres://posthog:posthog@db:5432/posthog'
REDIS_URL: 'redis://redis:6379/'
I believe the issue here is in docker-compose.base.yml https://github.com/PostHog/posthog/blob/d53b9d6a62876868099e894eaaa9441d96aa9f27/docker-compose.base.yml#L187-L192
The temporal-django-worker
dict extends the &worker
reference, but then overwrites the environment
to set TEMPORAL_HOST: temporal
instead of merging.
Edit: removing that environment variable from docker-compose.base.yml and adding it to docker-compose.yml seems to work for me.
@JDongian Try setting the following postgres and redis environment variables. Started working for me after this
DATABASE_URL: 'postgres://posthog:posthog@db:5432/posthog' REDIS_URL: 'redis://redis:6379/'
In which file?
I believe the issue here is in docker-compose.base.yml
The
temporal-django-worker
dict extends the&worker
reference, but then overwrites theenvironment
to setTEMPORAL_HOST: temporal
instead of merging.Edit: removing that environment variable from docker-compose.base.yml and adding it to docker-compose.yml seems to work for me.
great! can you please elaborate with exact code? would appreciate!!
I believe the issue here is in docker-compose.base.yml
The
temporal-django-worker
dict extends the&worker
reference, but then overwrites theenvironment
to setTEMPORAL_HOST: temporal
instead of merging.Edit: removing that environment variable from docker-compose.base.yml and adding it to docker-compose.yml seems to work for me.
===== The above solution worked for me.
# TEMPORAL_HOST: temporal
My updated docker-compose.base.yml file. My updated docker-compose.yml file
hello im still having this issue after this suggested fix... any help?
docker logs fbe838a223d2
./bin/temporal-django-worker: line 1: kill: (-6) - No such process
{'event': '\n You are using the default SECRET_KEY in a production environment!\n For the safety of your instance, you must generate and set a unique key.,\n More information on\n https://posthog.com/docs/self-host/configure/securing-posthog,\n ', 'timestamp': '2023-11-06T07:41:54.898522Z', 'logger': 'posthog.settings.access', 'level': 'critical', 'pid': 8, 'tid': 140649049134912}
[ERROR] Default SECRET_KEY in production. Stopping Django server…
./bin/temporal-django-worker: line 1: kill: (-7) - No such process
I believe the issue here is in docker-compose.base.yml https://github.com/PostHog/posthog/blob/d53b9d6a62876868099e894eaaa9441d96aa9f27/docker-compose.base.yml#L187-L192
The
temporal-django-worker
dict extends the&worker
reference, but then overwrites theenvironment
to setTEMPORAL_HOST: temporal
instead of merging. Edit: removing that environment variable from docker-compose.base.yml and adding it to docker-compose.yml seems to work for me.===== The above solution worked for me.
- Commented these 2 lines in docker-compose.base.yml
# TEMPORAL_HOST: temporal
- Added 2 values in docker-compose.yml - TEMPORAL_HOST & SECRET_KEY
My updated docker-compose.base.yml file. My updated docker-compose.yml file
@doudoujay just faced the same issue, made changes you've referred to, docker-compose up -d
and it works
@doudoujay just faced the same issue, made changes you've referred to,
docker-compose up -d
and it works
@zytfo Hey I run docker-compose restart But it didn't work
Just adding some additional info: I can confirm that I just ran into the exact same issue today. This was on a fresh selfhost "Hobby" install, using git commit SHA 56c8154f045628a00c02a9155bcae8cafbbb9dfa
. The fix in https://github.com/PostHog/posthog/issues/16169#issuecomment-1625351591 worked.
Almost 1 year since the issue was opened, it's still very much happening. Fix mentioned in https://github.com/PostHog/posthog/issues/16169#issuecomment-1628849039 works, just remember to docker-compose up -d
after fixing your ymls.
Very annoying to face and fix bugs on step #1 of deployment.
Has this really been broken for a whole year?
Looks like it's been fixed on one of those last month PRs.
Bug description
I tried the Open-source hobby deploy on a fresh ubuntu 22 hetzner cloud server and ran the
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/posthog/posthog/HEAD/bin/deploy-hobby)"
commandthe command finished with
unfortunately the application does not start: output of
docker ps
docker logs 8bce46ac9548
returnsis there anything i did wrong? i just installed docker and docker-compose and ran the command
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/posthog/posthog/HEAD/bin/deploy-hobby)"
Environment
docker compose
, version/commit: latest