diff --git a/core/common/views.py b/core/common/views.py index 23bad7df..91efaadd 100644 --- a/core/common/views.py +++ b/core/common/views.py @@ -240,8 +240,17 @@ def get_sort_attributes(self): current_result = None if field in ['score', '_score', 'best_match', 'best match']: current_result = {'_score': order_details} - if self.is_concept_document() and field == 'name': + if field == 'name': current_result = {'_name': order_details} + if field == 'id' and self.is_source_child_document_model(): + current_result = {'id_lowercase': order_details} + if field in ['id', 'mnemonic'] and ( + self.is_org_document() or self.is_concept_container_document_model() or + self.is_repo_document_model() + ): + current_result = {'_mnemonic': order_details} + if field in ['username', 'id'] and self.is_user_document(): + current_result = {'_username': order_details} if self.is_valid_sort(field): current_result = {field: order_details} if current_result is not None: @@ -466,6 +475,10 @@ def is_user_document(self): from core.users.documents import UserProfileDocument return self.document_model == UserProfileDocument + def is_org_document(self): + from core.orgs.documents import OrganizationDocument + return self.document_model == OrganizationDocument + def is_url_registry_document(self): from core.url_registry.documents import URLRegistryDocument return self.document_model == URLRegistryDocument @@ -475,9 +488,7 @@ def is_concept_document(self): return self.document_model == ConceptDocument def is_owner_document_model(self): - from core.orgs.documents import OrganizationDocument - from core.users.documents import UserProfileDocument - return self.document_model in [UserProfileDocument, OrganizationDocument] + return self.is_org_document() or self.is_user_document() def is_source_child_document_model(self): from core.concepts.documents import ConceptDocument diff --git a/core/settings.py b/core/settings.py index 36ac976c..ef57a3fa 100644 --- a/core/settings.py +++ b/core/settings.py @@ -555,10 +555,10 @@ DEFAULT_LOCALES_REPO_URI = os.environ.get('DEFAULT_LOCALES_REPO_URI', '/orgs/ISO/sources/iso639-1/') # keyCloak/OIDC Provider settings -OIDC_SERVER_URL = os.environ.get('OIDC_SERVER_URL', '') +OIDC_SERVER_URL = os.environ.get('OIDC_SERVER_URL', 'http://localhost:8080') OIDC_RP_CLIENT_ID = '' # only needed a defined var in mozilla_django_oidc OIDC_RP_CLIENT_SECRET = '' # only needed a defined var in mozilla_django_oidc -OIDC_SERVER_INTERNAL_URL = os.environ.get('OIDC_SERVER_INTERNAL_URL', '') or OIDC_SERVER_URL +OIDC_SERVER_INTERNAL_URL = os.environ.get('OIDC_SERVER_INTERNAL_URL', 'http://host.docker.internal:8080') or OIDC_SERVER_URL OIDC_REALM = os.environ.get('OIDC_REALM', 'ocl') OIDC_OP_AUTHORIZATION_ENDPOINT = f'{OIDC_SERVER_URL}/realms/{OIDC_REALM}/protocol/openid-connect/auth' OIDC_OP_REGISTRATION_ENDPOINT = f'{OIDC_SERVER_URL}/realms/{OIDC_REALM}/protocol/openid-connect/registrations' diff --git a/docker-compose.yml b/docker-compose.yml index a9a92a72..285f0990 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -22,7 +22,7 @@ services: volumes: - redis-data:/bitnami/redis/data api: - image: openconceptlab/oclapi2:${ENVIRONMENT-production} + build: . restart: "always" ports: - 8000:8000 @@ -68,7 +68,7 @@ services: healthcheck: test: "curl --silent --fail http://localhost:3500/ || exit 1" celery: - image: openconceptlab/oclapi2:${ENVIRONMENT-production} + build: . command: ["bash", "-c", "CELERY_WORKER_NAME=default ./start_celery_worker.sh -P prefork -Q default -c 2"] restart: "always" healthcheck: @@ -100,7 +100,7 @@ services: - ERRBIT_URL - ERRBIT_KEY celery_indexing: - image: openconceptlab/oclapi2:${ENVIRONMENT-production} + build: . command: ["bash", "-c", "CELERY_WORKER_NAME=indexing ./start_celery_worker.sh -P prefork -Q indexing -c 2"] restart: "always" healthcheck: @@ -112,8 +112,8 @@ services: - ERRBIT_URL - ERRBIT_KEY celery_concurrent: - image: openconceptlab/oclapi2:${ENVIRONMENT-production} - command: ["bash", "-c", "CELERY_WORKER_NAME=concurrent ./start_celery_worker.sh -P prefork -Q concurrent -c 2"] + build: . + command: ["bash", "-c", "CELERY_WORKER_NAME=concurrent ./start_celery_worker.sh -P prefork -Q concurrent -c 4"] restart: "always" healthcheck: test: ["CMD-SHELL", "-c", "CELERY_WORKER_NAME=concurrent ./ping_celery_worker.sh"] @@ -154,7 +154,7 @@ services: volumes: - upload-data:/code/uploads celery_bulk_import_root: - image: openconceptlab/oclapi2:${ENVIRONMENT-production} + build: . command: ["bash", "-c", "CELERY_WORKER_NAME=bulk_import_root ./start_celery_worker.sh -Q bulk_import_root -c 1"] restart: "always" healthcheck: