ifrs

Ifrs Docker Image

该镜像提供内部文件注册服务,管理S3兼容对象存储中的文件元数据(存储于MongoDB),通过事件与其他服务通信,无REST API端点。

下载次数: 0状态:社区镜像维护者:ghga仓库类型:镜像最近更新:
下载命令
点击查看

Internal File Registry Service

This service acts as a registry for the internal location and representation of files.

The service ships as the container image ghga/ifrs and the Helm chart ifrs.

Description

This service provides functionality to administer files stored in an S3-compatible object storage. All file-related metadata is stored in an internal mongodb database, owned and controlled by this service. It exposes no REST API endpoints and communicates with other services via events.

Events consumed

files_to_register

This event signals that there is a file to register in the database. The file-related metadata from this event gets saved in the database and the file is moved from the incoming staging bucket to the permanent storage.

files_to_stage

This event signals that there is a file that needs to be staged for download. The file is then copied from the permanent storage to the outbox for the actual download.

Events published

file_internally_registered

This event is published after a file was registered in the database. It contains all the file-related metadata that was provided by the files_to_register event.

file_staged_for_download

This event is published after a file was successfully staged to the outbox.

Usage

The executable ifrs takes one of these commands:

  • consume-events runs an event consumer listening to the configured topics
  • publish-events publishes pending events
  • migrate-db runs the database migrations

Running a service shows how to start, build and deploy it.

Configuration

The settings take the prefix ifrs: the environment variable IFRS_HOST sets host, and the YAML file is .ifrs.yaml. example_config.yaml holds a complete set to adapt, and Configuration says where the service looks for them.

Parameters

The service requires the following configuration parameters:

  • enable_opentelemetry (boolean): If set to true, this will run necessary setup code.If set to false, no setup code is run, which leaves tracing disabled. Default: false.

  • otel_trace_sampling_rate (number): Determines which proportion of spans should be sampled. A value of 1.0 means all and is equivalent to the previous behaviour. Setting this to 0 will result in no spans being sampled, but this does not automatically set enable_opentelemetry to False. Minimum: 0. Maximum: 1. Default: 1.0.

  • log_level (string): The minimum log level to capture. Must be one of: "CRITICAL", "ERROR", "WARNING", "INFO", "DEBUG", or "TRACE". Default: "INFO".

  • service_name (string): Default: "ifrs".

  • service_instance_id (string, required): A string that uniquely identifies this instance across all instances of this service. A globally unique Kafka client ID will be created by concatenating the service_name and the service_instance_id.

    Examples:

    json
    "germany-bw-instance-001"
    
  • log_format: If set, will replace JSON formatting with the specified string format. If not set, has no effect. In addition to the standard attributes, the following can also be specified: timestamp, service, instance, level, correlation_id, and details. Default: null.

    • Any of
      • string
      • null

    Examples:

    json
    "%(timestamp)s - %(service)s - %(level)s - %(message)s"
    
    json
    "%(asctime)s - Severity: %(levelno)s - %(msg)s"
    
  • log_traceback (boolean): Whether to include exception tracebacks in log messages. Default: true.

  • object_storages (object, required): Can contain additional properties.

    • Additional properties: Refer to #/$defs/S3ObjectStorageNodeConfig.
  • file_upload_topic (string, required): Topic containing published FileUpload outbox events.

    Examples:

    json
    "file-uploads"
    
    json
    "file-upload-topic"
    
  • file_internally_registered_topic (string, required): Name of the topic used for events indicating that a file has been registered for download.

    Examples:

    json
    "file-registrations"
    
    json
    "file-registrations-internal"
    
  • file_internally_registered_type (string, required): The type used for event indicating that that a file has been registered for download.

    Examples:

    json
    "file_internally_registered"
    
  • file_deleted_topic (string, required): Name of the topic used for events indicating that a file has been deleted.

    Examples:

    json
    "file-deletions"
    
  • file_deleted_type (string, required): The type used for events indicating that a file has been deleted.

    Examples:

    json
    "file_deleted"
    
  • file_staged_topic (string, required): Name of the topic used for events indicating that a new file has been internally registered.

    Examples:

    json
    "file-stagings"
    
  • file_staged_type (string, required): The type used for events indicating that a new file has been internally registered.

    Examples:

    json
    "file_staged_for_download"
    
  • file_deletion_request_topic (string, required): The name of the topic to receive events informing about files to delete.

    Examples:

    json
    "file-deletion-requests"
    
  • file_deletion_request_type (string, required): The type used for events indicating that a request to delete a file has been received.

    Examples:

    json
    "file_deletion_requested"
    
  • files_to_stage_topic (string, required): Name of the topic used for events indicating that a download was requested for a file that is not yet available in the outbox.

    Examples:

    json
    "file-staging-requests"
    
  • files_to_stage_type (string, required): The type used for non-staged file request events.

    Examples:

    json
    "file_staging_requested"
    
  • kafka_servers (array, required): A list of connection strings to connect to Kafka bootstrap servers.

    • Items (string)

    Examples:

    json
    [
        "localhost:9092"
    ]
    
  • kafka_security_protocol (string): Protocol used to communicate with brokers. Valid values are: PLAINTEXT, SSL. Must be one of: "PLAINTEXT" or "SSL". Default: "PLAINTEXT".

  • kafka_ssl_cafile (string): Certificate Authority file path containing certificates used to sign broker certificates. If a CA is not specified, the default system CA will be used if found by OpenSSL. Default: "".

  • kafka_ssl_certfile (string): Optional filename of client certificate, as well as any CA certificates needed to establish the certificate's authenticity. Default: "".

  • kafka_ssl_keyfile (string): Optional filename containing the client private key. Default: "".

  • kafka_ssl_password (string, format: password, write-only): Optional password to be used for the client private key. Default: "".

  • generate_correlation_id (boolean): A flag, which, if False, will result in an error when trying to publish an event without a valid correlation ID set for the context. If True, a new correlation ID will be generated and used in the event header. Default: true.

    Examples:

    json
    true
    
    json
    false
    
  • kafka_max_message_size (integer): The largest message size that can be transmitted, in bytes, before compression. Only services that have a need to send/receive larger messages should set this. When used alongside compression, this value can be set to something greater than the broker's message.max.bytes field, which effectively concerns the compressed message size. Exclusive minimum: 0. Default: 1048576.

    Examples:

    json
    1048576
    
    json
    16777216
    
  • kafka_compression_type: The compression type used for messages. Valid values are: None, gzip, snappy, lz4, and zstd. If None, no compression is applied. This setting is only relevant for the producer and has no effect on the consumer. If set to a value, the producer will compress messages before sending them to the Kafka broker. If unsure, zstd provides a good balance between speed and compression ratio. Default: null.

    • Any of
      • string: Must be one of: "gzip", "snappy", "lz4", or "zstd".
      • null

    Examples:

    json
    null
    
    json
    "gzip"
    
    json
    "snappy"
    
    json
    "lz4"
    
    json
    "zstd"
    
  • kafka_max_retries (integer): The maximum number of times to immediately retry consuming an event upon failure. Works independently of the dead letter queue. Minimum: 0. Default: 0.

    Examples:

    json
    0
    
    json
    1
    
    json
    2
    
    json
    3
    
    json
    5
    
  • kafka_enable_dlq (boolean): A flag to toggle the dead letter queue. If set to False, the service will crash upon exhausting retries instead of publishing events to the DLQ. If set to True, the service will publish events to the DLQ topic after exhausting all retries. Default: false.

    Examples:

    json
    true
    
    json
    false
    
  • kafka_dlq_topic (string): The name of the topic used to resolve error-causing events. Default: "dlq".

    Examples:

    json
    "dlq"
    
  • kafka_retry_backoff (integer): The number of seconds to wait before retrying a failed event. The backoff time is doubled for each retry attempt. Minimum: 0. Default: 0.

    Examples:

    json
    0
    
    json
    1
    
    json
    2
    
    json
    3
    
    json
    5
    
  • mongo_dsn (string, format: multi-host-uri, required): MongoDB connection string. Might include credentials. For more information see: <[***]>. Length must be at least 1.

    Examples:

    json
    "mongodb://localhost:27017"
    
  • db_name (string, required): Name of the database located on the MongoDB server.

    Examples:

    json
    "my-database"
    
  • mongo_timeout: Timeout in seconds for API calls to MongoDB. The timeout applies to all steps needed to complete the operation, including server selection, connection checkout, serialization, and server-side execution. When the timeout expires, PyMongo raises a timeout exception. If set to None, the operation will not time out (default MongoDB behavior). Default: null.

    • Any of
      • integer: Exclusive minimum: 0.
      • null

    Examples:

    json
    300
    
    json
    600
    
    json
    null
    
  • 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
    
  • migration_max_wait_sec: The maximum number of seconds to wait for migrations to complete before raising an error. Default: null.

    • Any of
      • integer
      • null

    Examples:

    json
    null
    
    json
    300
    
    json
    600
    
    json
    3600
    

Definitions

  • S3Config (object): S3-specific config params. Inherit your config class from this class if you need to talk to an S3 service in the backend. Cannot contain additional properties.

    • s3_endpoint_url (string, required): URL to the S3 API.

      Examples:

      json
      "http://localhost:4566"
      
    • s3_access_key_id (string, required): Part of credentials for login into the S3 service. See: https://boto3.amazonaws.com/v1/documentation/api/latest/guide/credentials.html.

      Examples:

      json
      "my-access-key-id"
      
    • s3_secret_access_key (string, format: password, required and write-only): Part of credentials for login into the S3 service. See: https://boto3.amazonaws.com/v1/documentation/api/latest/guide/credentials.html.

      Examples:

      json
      "my-secret-access-key"
      
    • s3_session_token: Part of credentials for login into the S3 service. See: https://boto3.amazonaws.com/v1/documentation/api/latest/guide/credentials.html. Default: null.

      • Any of
        • string, format: password
        • null

      Examples:

      json
      "my-session-token"
      
    • aws_config_ini: Path to a config file for specifying more advanced S3 parameters. This should follow the format described here: https://boto3.amazonaws.com/v1/documentation/api/latest/guide/configuration.html#using-a-configuration-file. Default: null.

      • Any of
        • string, format: path
        • null

      Examples:

      json
      "~/.aws/config"
      
  • S3ObjectStorageNodeConfig (object): Configuration for one specific object storage node and one bucket in it. The bucket is the main bucket that the service is responsible for. Cannot contain additional properties.

    • bucket (string, required)
    • credentials (required): Refer to #/$defs/S3Config.

Architecture and Design

This is a Python-based service following the Triple Hexagonal Architecture pattern. It uses protocol/provider pairs and dependency injection mechanisms provided by the https://github.com/ghga-de/ghga/tree/main/libs/hexkit library.

License

This repository is free to use and modify according to the Apache 2.0 License.

镜像拉取方式

您可以使用以下命令拉取该镜像。请将 <标签> 替换为具体的标签版本。如需查看所有可用标签版本,请访问 标签列表页面。

轩辕镜像加速拉取命令点我查看更多 ifrs 镜像标签

docker pull docker.xuanyuan.run/ghga/ifrs:<标签>

DockerHub 原生拉取命令

docker pull ghga/ifrs:<标签>
专业版 · 高速稳定拉取镜像
50GB 仅 ¥8/年
高速镜像下载在线技术支持专业版保障服务可用付费会员免广告