modoboa / modoboa-installer

An installer for Modoboa
MIT License
262 stars 138 forks source link

Add support of Debian 12 #508

Closed florealcab closed 1 year ago

florealcab commented 1 year ago

Description of the issue/feature this PR addresses:

Currently, modoboa install fails on debian 12

Current behavior before PR:

Install fails

Desired behavior after PR is merged:

Install on debian12 succeed

I made some little changes to make installer work on debian12. Tested just once on my new server it seems to work, but should be tested more before merge, if there are some volounteers :)

Changes:

There is still a bug due to python 3.11 but it's related to modoboa core (I have a fix), so I will make a MR here too

samuraikid0 commented 1 year ago

Sync your repo with the main one to fix http port

florealcab commented 1 year ago

Sync your repo with the main one to fix http port

Done :)

codecov[bot] commented 1 year ago

Codecov Report

Patch and project coverage have no change.

Comparison is base (393c433) 54.25% compared to head (2cc34e9) 54.25%.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## master #508 +/- ## ======================================= Coverage 54.25% 54.25% ======================================= Files 10 10 Lines 763 763 ======================================= Hits 414 414 Misses 349 349 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Do you have feedback about the report comment? Let us know in this issue.

samuraikid0 commented 1 year ago

Are you able to use it ? The installer doesn't fail now but I'm getting this using --debug,

Successfully built rrdtool django-xforwardedfor-middleware progressbar33 psycopg2-binary vobject sgmllib3k
Installing collected packages: sievelib, sgmllib3k, pytz, pypng, progressbar33, phonenumbers, passlib, oath, django-webpack-loader, zope.interface, zope.event, urllib3, uritemplate, tzlocal, typing-extensions, six, rrdtool, rpds-py, PyYAML, python-magic, pyjwt, pycparser, psycopg2-binary, Pillow, lxml, inflection, idna, html2text, greenlet, filelock, feedparser, dnspython, django, defusedxml, charset-normalizer, chardet, certifi, bcrypt, attrs, async-timeout, aiosmtplib, requests, reportlab, referencing, redis, qrcode, python-dateutil, jsonfield, gevent, djangorestframework, django-xforwardedfor-middleware, django-reversion, django-rename-app, django-phonenumber-field, django-otp, django-js-asset, django-filter, dj-database-url, cffi, aioredis, vobject, requests-file, ovh, jsonschema-specifications, icalendar, drf-nested-routers, djangorestframework-simplejwt, django-ckeditor, cryptography, x-wr-timezone, tldextract, jsonschema, recurring-ical-events, drf-spectacular, modoboa, caldav, modoboa-webmail, modoboa-sievefilters, modoboa-radicale, modoboa-postfix-autoreply, modoboa-contacts, modoboa-amavis
  Attempting uninstall: django
    Found existing installation: Django 4.2.3
    Uninstalling Django-4.2.3:
      Successfully uninstalled Django-4.2.3
Successfully installed Pillow-10.0.0 PyYAML-6.0 aioredis-2.0.1 aiosmtplib-2.0.2 async-timeout-4.0.2 attrs-23.1.0 bcrypt-4.0.1 caldav-1.1.3 certifi-2023.5.7 cffi-1.15.1 chardet-5.1.0 charset-normalizer-3.2.0 cryptography-41.0.2 defusedxml-0.7.1 dj-database-url-2.0.0 django-3.2.20 django-ckeditor-6.3.0 django-filter-22.1 django-js-asset-2.1.0 django-otp-1.1.6 django-phonenumber-field-7.1.0 django-rename-app-0.1.5 django-reversion-5.0.4 django-webpack-loader-1.8.1 django-xforwardedfor-middleware-2.0 djangorestframework-3.14.0 djangorestframework-simplejwt-5.2.2 dnspython-2.3.0 drf-nested-routers-0.93.4 drf-spectacular-0.26.3 feedparser-6.0.10 filelock-3.12.2 gevent-22.10.2 greenlet-2.0.2 html2text-2020.1.16 icalendar-5.0.7 idna-3.4 inflection-0.5.1 jsonfield-3.1.0 jsonschema-4.18.3 jsonschema-specifications-2023.6.1 lxml-4.9.3 modoboa-2.1.2 modoboa-amavis-1.4.1 modoboa-contacts-0.9.3 modoboa-postfix-autoreply-1.7.1 modoboa-radicale-1.6.3 modoboa-sievefilters-1.6.0 modoboa-webmail-1.7.2 oath-1.4.4 ovh-1.1.0 passlib-1.7.4 phonenumbers-8.13.16 progressbar33-2.4 psycopg2-binary-2.8.6 pycparser-2.21 pyjwt-2.7.0 pypng-0.20220715.0 python-dateutil-2.8.2 python-magic-0.4.27 pytz-2023.3 qrcode-7.4.2 recurring-ical-events-2.0.2 redis-4.6.0 referencing-0.29.1 reportlab-4.0.4 requests-2.31.0 requests-file-1.5.1 rpds-py-0.8.10 rrdtool-0.1.16 sgmllib3k-1.0.0 sievelib-1.2.1 six-1.16.0 tldextract-3.4.4 typing-extensions-4.7.1 tzlocal-5.0.1 uritemplate-4.1.1 urllib3-2.0.3 vobject-0.9.6.1 x-wr-timezone-0.0.5 zope.event-5.0 zope.interface-6.0
Traceback (most recent call last):
  File "/srv/modoboa/instance/manage.py", line 22, in <module>
    main()
  File "/srv/modoboa/instance/manage.py", line 18, in main
    execute_from_command_line(sys.argv)
  File "/srv/modoboa/env/lib/python3.11/site-packages/django/core/management/__init__.py", line 419, in execute_from_command_line
    utility.execute()
  File "/srv/modoboa/env/lib/python3.11/site-packages/django/core/management/__init__.py", line 395, in execute
    django.setup()
  File "/srv/modoboa/env/lib/python3.11/site-packages/django/__init__.py", line 24, in setup
    apps.populate(settings.INSTALLED_APPS)
  File "/srv/modoboa/env/lib/python3.11/site-packages/django/apps/registry.py", line 91, in populate
    app_config = AppConfig.create(entry)
                 ^^^^^^^^^^^^^^^^^^^^^^^
  File "/srv/modoboa/env/lib/python3.11/site-packages/django/apps/config.py", line 124, in create
    mod = import_module(mod_path)
          ^^^^^^^^^^^^^^^^^^^^^^^
  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 1206, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1178, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1149, 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 "/srv/modoboa/env/lib/python3.11/site-packages/modoboa/dmarc/apps.py", line 5, in <module>
    from modoboa.dmarc.forms import load_settings
  File "/srv/modoboa/env/lib/python3.11/site-packages/modoboa/dmarc/forms.py", line 9, in <module>
    from modoboa.dmarc.api.v2 import serializers
  File "/srv/modoboa/env/lib/python3.11/site-packages/modoboa/dmarc/api/v2/serializers.py", line 3, in <module>
    from rest_framework import serializers
  File "/srv/modoboa/env/lib/python3.11/site-packages/rest_framework/serializers.py", line 27, in <module>
    from rest_framework.compat import postgres_fields
  File "/srv/modoboa/env/lib/python3.11/site-packages/rest_framework/compat.py", line 26, in <module>
    from django.contrib.postgres import fields as postgres_fields
  File "/srv/modoboa/env/lib/python3.11/site-packages/django/contrib/postgres/fields/__init__.py", line 1, in <module>
    from .array import *  # NOQA
    ^^^^^^^^^^^^^^^^^^^^
  File "/srv/modoboa/env/lib/python3.11/site-packages/django/contrib/postgres/fields/array.py", line 3, in <module>
    from django.contrib.postgres import lookups
  File "/srv/modoboa/env/lib/python3.11/site-packages/django/contrib/postgres/lookups.py", line 4, in <module>
    from .search import SearchVector, SearchVectorExact, SearchVectorField
  File "/srv/modoboa/env/lib/python3.11/site-packages/django/contrib/postgres/search.py", line 1, in <module>
    import psycopg2
  File "/srv/modoboa/env/lib/python3.11/site-packages/psycopg2/__init__.py", line 51, in <module>
    from psycopg2._psycopg import (                     # noqa
SystemError: initialization of _psycopg raised unreported exception

['/srv/modoboa/env/bin/python3', 'manage.py', 'migrate', '--noinput'] failed, check your configuration
Traceback (most recent call last):
  File "/srv/modoboa/instance/manage.py", line 22, in <module>
    main()
  File "/srv/modoboa/instance/manage.py", line 18, in main
    execute_from_command_line(sys.argv)
  File "/srv/modoboa/env/lib/python3.11/site-packages/django/core/management/__init__.py", line 419, in execute_from_command_line
    utility.execute()
  File "/srv/modoboa/env/lib/python3.11/site-packages/django/core/management/__init__.py", line 395, in execute
    django.setup()
  File "/srv/modoboa/env/lib/python3.11/site-packages/django/__init__.py", line 24, in setup
    apps.populate(settings.INSTALLED_APPS)
  File "/srv/modoboa/env/lib/python3.11/site-packages/django/apps/registry.py", line 91, in populate
    app_config = AppConfig.create(entry)
                 ^^^^^^^^^^^^^^^^^^^^^^^
  File "/srv/modoboa/env/lib/python3.11/site-packages/django/apps/config.py", line 124, in create
    mod = import_module(mod_path)
          ^^^^^^^^^^^^^^^^^^^^^^^
  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 1206, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1178, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1149, 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 "/srv/modoboa/env/lib/python3.11/site-packages/modoboa/dmarc/apps.py", line 5, in <module>
    from modoboa.dmarc.forms import load_settings
  File "/srv/modoboa/env/lib/python3.11/site-packages/modoboa/dmarc/forms.py", line 9, in <module>
    from modoboa.dmarc.api.v2 import serializers
  File "/srv/modoboa/env/lib/python3.11/site-packages/modoboa/dmarc/api/v2/serializers.py", line 3, in <module>
    from rest_framework import serializers
  File "/srv/modoboa/env/lib/python3.11/site-packages/rest_framework/serializers.py", line 27, in <module>
    from rest_framework.compat import postgres_fields
  File "/srv/modoboa/env/lib/python3.11/site-packages/rest_framework/compat.py", line 26, in <module>
    from django.contrib.postgres import fields as postgres_fields
  File "/srv/modoboa/env/lib/python3.11/site-packages/django/contrib/postgres/fields/__init__.py", line 1, in <module>
    from .array import *  # NOQA
    ^^^^^^^^^^^^^^^^^^^^
  File "/srv/modoboa/env/lib/python3.11/site-packages/django/contrib/postgres/fields/array.py", line 3, in <module>
    from django.contrib.postgres import lookups
  File "/srv/modoboa/env/lib/python3.11/site-packages/django/contrib/postgres/lookups.py", line 4, in <module>
    from .search import SearchVector, SearchVectorExact, SearchVectorField
  File "/srv/modoboa/env/lib/python3.11/site-packages/django/contrib/postgres/search.py", line 1, in <module>
    import psycopg2
  File "/srv/modoboa/env/lib/python3.11/site-packages/psycopg2/__init__.py", line 51, in <module>
    from psycopg2._psycopg import (                     # noqa
SystemError: initialization of _psycopg raised unreported exception

['/srv/modoboa/env/bin/python3', 'manage.py', 'load_initial_data', '--admin-username', 'admin'] failed, check your configuration
Traceback (most recent call last):
  File "/srv/modoboa/instance/manage.py", line 22, in <module>
    main()
  File "/srv/modoboa/instance/manage.py", line 18, in main
    execute_from_command_line(sys.argv)
  File "/srv/modoboa/env/lib/python3.11/site-packages/django/core/management/__init__.py", line 419, in execute_from_command_line
    utility.execute()
  File "/srv/modoboa/env/lib/python3.11/site-packages/django/core/management/__init__.py", line 395, in execute
    django.setup()
  File "/srv/modoboa/env/lib/python3.11/site-packages/django/__init__.py", line 24, in setup
    apps.populate(settings.INSTALLED_APPS)
  File "/srv/modoboa/env/lib/python3.11/site-packages/django/apps/registry.py", line 91, in populate
    app_config = AppConfig.create(entry)
                 ^^^^^^^^^^^^^^^^^^^^^^^
  File "/srv/modoboa/env/lib/python3.11/site-packages/django/apps/config.py", line 124, in create
    mod = import_module(mod_path)
          ^^^^^^^^^^^^^^^^^^^^^^^
  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 1206, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1178, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1149, 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 "/srv/modoboa/env/lib/python3.11/site-packages/modoboa/dmarc/apps.py", line 5, in <module>
    from modoboa.dmarc.forms import load_settings
  File "/srv/modoboa/env/lib/python3.11/site-packages/modoboa/dmarc/forms.py", line 9, in <module>
    from modoboa.dmarc.api.v2 import serializers
  File "/srv/modoboa/env/lib/python3.11/site-packages/modoboa/dmarc/api/v2/serializers.py", line 3, in <module>
    from rest_framework import serializers
  File "/srv/modoboa/env/lib/python3.11/site-packages/rest_framework/serializers.py", line 27, in <module>
    from rest_framework.compat import postgres_fields
  File "/srv/modoboa/env/lib/python3.11/site-packages/rest_framework/compat.py", line 26, in <module>
    from django.contrib.postgres import fields as postgres_fields
  File "/srv/modoboa/env/lib/python3.11/site-packages/django/contrib/postgres/fields/__init__.py", line 1, in <module>
    from .array import *  # NOQA
    ^^^^^^^^^^^^^^^^^^^^
  File "/srv/modoboa/env/lib/python3.11/site-packages/django/contrib/postgres/fields/array.py", line 3, in <module>
    from django.contrib.postgres import lookups
  File "/srv/modoboa/env/lib/python3.11/site-packages/django/contrib/postgres/lookups.py", line 4, in <module>
    from .search import SearchVector, SearchVectorExact, SearchVectorField
  File "/srv/modoboa/env/lib/python3.11/site-packages/django/contrib/postgres/search.py", line 1, in <module>
    import psycopg2
  File "/srv/modoboa/env/lib/python3.11/site-packages/psycopg2/__init__.py", line 51, in <module>
    from psycopg2._psycopg import (                     # noqa
SystemError: initialization of _psycopg raised unreported exception

['/srv/modoboa/env/bin/python3', 'manage.py', 'collectstatic', '--noinput'] failed, check your configuration
Traceback (most recent call last):
  File "/srv/modoboa/instance/manage.py", line 22, in <module>
    main()
  File "/srv/modoboa/instance/manage.py", line 18, in main
    execute_from_command_line(sys.argv)
  File "/srv/modoboa/env/lib/python3.11/site-packages/django/core/management/__init__.py", line 419, in execute_from_command_line
    utility.execute()
  File "/srv/modoboa/env/lib/python3.11/site-packages/django/core/management/__init__.py", line 395, in execute
    django.setup()
  File "/srv/modoboa/env/lib/python3.11/site-packages/django/__init__.py", line 24, in setup
    apps.populate(settings.INSTALLED_APPS)
  File "/srv/modoboa/env/lib/python3.11/site-packages/django/apps/registry.py", line 91, in populate
    app_config = AppConfig.create(entry)
                 ^^^^^^^^^^^^^^^^^^^^^^^
  File "/srv/modoboa/env/lib/python3.11/site-packages/django/apps/config.py", line 124, in create
    mod = import_module(mod_path)
          ^^^^^^^^^^^^^^^^^^^^^^^
  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 1206, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1178, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1149, 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 "/srv/modoboa/env/lib/python3.11/site-packages/modoboa/dmarc/apps.py", line 5, in <module>
    from modoboa.dmarc.forms import load_settings
  File "/srv/modoboa/env/lib/python3.11/site-packages/modoboa/dmarc/forms.py", line 9, in <module>
    from modoboa.dmarc.api.v2 import serializers
  File "/srv/modoboa/env/lib/python3.11/site-packages/modoboa/dmarc/api/v2/serializers.py", line 3, in <module>
    from rest_framework import serializers
  File "/srv/modoboa/env/lib/python3.11/site-packages/rest_framework/serializers.py", line 27, in <module>
    from rest_framework.compat import postgres_fields
  File "/srv/modoboa/env/lib/python3.11/site-packages/rest_framework/compat.py", line 26, in <module>
    from django.contrib.postgres import fields as postgres_fields
  File "/srv/modoboa/env/lib/python3.11/site-packages/django/contrib/postgres/fields/__init__.py", line 1, in <module>
    from .array import *  # NOQA
    ^^^^^^^^^^^^^^^^^^^^
  File "/srv/modoboa/env/lib/python3.11/site-packages/django/contrib/postgres/fields/array.py", line 3, in <module>
    from django.contrib.postgres import lookups
  File "/srv/modoboa/env/lib/python3.11/site-packages/django/contrib/postgres/lookups.py", line 4, in <module>
    from .search import SearchVector, SearchVectorExact, SearchVectorField
  File "/srv/modoboa/env/lib/python3.11/site-packages/django/contrib/postgres/search.py", line 1, in <module>
    import psycopg2
  File "/srv/modoboa/env/lib/python3.11/site-packages/psycopg2/__init__.py", line 51, in <module>
    from psycopg2._psycopg import (                     # noqa
SystemError: initialization of _psycopg raised unreported exception

['/srv/modoboa/env/bin/python3', 'manage.py', 'set_default_site', '**WEBSITE URL REMOVED**'] failed, check your configuration
**ERROR:  relation "core_localconfig" does not exist**
LINE 1: UPDATE core_localconfig SET _parameters='{"admin": {"handle_...
               ^

and in the end of installation

CREATE FUNCTION
NOTICE:  relation "admin_quota" does not exist, skipping
DROP TRIGGER
ERROR:  relation "admin_quota" does not exist
ERROR:  relation "admin_quota" does not exist
ERROR:  relation "admin_quota" does not exist

The installer continues and finish but gets me to a Internal Server Error blank page

After a reboot and running

sudo ./run.py --upgrade --debug

I get


NOTICE:  view "dkim" does not exist, skipping
DROP VIEW
Traceback (most recent call last):
  File "/srv/modoboa/instance/manage.py", line 22, in <module>
    main()
  File "/srv/modoboa/instance/manage.py", line 18, in main
    execute_from_command_line(sys.argv)
  File "/srv/modoboa/env/lib/python3.11/site-packages/django/core/management/__init__.py", line 419, in execute_from_command_line
    utility.execute()
  File "/srv/modoboa/env/lib/python3.11/site-packages/django/core/management/__init__.py", line 395, in execute
    django.setup()
  File "/srv/modoboa/env/lib/python3.11/site-packages/django/__init__.py", line 24, in setup
    apps.populate(settings.INSTALLED_APPS)
  File "/srv/modoboa/env/lib/python3.11/site-packages/django/apps/registry.py", line 91, in populate
    app_config = AppConfig.create(entry)
                 ^^^^^^^^^^^^^^^^^^^^^^^
  File "/srv/modoboa/env/lib/python3.11/site-packages/django/apps/config.py", line 124, in create
    mod = import_module(mod_path)
          ^^^^^^^^^^^^^^^^^^^^^^^
  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 1206, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1178, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1149, 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 "/srv/modoboa/env/lib/python3.11/site-packages/modoboa/dmarc/apps.py", line 5, in <module>
    from modoboa.dmarc.forms import load_settings
  File "/srv/modoboa/env/lib/python3.11/site-packages/modoboa/dmarc/forms.py", line 9, in <module>
    from modoboa.dmarc.api.v2 import serializers
  File "/srv/modoboa/env/lib/python3.11/site-packages/modoboa/dmarc/api/v2/serializers.py", line 3, in <module>
    from rest_framework import serializers
  File "/srv/modoboa/env/lib/python3.11/site-packages/rest_framework/serializers.py", line 27, in <module>
    from rest_framework.compat import postgres_fields
  File "/srv/modoboa/env/lib/python3.11/site-packages/rest_framework/compat.py", line 26, in <module>
    from django.contrib.postgres import fields as postgres_fields
  File "/srv/modoboa/env/lib/python3.11/site-packages/django/contrib/postgres/fields/__init__.py", line 1, in <module>
    from .array import *  # NOQA
    ^^^^^^^^^^^^^^^^^^^^
  File "/srv/modoboa/env/lib/python3.11/site-packages/django/contrib/postgres/fields/array.py", line 3, in <module>
    from django.contrib.postgres import lookups
  File "/srv/modoboa/env/lib/python3.11/site-packages/django/contrib/postgres/lookups.py", line 4, in <module>
    from .search import SearchVector, SearchVectorExact, SearchVectorField
  File "/srv/modoboa/env/lib/python3.11/site-packages/django/contrib/postgres/search.py", line 1, in <module>
    import psycopg2
  File "/srv/modoboa/env/lib/python3.11/site-packages/psycopg2/__init__.py", line 51, in <module>
    from psycopg2._psycopg import (                     # noqa
SystemError: initialization of _psycopg raised unreported exception

['/srv/modoboa/env/bin/python3', 'manage.py', 'migrate', '--noinput'] failed, check your configuration
Traceback (most recent call last):
  File "/srv/modoboa/instance/manage.py", line 22, in <module>
    main()
  File "/srv/modoboa/instance/manage.py", line 18, in main
    execute_from_command_line(sys.argv)
  File "/srv/modoboa/env/lib/python3.11/site-packages/django/core/management/__init__.py", line 419, in execute_from_command_line
    utility.execute()
  File "/srv/modoboa/env/lib/python3.11/site-packages/django/core/management/__init__.py", line 395, in execute
    django.setup()
  File "/srv/modoboa/env/lib/python3.11/site-packages/django/__init__.py", line 24, in setup
    apps.populate(settings.INSTALLED_APPS)
  File "/srv/modoboa/env/lib/python3.11/site-packages/django/apps/registry.py", line 91, in populate
    app_config = AppConfig.create(entry)
                 ^^^^^^^^^^^^^^^^^^^^^^^
  File "/srv/modoboa/env/lib/python3.11/site-packages/django/apps/config.py", line 124, in create
    mod = import_module(mod_path)
          ^^^^^^^^^^^^^^^^^^^^^^^
  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 1206, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1178, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1149, 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 "/srv/modoboa/env/lib/python3.11/site-packages/modoboa/dmarc/apps.py", line 5, in <module>
    from modoboa.dmarc.forms import load_settings
  File "/srv/modoboa/env/lib/python3.11/site-packages/modoboa/dmarc/forms.py", line 9, in <module>
    from modoboa.dmarc.api.v2 import serializers
  File "/srv/modoboa/env/lib/python3.11/site-packages/modoboa/dmarc/api/v2/serializers.py", line 3, in <module>
    from rest_framework import serializers
  File "/srv/modoboa/env/lib/python3.11/site-packages/rest_framework/serializers.py", line 27, in <module>
    from rest_framework.compat import postgres_fields
  File "/srv/modoboa/env/lib/python3.11/site-packages/rest_framework/compat.py", line 26, in <module>
    from django.contrib.postgres import fields as postgres_fields
  File "/srv/modoboa/env/lib/python3.11/site-packages/django/contrib/postgres/fields/__init__.py", line 1, in <module>
    from .array import *  # NOQA
    ^^^^^^^^^^^^^^^^^^^^
  File "/srv/modoboa/env/lib/python3.11/site-packages/django/contrib/postgres/fields/array.py", line 3, in <module>
    from django.contrib.postgres import lookups
  File "/srv/modoboa/env/lib/python3.11/site-packages/django/contrib/postgres/lookups.py", line 4, in <module>
    from .search import SearchVector, SearchVectorExact, SearchVectorField
  File "/srv/modoboa/env/lib/python3.11/site-packages/django/contrib/postgres/search.py", line 1, in <module>
    import psycopg2
  File "/srv/modoboa/env/lib/python3.11/site-packages/psycopg2/__init__.py", line 51, in <module>
    from psycopg2._psycopg import (                     # noqa
SystemError: initialization of _psycopg raised unreported exception

['/srv/modoboa/env/bin/python3', 'manage.py', 'load_initial_data', '--admin-username', 'admin'] failed, check your configuration
Traceback (most recent call last):
  File "/srv/modoboa/instance/manage.py", line 22, in <module>
    main()
  File "/srv/modoboa/instance/manage.py", line 18, in main
    execute_from_command_line(sys.argv)
  File "/srv/modoboa/env/lib/python3.11/site-packages/django/core/management/__init__.py", line 419, in execute_from_command_line
    utility.execute()
  File "/srv/modoboa/env/lib/python3.11/site-packages/django/core/management/__init__.py", line 395, in execute
    django.setup()
  File "/srv/modoboa/env/lib/python3.11/site-packages/django/__init__.py", line 24, in setup
    apps.populate(settings.INSTALLED_APPS)
  File "/srv/modoboa/env/lib/python3.11/site-packages/django/apps/registry.py", line 91, in populate
    app_config = AppConfig.create(entry)
                 ^^^^^^^^^^^^^^^^^^^^^^^
  File "/srv/modoboa/env/lib/python3.11/site-packages/django/apps/config.py", line 124, in create
    mod = import_module(mod_path)
          ^^^^^^^^^^^^^^^^^^^^^^^
  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 1206, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1178, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1149, 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 "/srv/modoboa/env/lib/python3.11/site-packages/modoboa/dmarc/apps.py", line 5, in <module>
    from modoboa.dmarc.forms import load_settings
  File "/srv/modoboa/env/lib/python3.11/site-packages/modoboa/dmarc/forms.py", line 9, in <module>
    from modoboa.dmarc.api.v2 import serializers
  File "/srv/modoboa/env/lib/python3.11/site-packages/modoboa/dmarc/api/v2/serializers.py", line 3, in <module>
    from rest_framework import serializers
  File "/srv/modoboa/env/lib/python3.11/site-packages/rest_framework/serializers.py", line 27, in <module>
    from rest_framework.compat import postgres_fields
  File "/srv/modoboa/env/lib/python3.11/site-packages/rest_framework/compat.py", line 26, in <module>
    from django.contrib.postgres import fields as postgres_fields
  File "/srv/modoboa/env/lib/python3.11/site-packages/django/contrib/postgres/fields/__init__.py", line 1, in <module>
    from .array import *  # NOQA
    ^^^^^^^^^^^^^^^^^^^^
  File "/srv/modoboa/env/lib/python3.11/site-packages/django/contrib/postgres/fields/array.py", line 3, in <module>
    from django.contrib.postgres import lookups
  File "/srv/modoboa/env/lib/python3.11/site-packages/django/contrib/postgres/lookups.py", line 4, in <module>
    from .search import SearchVector, SearchVectorExact, SearchVectorField
  File "/srv/modoboa/env/lib/python3.11/site-packages/django/contrib/postgres/search.py", line 1, in <module>
    import psycopg2
  File "/srv/modoboa/env/lib/python3.11/site-packages/psycopg2/__init__.py", line 51, in <module>
    from psycopg2._psycopg import (                     # noqa
SystemError: initialization of _psycopg raised unreported exception

['/srv/modoboa/env/bin/python3', 'manage.py', 'collectstatic', '--noinput'] failed, check your configuration
Traceback (most recent call last):
  File "/srv/modoboa/instance/manage.py", line 22, in <module>
    main()
  File "/srv/modoboa/instance/manage.py", line 18, in main
    execute_from_command_line(sys.argv)
  File "/srv/modoboa/env/lib/python3.11/site-packages/django/core/management/__init__.py", line 419, in execute_from_command_line
    utility.execute()
  File "/srv/modoboa/env/lib/python3.11/site-packages/django/core/management/__init__.py", line 395, in execute
    django.setup()
  File "/srv/modoboa/env/lib/python3.11/site-packages/django/__init__.py", line 24, in setup
    apps.populate(settings.INSTALLED_APPS)
  File "/srv/modoboa/env/lib/python3.11/site-packages/django/apps/registry.py", line 91, in populate
    app_config = AppConfig.create(entry)
                 ^^^^^^^^^^^^^^^^^^^^^^^
  File "/srv/modoboa/env/lib/python3.11/site-packages/django/apps/config.py", line 124, in create
    mod = import_module(mod_path)
          ^^^^^^^^^^^^^^^^^^^^^^^
  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 1206, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1178, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1149, 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 "/srv/modoboa/env/lib/python3.11/site-packages/modoboa/dmarc/apps.py", line 5, in <module>
    from modoboa.dmarc.forms import load_settings
  File "/srv/modoboa/env/lib/python3.11/site-packages/modoboa/dmarc/forms.py", line 9, in <module>
    from modoboa.dmarc.api.v2 import serializers
  File "/srv/modoboa/env/lib/python3.11/site-packages/modoboa/dmarc/api/v2/serializers.py", line 3, in <module>
    from rest_framework import serializers
  File "/srv/modoboa/env/lib/python3.11/site-packages/rest_framework/serializers.py", line 27, in <module>
    from rest_framework.compat import postgres_fields
  File "/srv/modoboa/env/lib/python3.11/site-packages/rest_framework/compat.py", line 26, in <module>
    from django.contrib.postgres import fields as postgres_fields
  File "/srv/modoboa/env/lib/python3.11/site-packages/django/contrib/postgres/fields/__init__.py", line 1, in <module>
    from .array import *  # NOQA
    ^^^^^^^^^^^^^^^^^^^^
  File "/srv/modoboa/env/lib/python3.11/site-packages/django/contrib/postgres/fields/array.py", line 3, in <module>
    from django.contrib.postgres import lookups
  File "/srv/modoboa/env/lib/python3.11/site-packages/django/contrib/postgres/lookups.py", line 4, in <module>
    from .search import SearchVector, SearchVectorExact, SearchVectorField
  File "/srv/modoboa/env/lib/python3.11/site-packages/django/contrib/postgres/search.py", line 1, in <module>
    import psycopg2
  File "/srv/modoboa/env/lib/python3.11/site-packages/psycopg2/__init__.py", line 51, in <module>
    from psycopg2._psycopg import (                     # noqa
SystemError: initialization of _psycopg raised unreported exception

['/srv/modoboa/env/bin/python3', 'manage.py', 'set_default_site', '**WEBSITE ADRESS HERE**] failed, check your configuration
/bin/sh: 1: cannot open /home/USER/apps/modoboa-installer/modoboa_installer/scripts/files/modoboa/dkim_view_postgres.sql: No such file
ERROR:  relation "dkim" does not exist

and later

Reading package lists...
Building dependency tree...
Reading state information...
postfix is already the newest version (3.7.5-2).
postfix-pgsql is already the newest version (3.7.5-2).
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
Traceback (most recent call last):
  File "/srv/modoboa/instance/manage.py", line 22, in <module>
    main()
  File "/srv/modoboa/instance/manage.py", line 18, in main
    execute_from_command_line(sys.argv)
  File "/srv/modoboa/env/lib/python3.11/site-packages/django/core/management/__init__.py", line 419, in execute_from_command_line
    utility.execute()
  File "/srv/modoboa/env/lib/python3.11/site-packages/django/core/management/__init__.py", line 395, in execute
    django.setup()
  File "/srv/modoboa/env/lib/python3.11/site-packages/django/__init__.py", line 24, in setup
    apps.populate(settings.INSTALLED_APPS)
  File "/srv/modoboa/env/lib/python3.11/site-packages/django/apps/registry.py", line 91, in populate
    app_config = AppConfig.create(entry)
                 ^^^^^^^^^^^^^^^^^^^^^^^
  File "/srv/modoboa/env/lib/python3.11/site-packages/django/apps/config.py", line 124, in create
    mod = import_module(mod_path)
          ^^^^^^^^^^^^^^^^^^^^^^^
  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 1206, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1178, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1149, 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 "/srv/modoboa/env/lib/python3.11/site-packages/modoboa/dmarc/apps.py", line 5, in <module>
    from modoboa.dmarc.forms import load_settings
  File "/srv/modoboa/env/lib/python3.11/site-packages/modoboa/dmarc/forms.py", line 9, in <module>
    from modoboa.dmarc.api.v2 import serializers
  File "/srv/modoboa/env/lib/python3.11/site-packages/modoboa/dmarc/api/v2/serializers.py", line 3, in <module>
    from rest_framework import serializers
  File "/srv/modoboa/env/lib/python3.11/site-packages/rest_framework/serializers.py", line 27, in <module>
    from rest_framework.compat import postgres_fields
  File "/srv/modoboa/env/lib/python3.11/site-packages/rest_framework/compat.py", line 26, in <module>
    from django.contrib.postgres import fields as postgres_fields
  File "/srv/modoboa/env/lib/python3.11/site-packages/django/contrib/postgres/fields/__init__.py", line 1, in <module>
    from .array import *  # NOQA
    ^^^^^^^^^^^^^^^^^^^^
  File "/srv/modoboa/env/lib/python3.11/site-packages/django/contrib/postgres/fields/array.py", line 3, in <module>
    from django.contrib.postgres import lookups
  File "/srv/modoboa/env/lib/python3.11/site-packages/django/contrib/postgres/lookups.py", line 4, in <module>
    from .search import SearchVector, SearchVectorExact, SearchVectorField
  File "/srv/modoboa/env/lib/python3.11/site-packages/django/contrib/postgres/search.py", line 1, in <module>
    import psycopg2
  File "/srv/modoboa/env/lib/python3.11/site-packages/psycopg2/__init__.py", line 51, in <module>
    from psycopg2._psycopg import (                     # noqa
SystemError: initialization of _psycopg raised unreported exception

@tonioo

florealcab commented 1 year ago

Oh... it's strange and it's strange too this does not cause a crash of the installer :-O

In my case, I didn't use the "--debug", but I will try in another server to see if I see errors with this option. By the way, my server seems to work perfectly now.

I use mariadb instead of postgresql, may be it's why it's working for me. And also I use apache (configured manually) instead of nginx + uwsgi as my other apps in my server use apache.

samuraikid0 commented 1 year ago

Ah yes, sorry to not mention I used postgresql and nginx Maybe that's what's missing I tag modoboa dev in the post before let's see

Thanks !

florealcab commented 1 year ago

So...

I make new tests in another server. With my config, no errors appears in debug logs, so it's okay for me, phew!

I test it with default config, so with postgresql, nginx and uwsgi and I had the same error than you. I make a last test, changing ONLY postgresql to mysql, and there is no errors in logs.

So the problem is related to postgresql part. As the logs said, it's related to psycopg, the postgresql library for python. I don't understand the error, I let @Toniob see why.

If you want @samuraikid0 you can try with mariadb, I don"t see any bug (in 7 days). Just apply this PR for modoboa to make policyd working once modoboa is installed - edit the file in the venv.

tonioo commented 1 year ago

@florealcab Thanks! I'll merge your PR now and check it to see if I can fix something