PostHog / posthog

🦔 PostHog provides open-source web & product analytics, session recording, feature flagging and A/B testing that you can self-host. Get started - free.
https://posthog.com
Other
21.96k stars 1.32k forks source link

Developing locally using posthog-foss fails #25023

Closed harryqt closed 1 month ago

harryqt commented 2 months ago

When developing-locally using posthog-foss, can't get past DEBUG=1 ./bin/migrate

(env) harry@ubuntu24:~/posthog-foss$ ./bin/migrate
Performing cyclotron migrations for postgres://posthog:posthog@localhost:5432/cyclotron (DATABASE_NAME=cyclotron)
    Updating crates.io index
     Ignored package `sqlx-cli v0.8.2` is already installed, use --force to override
Applied 20240804122549/migrate initial job queue schema (38.615316ms)
Applied 20240823191751/migrate bytes over text (22.500356ms)
2024-09-17 17:08:42 [warning  ] ['️Environment variable DEBUG is set - PostHog is running in DEVELOPMENT MODE!', 'Be sure to unset DEBUG if this is supposed to be a PRODUCTION ENVIRONMENT!']
Traceback (most recent call last):
  File "/home/harry/posthog-foss/manage.py", line 22, in <module>
    main()
  File "/home/harry/posthog-foss/manage.py", line 18, in main
    execute_from_command_line(sys.argv)
  File "/home/harry/posthog-foss/env/lib/python3.11/site-packages/django/core/management/__init__.py", line 442, in execute_from_command_line
    utility.execute()
  File "/home/harry/posthog-foss/env/lib/python3.11/site-packages/django/core/management/__init__.py", line 416, in execute
    django.setup()
  File "/home/harry/posthog-foss/env/lib/python3.11/site-packages/django/__init__.py", line 24, in setup
    apps.populate(settings.INSTALLED_APPS)
  File "/home/harry/posthog-foss/env/lib/python3.11/site-packages/django/apps/registry.py", line 116, in populate
    app_config.import_models()
  File "/home/harry/posthog-foss/env/lib/python3.11/site-packages/django/apps/config.py", line 269, in import_models
    self.models_module = import_module(models_module_name)
                         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/importlib/__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "<frozen importlib._bootstrap>", line 1204, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1176, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1147, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 690, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 940, in exec_module
  File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
  File "/home/harry/posthog-foss/posthog/models/__init__.py", line 54, in <module>
    from .organization_invite import OrganizationInvite
  File "/home/harry/posthog-foss/posthog/models/organization_invite.py", line 9, in <module>
    from ee.models.explicit_team_membership import ExplicitTeamMembership
ModuleNotFoundError: No module named 'ee'
(env) harry@ubuntu24:~/posthog-foss$ 

ee directory not present in foss version, thus failing: organization_invite.py#L9

benjackwhite commented 2 months ago

Will update the docs. You need to run cargo install sqlx-cli

harryqt commented 2 months ago

You need to run cargo install sqlx-cli

Its already installed. The actual issue coming from:

  File "/home/harry/posthog-foss/posthog/models/organization_invite.py", line 9, in <module>
    from ee.models.explicit_team_membership import ExplicitTeamMembership
ModuleNotFoundError: No module named 'ee'
(env) harry@ubuntu24:~/posthog-foss$ 
abhi12299 commented 2 months ago

The issue is that the ee directory does not exist in the posthog-foss repo. It does exist in this repo though.

harryqt commented 2 months ago

You need to run cargo install sqlx-cli

Installed again using --force, but still same error. :/