Skip to content

Commit

Permalink
Add encrypted_size migration to DCS
Browse files Browse the repository at this point in the history
  • Loading branch information
TheByronHimes committed Jan 22, 2025
1 parent b70a914 commit 4b80c35
Show file tree
Hide file tree
Showing 13 changed files with 1,011 additions and 3 deletions.
30 changes: 30 additions & 0 deletions services/dcs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -299,6 +299,36 @@ The service requires the following configuration parameters:
```


- **`db_version_collection`** *(string, required)*: The name of the collection containing DB version information for this service.


Examples:

```json
"ifrsDbVersions"
```


- **`migration_wait_sec`** *(integer, required)*: The number of seconds to wait before checking the DB version again.


Examples:

```json
5
```


```json
30
```


```json
180
```


- **`drs_server_uri`** *(string, required)*: The base of the DRS URI to access DRS objects. Has to start with 'drs://' and end with '/'.


Expand Down
20 changes: 20 additions & 0 deletions services/dcs/config_schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -330,6 +330,24 @@
"title": "Db Name",
"type": "string"
},
"db_version_collection": {
"description": "The name of the collection containing DB version information for this service",
"examples": [
"ifrsDbVersions"
],
"title": "Db Version Collection",
"type": "string"
},
"migration_wait_sec": {
"description": "The number of seconds to wait before checking the DB version again",
"examples": [
5,
30,
180
],
"title": "Migration Wait Sec",
"type": "integer"
},
"drs_server_uri": {
"description": "The base of the DRS URI to access DRS objects. Has to start with 'drs://' and end with '/'.",
"examples": [
Expand Down Expand Up @@ -586,6 +604,8 @@
"kafka_servers",
"db_connection_str",
"db_name",
"db_version_collection",
"migration_wait_sec",
"drs_server_uri",
"ekss_base_url",
"presigned_url_expires_after",
Expand Down
2 changes: 2 additions & 0 deletions services/dcs/dev_config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -39,5 +39,7 @@ unstaged_download_collection: unstagedDownloadRequested
files_to_delete_topic: file-deletions
file_deleted_event_topic: file-downloads
file_deleted_event_type: file_deleted
db_version_collection: dcsDbVersions
migration_wait_sec: 10
auth_key: "{}"
log_level: INFO
2 changes: 2 additions & 0 deletions services/dcs/example_config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ cors_allowed_methods: []
cors_allowed_origins: []
db_connection_str: '**********'
db_name: dev
db_version_collection: dcsDbVersions
docs_url: /docs
download_served_event_topic: file-downloads
download_served_event_type: download_served
Expand All @@ -45,6 +46,7 @@ kafka_ssl_password: ''
log_format: null
log_level: INFO
log_traceback: true
migration_wait_sec: 10
object_storages:
test:
bucket: outbox
Expand Down
2 changes: 1 addition & 1 deletion services/dcs/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@ info:
\ Object Storage. \n\nThis is an implementation of the DRS standard from the Global\
\ Alliance for Genomics and Health, please find more information at: https://github.com/ga4gh/data-repository-service-schemas"
title: Download Controller Service
version: 4.0.0
version: 3.0.0
openapi: 3.1.0
paths:
/health:
Expand Down
4 changes: 2 additions & 2 deletions services/dcs/src/dcs/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
from hexkit.config import config_from_yaml
from hexkit.log import LoggingConfig
from hexkit.providers.akafka import KafkaConfig
from hexkit.providers.mongodb import MongoDbConfig
from pydantic import Field

from dcs.adapters.inbound.event_sub import (
Expand All @@ -33,6 +32,7 @@
from dcs.adapters.outbound.daopub import OutboxDaoConfig
from dcs.adapters.outbound.event_pub import EventPubTranslatorConfig
from dcs.core.data_repository import DataRepositoryConfig
from dcs.migration_logic import MigrationConfig


class WorkOrderTokenConfig(AuthConfig):
Expand All @@ -54,7 +54,7 @@ class Config(
DrsApiConfig,
WorkOrderTokenConfig,
DataRepositoryConfig,
MongoDbConfig,
MigrationConfig,
KafkaConfig,
EventPubTranslatorConfig,
EventSubTranslatorConfig,
Expand Down
34 changes: 34 additions & 0 deletions services/dcs/src/dcs/migration_logic/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# Copyright 2021 - 2024 Universität Tübingen, DKFZ, EMBL, and Universität zu Köln
# for the German Human Genome-Phenome Archive (GHGA)
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
"""Temporary database migration logic, copied from IFRS until added to hexkit"""

from ._manager import (
MigrationConfig,
MigrationManager,
MigrationMap,
MigrationStepError,
)
from ._utils import Document, MigrationDefinition, Reversible, validate_doc

__all__ = [
"Document",
"MigrationConfig",
"MigrationDefinition",
"MigrationManager",
"MigrationMap",
"MigrationStepError",
"Reversible",
"validate_doc",
]
Loading

0 comments on commit 4b80c35

Please sign in to comment.