diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index b6279bd440d03977271dcf8fa08e6cb8bd82b7bc..04d07ce46d214d42450313ff381ef6d76c7302d0 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -11,7 +11,7 @@ include: # For jobs that run backend scripts directly .backend-setup: - image: registry.gitlab.com/teklia/arkindex/backend/base:bookworm + image: registry.gitlab.teklia.com/arkindex/backend/base:gitlab-teklia cache: paths: @@ -19,8 +19,8 @@ include: before_script: # Custom line to install our own deps from Git using GitLab CI credentials - - "pip install -e git+https://gitlab-ci-token:${CI_JOB_TOKEN}@gitlab.com/teklia/arkindex/transkribus#egg=transkribus-client" - - "pip install -e git+https://gitlab-ci-token:${CI_JOB_TOKEN}@gitlab.com/teklia/arkindex/license#egg=teklia-license" + - "pip install -e git+https://gitlab-ci-token:${CI_JOB_TOKEN}@gitlab.teklia.com/arkindex/transkribus#egg=transkribus-client" + - "pip install -e git+https://gitlab-ci-token:${CI_JOB_TOKEN}@gitlab.teklia.com/arkindex/license#egg=teklia-license" - pip install -r tests-requirements.txt - "echo 'database: {host: postgres, port: 5432}\npublic_hostname: http://ci.arkindex.localhost' > $CONFIG_PATH" @@ -245,7 +245,7 @@ sentry-release: release-notes: stage: deploy - image: registry.gitlab.com/teklia/devops:latest + image: registry.gitlab.teklia.com/infra/devops:latest rules: - if: '$CI_COMMIT_TAG && $CI_COMMIT_TAG !~ /^base-.*/' @@ -257,7 +257,7 @@ release-notes: bump-python-deps: stage: deploy - image: registry.gitlab.com/teklia/devops:latest + image: registry.gitlab.teklia.com/infra/devops:latest only: - schedules diff --git a/Dockerfile b/Dockerfile index a93f5b71f650cc833c768f5d2f6b1510c23f3646..d9ec2f56dee1b9290ff002ed02cc538b09644309 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,20 +1,22 @@ -FROM registry.gitlab.com/teklia/arkindex/backend/base:bookworm as build +FROM registry.gitlab.teklia.com/arkindex/backend/base:gitlab-teklia as build RUN mkdir build ADD . build RUN cd build && python3 setup.py sdist -FROM registry.gitlab.com/teklia/arkindex/backend/base:bookworm +FROM registry.gitlab.teklia.com/arkindex/backend/base:gitlab-teklia ARG TRANSKRIBUS_BRANCH=master -ARG TRANSKRIBUS_ID=11180199 +ARG TRANSKRIBUS_ID=63 ARG LICENSE_BRANCH=master -ARG LICENSE_ID=45943500 -ARG GITLAB_TOKEN="gaFM7LRa9zy9QMowcUhx" +ARG LICENSE_ID=37 + +# Auth token expires on 01/07/2024 +ARG GITLAB_TOKEN="glpat-3sBZPFgkZbqJxfSqjcAa" # Install transkribus-client from private repo RUN \ mkdir /tmp/transkribus && \ - wget --header "PRIVATE-TOKEN: $GITLAB_TOKEN" https://gitlab.com/api/v4/projects/$TRANSKRIBUS_ID/repository/archive.tar.gz?sha=$TRANSKRIBUS_BRANCH -O /tmp/transkribus/archive.tar.gz && \ + wget --header "PRIVATE-TOKEN: $GITLAB_TOKEN" https://gitlab.teklia.com/api/v4/projects/$TRANSKRIBUS_ID/repository/archive.tar.gz?sha=$TRANSKRIBUS_BRANCH -O /tmp/transkribus/archive.tar.gz && \ tar --strip-components=1 -xvf /tmp/transkribus/archive.tar.gz -C /tmp/transkribus && \ cd /tmp/transkribus && pip install --disable-pip-version-check --no-cache-dir --quiet . && \ rm -rf /tmp/transkribus @@ -22,7 +24,7 @@ RUN \ # Install teklia-license from private repo RUN \ mkdir /tmp/teklia-license && \ - wget --header "PRIVATE-TOKEN: $GITLAB_TOKEN" https://gitlab.com/api/v4/projects/$LICENSE_ID/repository/archive.tar.gz?sha=$LICENSE_BRANCH -O /tmp/teklia-license.tar.gz && \ + wget --header "PRIVATE-TOKEN: $GITLAB_TOKEN" https://gitlab.teklia.com/api/v4/projects/$LICENSE_ID/repository/archive.tar.gz?sha=$LICENSE_BRANCH -O /tmp/teklia-license.tar.gz && \ tar --strip-components=1 -xvf /tmp/teklia-license.tar.gz -C /tmp/teklia-license && \ cd /tmp/teklia-license && pip install --disable-pip-version-check --no-cache-dir --quiet . && \ rm -rf /tmp/teklia-license diff --git a/Dockerfile.binary b/Dockerfile.binary index dfb76b1ed2a49048580fbc0fb086364151ef7e1c..78e741af1ffb4c5f76f70d2274f020eeecc1101c 100644 --- a/Dockerfile.binary +++ b/Dockerfile.binary @@ -5,10 +5,12 @@ RUN apt-get update && apt-get install --no-install-recommends -y build-essential RUN pip install nuitka ARG TRANSKRIBUS_BRANCH=master -ARG TRANSKRIBUS_ID=11180199 +ARG TRANSKRIBUS_ID=63 ARG LICENSE_BRANCH=master -ARG LICENSE_ID=45943500 -ARG GITLAB_TOKEN="gaFM7LRa9zy9QMowcUhx" +ARG LICENSE_ID=37 + +# Auth token expires on 01/07/2024 +ARG GITLAB_TOKEN="glpat-3sBZPFgkZbqJxfSqjcAa" # We build in /usr/share because Django will try to load some files relative to that path # once executed in the binary (management commands, ...) @@ -22,14 +24,14 @@ ADD requirements.txt /tmp/requirements-arkindex.txt # Install transkribus-client from private repo RUN \ mkdir /tmp/transkribus && \ - wget --header "PRIVATE-TOKEN: $GITLAB_TOKEN" https://gitlab.com/api/v4/projects/$TRANSKRIBUS_ID/repository/archive.tar.gz?sha=$TRANSKRIBUS_BRANCH -O /tmp/transkribus.tar.gz && \ + wget --header "PRIVATE-TOKEN: $GITLAB_TOKEN" https://gitlab.teklia.com/api/v4/projects/$TRANSKRIBUS_ID/repository/archive.tar.gz?sha=$TRANSKRIBUS_BRANCH -O /tmp/transkribus.tar.gz && \ tar --strip-components=1 -xvf /tmp/transkribus.tar.gz -C /tmp/transkribus && \ mv /tmp/transkribus/transkribus /usr/share # Install teklia-license from private repo RUN \ mkdir /tmp/teklia-license && \ - wget --header "PRIVATE-TOKEN: $GITLAB_TOKEN" https://gitlab.com/api/v4/projects/$LICENSE_ID/repository/archive.tar.gz?sha=$LICENSE_BRANCH -O /tmp/teklia-license.tar.gz && \ + wget --header "PRIVATE-TOKEN: $GITLAB_TOKEN" https://gitlab.teklia.com/api/v4/projects/$LICENSE_ID/repository/archive.tar.gz?sha=$LICENSE_BRANCH -O /tmp/teklia-license.tar.gz && \ tar --strip-components=1 -xvf /tmp/teklia-license.tar.gz -C /tmp/teklia-license && \ mv /tmp/teklia-license/teklia_license /usr/share && \ cp /tmp/teklia-license/requirements.txt /tmp/requirements-license-arkindex.txt @@ -61,7 +63,7 @@ RUN python -m nuitka \ arkindex/manage.py # Start over from a clean setup -FROM registry.gitlab.com/teklia/arkindex/backend/base:bookworm as build +FROM registry.gitlab.teklia.com/arkindex/backend/base:gitlab-teklia as build # Import files from compilation RUN mkdir /usr/share/arkindex diff --git a/Makefile b/Makefile index 5032613e54cf5cfee27de347b15c4a3dbf044fa2..93765fb75ccd372590a86a42e4535f0983458793 100644 --- a/Makefile +++ b/Makefile @@ -1,5 +1,5 @@ ROOT_DIR:=$(shell dirname $(realpath $(lastword $(MAKEFILE_LIST)))) -IMAGE_TAG=registry.gitlab.com/teklia/arkindex/backend +IMAGE_TAG=registry.gitlab.teklia.com/arkindex/backend .PHONY: all release diff --git a/README.md b/README.md index 03c9488220f460b8563565954340b78f4b2a72ae..b21486dcd64965881e03ff9ff8ef0e10aab7d4c5 100644 --- a/README.md +++ b/README.md @@ -1,11 +1,11 @@ Backend for Historical Manuscripts Indexing =========================================== -[](https://gitlab.com/teklia/arkindex/backend/commits/master) +[](https://gitlab.teklia.com/arkindex/backend/commits/master) ## Requirements -* Clone of the [architecture](https://gitlab.com/teklia/arkindex/architecture) +* Clone of the [architecture](https://gitlab.teklia.com/arkindex/architecture) * Git * Make * Python 3.6+ @@ -15,13 +15,13 @@ Backend for Historical Manuscripts Indexing ## Dev Setup ``` -git clone git@gitlab.com:arkindex/backend.git +git clone git@gitlab.teklia.com:arkindex/backend.git cd backend mkvirtualenv ark -a . pip install -e .[test] ``` -When the [architecture](https://gitlab.com/teklia/arkindex/architecture) is running locally to provide required services: +When the [architecture](https://gitlab.teklia.com/arkindex/architecture) is running locally to provide required services: ``` arkindex/manage.py migrate @@ -47,7 +47,7 @@ The line that sets the PDF policy is `<policy domain="coder" rights="none" patte Arkindex uses OAuth to let a user connect their GitLab account(s) and register Git repositories. In local development, you will need to register Arkindex as a GitLab OAuth application for it to work. -Go to GitLab's [Applications settings](https://gitlab.com/profile/applications) and create a new application with the `api` scope and add the following callback URIs: +Go to GitLab's [Applications settings](https://gitlab.teklia.com/profile/applications) and create a new application with the `api` scope and add the following callback URIs: ``` http://127.0.0.1:8000/api/v1/oauth/providers/gitlab/callback/ diff --git a/arkindex/documents/api/elements.py b/arkindex/documents/api/elements.py index b4945da22bc06582ab113de03a33c4e8c9e8042a..f62c30678518c3bf5bcbde60adda47a0048c292c 100644 --- a/arkindex/documents/api/elements.py +++ b/arkindex/documents/api/elements.py @@ -1165,14 +1165,14 @@ class ElementChildren(ElementsListBase): # Let `self.get_filters` handle filtering optimisations if self.clean_params.get('order', 'position').lower() == 'position': # This condition is necessary because when ordering by position ('paths__ordering') - # we run into this bug https://gitlab.com/teklia/arkindex/backend/-/issues/769 and unless + # we run into this bug https://gitlab.teklia.com/arkindex/backend/-/issues/769 and unless # the ordering is also used in the .distinct(), this leads to some results being # "cut off" from the response. For example, if you have 5 distinct elements, but two # of these elements have multiple paths with different orderings within the same parent, # the DISTINCT will work as expected during the COUNT query, and find 5 elements; # however when next the elements are selected, the path ordering is used in the # SELECT query which triggers the "duplicating" bug - # (https://gitlab.com/teklia/arkindex/backend/-/issues/76).This SELECT would return 7 elements + # (https://gitlab.teklia.com/arkindex/backend/-/issues/76).This SELECT would return 7 elements # (2 duplicates) but the previous result from the COUNT would mean that only 5 of these # 7 elements would get returned, and some elements would therefore (randomly) be missing # from the results. Adding the 'paths__ordering' to the .distinct() here forces the diff --git a/arkindex/documents/management/commands/bootstrap.py b/arkindex/documents/management/commands/bootstrap.py index c7f1a2806d29f65d6c1c7b2bd7d3a241e4d26084..40235e163826c475f3cc8ae770e88c01a4c96545 100644 --- a/arkindex/documents/management/commands/bootstrap.py +++ b/arkindex/documents/management/commands/bootstrap.py @@ -29,7 +29,7 @@ PONOS_FARM_NAME = 'Bootstrap farm' PONOS_FARM_SEED = "b12868101dab84984481741663d809d2393784894d6e807ceee0bd95051bf971" IMPORT_WORKER_VERSION_ID = 'f2bb8dd7-55e9-49ae-9bd9-b1d2e5d491b9' IMPORT_WORKER_SLUG = 'file_import' -IMPORT_WORKER_REPO = 'https://gitlab.com/teklia/arkindex/tasks' +IMPORT_WORKER_REPO = 'https://gitlab.teklia.com/arkindex/tasks' IMPORT_WORKER_REVISION_MESSAGE = 'File import worker bootstrap' IMPORT_WORKER_REVISION_AUTHOR = 'Dev Bootstrap' ADMIN_API_TOKEN = "deadbeefTestToken" diff --git a/arkindex/documents/managers.py b/arkindex/documents/managers.py index 7cedd13bd45f449eb4e480187fe2cf206cdec15d..b4127e56b317258692c7dcc6bb74ef5db2f081bc 100644 --- a/arkindex/documents/managers.py +++ b/arkindex/documents/managers.py @@ -145,7 +145,7 @@ class ElementManager(models.Manager): This uses a single raw SQL query to use row numbers, instead of the ordering numeric values, to avoid issues with duplicated or missing orderings. - Performance tests are available at https://gitlab.com/teklia/arkindex/backend/-/issues/1011 + Performance tests are available at https://gitlab.teklia.com/arkindex/backend/-/issues/1011 * The elt_path subquery lists all paths for the current element. * The main query lists all neighbors for each path, retrieve the previous and next elements using diff --git a/arkindex/documents/migrations/0004_initial.py b/arkindex/documents/migrations/0004_initial.py index 5e8606e97b361ae6ca349d0d2388cfe1b8d514ab..e3edacc5024629df5295f3969887f5603f45cd4b 100644 --- a/arkindex/documents/migrations/0004_initial.py +++ b/arkindex/documents/migrations/0004_initial.py @@ -21,7 +21,7 @@ class Migration(migrations.Migration): # On freshly created databases, this applies immediately. On existing databases, this will only have an effect after # an autovacuum completes or after an administrator runs `ANALYZE documents_element`. # - # See https://gitlab.com/teklia/arkindex/backend/-/issues/1309#note_1401556847 for context. + # See https://gitlab.teklia.com/arkindex/backend/-/issues/1309#note_1401556847 for context. migrations.RunSQL( "CREATE STATISTICS element_type_implies_corpus (dependencies) ON type_id, corpus_id FROM documents_element", "DROP STATISTICS element_type_implies_corpus", diff --git a/arkindex/documents/tests/test_children_elements.py b/arkindex/documents/tests/test_children_elements.py index ca09a405bebde4563d029c828cc76a2fff2851d8..6730e4a58dbf0758c9a5003d65cd98024e946321 100644 --- a/arkindex/documents/tests/test_children_elements.py +++ b/arkindex/documents/tests/test_children_elements.py @@ -503,7 +503,7 @@ class TestChildrenElements(FixtureAPITestCase): ) self.assertEqual(response.status_code, status.HTTP_200_OK) # col1, cell_b and cell_c are duplicated due to a bug in Element.objects.get_descending - # See https://gitlab.com/teklia/arkindex/backend/-/issues/769 + # See https://gitlab.teklia.com/arkindex/backend/-/issues/769 self.assertCountEqual([item['id'] for item in response.json()['results']], [ str(table_1.id), str(table_2.id), diff --git a/arkindex/documents/tests/test_element_paths_api.py b/arkindex/documents/tests/test_element_paths_api.py index 27dca725a1cd3977287329493718dfd7b18b3b05..02b13b7166bca45a4e6b618fb97b7c762fbd3c38 100644 --- a/arkindex/documents/tests/test_element_paths_api.py +++ b/arkindex/documents/tests/test_element_paths_api.py @@ -237,7 +237,7 @@ class TestElementsAPI(FixtureAPITestCase): self.assertCountEqual( # cell_b and cell_c are duplicated due to a bug in Element.objects.get_descending - # See https://gitlab.com/teklia/arkindex/backend/-/issues/769 + # See https://gitlab.teklia.com/arkindex/backend/-/issues/769 list(Element.objects.get_descending(table.id).order_by().distinct('id')), [cell_a, cell_b, cell_c, cell_d, col1, col2, row1, row2], ) diff --git a/arkindex/documents/tests/test_metadata.py b/arkindex/documents/tests/test_metadata.py index 1da1c40b7c769d340d152b91860e0c7a80b6876d..ec57c1799eb4b6fa8dbc54139e86991c303f652c 100644 --- a/arkindex/documents/tests/test_metadata.py +++ b/arkindex/documents/tests/test_metadata.py @@ -1280,7 +1280,7 @@ class TestMetaData(FixtureAPITestCase): self.client.force_login(self.superuser) response = self.client.post( reverse('api:element-metadata', kwargs={'pk': str(self.vol.id)}), - data={'type': 'url', 'name': 'blah', 'value': 'git+https://gitlab.com/teklia/arkindex/backend.git'} + data={'type': 'url', 'name': 'blah', 'value': 'git+https://gitlab.teklia.com/arkindex/backend.git'} ) self.assertEqual(response.status_code, status.HTTP_400_BAD_REQUEST) self.assertDictEqual(response.json(), {'value': ['The value of a URL metadata must be a valid HTTP or HTTPS URL.']}) diff --git a/arkindex/project/config.py b/arkindex/project/config.py index cd7621495aad4d5e0d3699438bd4a123573934bf..b00c0ae3e02eaf21790cefeda2ef3c10d2bfe93e 100644 --- a/arkindex/project/config.py +++ b/arkindex/project/config.py @@ -182,7 +182,7 @@ def get_settings_parser(base_dir): ponos_parser.add_option('artifact_max_size', type=int, default=5 * 1024**3) docker_parser = parser.add_subparser('docker', default={}) - docker_parser.add_option('tasks_image', type=str, default='registry.gitlab.com/teklia/arkindex/tasks') + docker_parser.add_option('tasks_image', type=str, default='registry.gitlab.teklia.com/arkindex/tasks') sentry_parser = parser.add_subparser('sentry', default={}) sentry_parser.add_option('dsn', type=str, default=None) diff --git a/arkindex/project/tests/config_samples/defaults.yaml b/arkindex/project/tests/config_samples/defaults.yaml index a3c280ca6f91e68a7957f0bdc0ccba37d43e631f..2abdc4ffd7be6bb1e33cae444be4ab4b219e8300 100644 --- a/arkindex/project/tests/config_samples/defaults.yaml +++ b/arkindex/project/tests/config_samples/defaults.yaml @@ -28,7 +28,7 @@ database: replica: null user: devuser docker: - tasks_image: registry.gitlab.com/teklia/arkindex/tasks + tasks_image: registry.gitlab.teklia.com/arkindex/tasks doorbell: appkey: null id: null diff --git a/arkindex/project/tests/config_samples/override.yaml b/arkindex/project/tests/config_samples/override.yaml index d96b97c0d4708ff93a5f67ac8a59b14c4cf7b747..3993e1e1f585b92f9a434f6842dfca86f38e45ef 100644 --- a/arkindex/project/tests/config_samples/override.yaml +++ b/arkindex/project/tests/config_samples/override.yaml @@ -34,7 +34,7 @@ database: user: postgres user: littlebobbytables docker: - tasks_image: registry.gitlab.com/teklia/arkindex/stonks + tasks_image: registry.gitlab.teklia.com/arkindex/stonks doorbell: appkey: doorbellappkey id: '123456' diff --git a/arkindex/users/models.py b/arkindex/users/models.py index 7b020c114c2b79dd18882c931868c913bf7dedd1..f4f4fbd98bbf76d6b9371c81b49f19e7282c1564 100644 --- a/arkindex/users/models.py +++ b/arkindex/users/models.py @@ -127,7 +127,7 @@ class User(AbstractBaseUser): def has_scope(self, scope): assert isinstance(scope, Scope), 'Scope should be from the Scope enum' # TODO: Could be optimized in a way similar to Process.get_state() - # See https://gitlab.com/teklia/arkindex/ponos/-/blob/e5989f3e1dd1f6d7d93ba940b7ed2c5471ddd34f/ponos/models.py#L370 + # See https://gitlab.teklia.com/arkindex/ponos/-/blob/e5989f3e1dd1f6d7d93ba940b7ed2c5471ddd34f/ponos/models.py#L370 return self.user_scopes.filter(scope=scope).exists() @property diff --git a/requirements.txt b/requirements.txt index 1909f304da83cfc87a6ec40ae19131f6dab4d700..abdac2bff44e4cfe97a40a6f17163d11d72c365a 100644 --- a/requirements.txt +++ b/requirements.txt @@ -19,9 +19,9 @@ sentry-sdk==1.19.1 setproctitle==1.3.2 SolrClient==0.3.1 teklia-license==0.1.1 -git+https://gitlab.com/teklia/arkindex/license.git#egg=teklia-license +git+https://gitlab.teklia.com/arkindex/license.git#egg=teklia-license teklia-toolbox==0.1.3 tenacity==8.2.2 transkribus-client>=0.1.1 -git+https://gitlab.com/teklia/arkindex/transkribus.git#egg=transkribus-client +git+https://gitlab.teklia.com/arkindex/transkribus.git#egg=transkribus-client uritemplate==4.1.1