Closed Zian502 closed 9 months ago
getsentry/sentry:23.12.1
Collecting sentry-ldap
服务起来了,但是登陆后,报错了。
服务起来了,但是登陆后,报错了。
Oops! Something went wrong It looks like you've hit an issue in our server API. Don't worry though! We use Sentry to monitor Sentry and it's likely we're already looking into this!
If you're daring, you may want to try the following:
Give it a few seconds and reload the page. If all else fails, contact us with more details.
通过查看日志有个错误。
通过查看日志有个错误。
Traceback (most recent call last):
File "/usr/local/lib/python3.10/site-packages/django/core/handlers/exception.py", line 47, in inner
response = get_response(request)
File "/usr/local/lib/python3.10/site-packages/django/core/handlers/base.py", line 181, in _get_response
response = wrapped_callback(request, *callback_args, callback_kwargs)
File "/usr/local/lib/python3.10/site-packages/sentry/../sentry_sdk/integrations/django/views.py", line 84, in sentry_wrapped_callback
return callback(request, *args, *kwargs)
File "/usr/local/lib/python3.10/site-packages/django/views/generic/base.py", line 70, in view
return self.dispatch(request, args, kwargs)
File "/usr/local/lib/python3.10/site-packages/sentry/silo/base.py", line 156, in override
return original_method(*args, kwargs)
File "/usr/local/lib/python3.10/site-packages/django/views/decorators/csrf.py", line 54, in wrapped_view
return view_func(*args, *kwargs)
File "/usr/local/lib/python3.10/site-packages/sentry/web/frontend/base.py", line 390, in dispatch
return self.handle(request, args, kwargs)
File "/usr/local/lib/python3.10/site-packages/django/utils/decorators.py", line 43, in _wrapper
return bound_method(*args, kwargs)
File "/usr/local/lib/python3.10/site-packages/django/views/decorators/cache.py", line 44, in _wrapped_view_func
response = view_func(request, *args, *kwargs)
File "/usr/local/lib/python3.10/site-packages/sentry/web/frontend/auth_organization_login.py", line 87, in handle
response = self.handle_basic_auth(request, organization=organization)
File "/usr/local/lib/python3.10/site-packages/sentry/web/frontend/auth_login.py", line 669, in handle_basic_auth
elif login_form.is_valid():
File "/usr/local/lib/python3.10/site-packages/django/forms/forms.py", line 175, in is_valid
return self.is_bound and not self.errors
File "/usr/local/lib/python3.10/site-packages/django/forms/forms.py", line 170, in errors
self.full_clean()
File "/usr/local/lib/python3.10/site-packages/django/forms/forms.py", line 373, in full_clean
self._clean_form()
File "/usr/local/lib/python3.10/site-packages/django/forms/forms.py", line 400, in _clean_form
cleaned_data = self.clean()
File "/usr/local/lib/python3.10/site-packages/sentry/web/forms/accounts.py", line 133, in clean
self.user_cache = authenticate(username=username, password=password)
File "/usr/local/lib/python3.10/site-packages/django/views/decorators/debug.py", line 42, in sensitive_variables_wrapper
return func(func_args, func_kwargs)
File "/usr/local/lib/python3.10/site-packages/django/contrib/auth/init.py", line 68, in authenticate
for backend, backend_path in _get_backends(return_tuples=True):
File "/usr/local/lib/python3.10/site-packages/django/contrib/auth/init.py", line 27, in _get_backends
backend = load_backend(backend_path)
File "/usr/local/lib/python3.10/site-packages/django/contrib/auth/init.py", line 21, in load_backend
return import_string(path)()
File "/usr/local/lib/python3.10/site-packages/django/utils/module_loading.py", line 17, in import_string
module = import_module(module_path)
File "/usr/local/lib/python3.10/importlib/init.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "
Hey guys, same thing happened to me. Seems that building Dockerfile cache skips enhance-image.sh.
I added ARG CACHEBUST=1 to ./sentry/Dockerfile
example:
ARG SENTRY_IMAGE
ARG CACHEBUST=1
FROM ${SENTRY_IMAGE}
COPY . /usr/src/sentry
RUN if [ -s /usr/src/sentry/enhance-image.sh ]; then \
/usr/src/sentry/enhance-image.sh; \
fi
RUN if [ -s /usr/src/sentry/requirements.txt ]; then \
echo "sentry/requirements.txt is deprecated, use sentry/enhance-image.sh - see https://github.com/getsentry/self-hosted#enhance-sentry-image"; \
pip install -r /usr/src/sentry/requirements.txt; \
fi
Also take note of these changes in ./sentry/sentry.conf.py
Hey guys, same thing happened to me. Seems that building Dockerfile cache skips enhance-image.sh.
I added ARG CACHEBUST=1 to ./sentry/Dockerfile
example:
ARG SENTRY_IMAGE ARG CACHEBUST=1 FROM ${SENTRY_IMAGE} COPY . /usr/src/sentry RUN if [ -s /usr/src/sentry/enhance-image.sh ]; then \ /usr/src/sentry/enhance-image.sh; \ fi RUN if [ -s /usr/src/sentry/requirements.txt ]; then \ echo "sentry/requirements.txt is deprecated, use sentry/enhance-image.sh - see https://github.com/getsentry/self-hosted#enhance-sentry-image"; \ pip install -r /usr/src/sentry/requirements.txt; \ fi
It still doesn't work.
requirements=( 'sentry-ldap'
)
apt-get update apt-get install -y --no-install-recommends build-essential libldap2-dev libsasl2-dev
pip install -i https://pypi.tuna.tsinghua.edu.cn/simple ${requirements[@]}
apt-get purge -y --auto-remove build-essential rm -rf /var/lib/apt/lists/*
mkdir -p /etc/ldap && echo "TLS_CACERT /etc/ssl/certs/ca-certificates.crt" > /etc/ldap/ldap.conf
import ldap from django_auth_ldap.config import LDAPSearch, GroupOfUniqueNamesType
AUTH_LDAP_SERVER_URI = 'xxx' AUTH_LDAP_BIND_DN = 'CN=dev,CN=Users,DC=ldap,DC=cai-inc,DC=com' AUTH_LDAP_BIND_PASSWORD = 'xxx' AUTH_LDAP_USER_QUERY_FIELD = 'username'
AUTH_LDAP_USER_SEARCH = LDAPSearch( 'OU=ALL,OU=政采云有限公司,DC=ldap,DC=cai-inc,DC=com', ldap.SCOPE_SUBTREE, '(mail=%(user)s)', )
AUTH_LDAP_USER_ATTR_MAP = {
'name': 'displayName',
'email': 'mail'
}
AUTH_LDAP_MAIL_VERIFIED = True
AUTH_LDAP_GROUP_SEARCH = LDAPSearch( 'OU=政采云有限公司,DC=ldap,DC=cai-inc,DC=com', ldap.SCOPE_SUBTREE, '(objectClass=groupOfUniqueNames)' )
AUTH_LDAP_GROUP_TYPE = GroupOfUniqueNamesType() AUTH_LDAP_REQUIRE_GROUP = None AUTH_LDAP_DENY_GROUP = None AUTH_LDAP_FIND_GROUP_PERMS = False AUTH_LDAP_CACHE_GROUPS = True AUTH_LDAP_GROUP_CACHE_TIMEOUT = 3600 AUTH_LDAP_SENTRY_SUBSCRIBE_BY_DEFAULT = False # 关键,关闭默认角色
AUTH_LDAP_SENTRY_DEFAULT_ORGANIZATION = 'Zcy' AUTH_LDAP_DEFAULT_SENTRY_ORGANIZATION = 'Zcy' AUTH_LDAP_SENTRY_ORGANIZATION_ROLE_TYPE = 'member' AUTH_LDAP_SENTRY_GROUP_ROLE_MAPPING = { 'owner': ['sysadmins'], 'admin': ['devleads'], 'member': ['developers', 'seniordevelopers'] } AUTH_LDAP_SENTRY_ORGANIZATION_GLOBAL_ACCESS = True
AUTHENTICATION_BACKENDS = AUTHENTICATION_BACKENDS + ( 'sentry-ldap.backend.SentryLdapBackend', )
LOGGING['disable_existing_loggers'] = False import logging logger = logging.getLogger('django_auth_ldap') logger.setLevel(logging.DEBUG)
这个报错原因是什么呀?
问题解决了,感谢大家。
Traceback (most recent call last): File "/usr/local/bin/sentry", line 8, in
sys.exit(main())
File "/usr/local/lib/python3.10/site-packages/sentry/runner/init.py", line 195, in main
func(kwargs)
File "/usr/local/lib/python3.10/site-packages/click/core.py", line 1157, in call
return self.main(args, kwargs)
File "/usr/local/lib/python3.10/site-packages/click/core.py", line 1078, in main
rv = self.invoke(ctx)
File "/usr/local/lib/python3.10/site-packages/click/core.py", line 1688, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File "/usr/local/lib/python3.10/site-packages/click/core.py", line 1434, in invoke
return ctx.invoke(self.callback, ctx.params)
File "/usr/local/lib/python3.10/site-packages/click/core.py", line 783, in invoke
return __callback(args, kwargs)
File "/usr/local/lib/python3.10/site-packages/click/decorators.py", line 33, in new_func
return f(get_current_context(), *args, **kwargs)
File "/usr/local/lib/python3.10/site-packages/sentry/runner/decorators.py", line 28, in inner
configure()
File "/usr/local/lib/python3.10/site-packages/sentry/runner/init.py", line 131, in configure
_configure(ctx, py, yaml, skip_service_validation)
File "/usr/local/lib/python3.10/site-packages/sentry/runner/settings.py", line 144, in configure
hasattr(settings, "INSTALLED_APPS")
File "/usr/local/lib/python3.10/site-packages/django/conf/init.py", line 82, in getattr
self._setup(name)
File "/usr/local/lib/python3.10/site-packages/django/conf/init.py", line 69, in _setup
self._wrapped = Settings(settings_module)
File "/usr/local/lib/python3.10/site-packages/django/conf/init.py", line 170, in init
mod = importlib.import_module(self.SETTINGS_MODULE)
File "/usr/local/lib/python3.10/importlib/init.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "", line 1050, in _gcd_import
File "", line 1027, in _find_and_load
File "", line 1006, in _find_and_load_unlocked
File "", line 688, in _load_unlocked
File "", line 883, in exec_module
File "", line 241, in _call_with_frames_removed
File "/usr/local/lib/python3.10/site-packages/sentry/runner/default_settings.py", line 8, in
populate_module(sys.modules[name])
File "/usr/local/lib/python3.10/site-packages/sentry/runner/importer.py", line 16, in populate_module
_load_settings(SENTRY_CONF_PY, settings=settings_mod)
File "/usr/local/lib/python3.10/site-packages/sentry/runner/importer.py", line 27, in _load_settings
exec(source_file.read(), conf.dict)
File "", line 335, in
ModuleNotFoundError: No module named 'ldap'
Error in install/set-up-and-migrate-database.sh:12.
'$dcr web upgrade' exited with status 1