Skip to content

Localstore Service

This core service temporarily stores workflow attachments, cleans them up after a certain period (60 minutes by default) and can be used to retrieve attachments.

It exposes two user-facing endpoints that are used by clients.

There is one service-specific configuration file option.

Environment variables

Logging

You can set the LOCALSTORE_DEBUG_LEVEL (all upper-cased) or DEBUG_LEVEL environment variables to DEBUG to add additional information in the console for the launched service. It defaults to INFO. (Please note that setting DEBUG_LEVEL to DEBUG will produce a significant amount of logs.)

The possible values are NOTSET, DEBUG, INFO, WARNING, ERROR, and FATAL. Those values are from the most verbose, NOTSET, which shows all logs, to the least verbose, FATAL, which only shows fatal errors.

If LOCALSTORE_DEBUG_LEVEL is not defined then the value of DEBUG_LEVEL is used (or INFO if DEBUG_LEVEL is not defined either).

Access logs are only shown at NOTSET and DEBUG levels.

Configuration option

You can set the RETENTION_PERIOD_MINUTES environment variable to adjust the attachments retention period (60 minutes by default after the workflow’s completion).

It is shared between the Observer and the Localstore services.

You can use the LOCALSTORE_RETENTION_PERIOD_MINUTES environment variable instead to define it specifically for the Localstore service (if both are defined, the service-specific value will be used).

It must be an integer. If this environment variable is defined, it overrides the value in the configuration file.

Configuration file

This module has a configuration file (localstore.yaml by default) that describes the host, port, ssl_context, and trusted_authorities to use. It can also enable insecure logins.

If no configuration file is found it will default to the following values:

apiVersion: opentestfactory.org/v1beta2
kind: SSHServiceConfig
current-context: default
contexts:
- context:
    port: 443
    host: 127.0.0.1
    ssl_context: adhoc
    eventbus:
      endpoint: https://127.0.0.1:38368
      token: invalid
    retention_period_minutes: 60
  name: default

The configuration included in the ‘allinone’ image is described in “Common settings.” The listening port is 34537 and the bind address is 0.0.0.0 as the service exposes user-facing endpoints.

There is one service-specific configuration option besides the common ones.

Retention period

This period must be an integer. If the entry is missing, the default value will be assumed. It must be defined in the currently-used context.

retention_period_minutes sets the retention period for attachments. Attachments for a given workflow are kept for retention_period_minutes minutes after the reception of an end-of-workflow event. If not specified, defaults to 60 minutes.

Subscriptions

The localstore service subscribes to the following events:

kind apiVersion
Workflow opentestfactory.org/v1
WorkflowCompleted opentestfactory.org/v1
WorkflowCanceled opentestfactory.org/v1
WorkflowResult opentestfactory.org/v1alpha1
ExecutionResult opentestfactory.org/v1alpha1

Launch command

If you want to manually start the localstore service, use the following command:

python -m opentf.core.localstore [--context context] [--config configfile]

Additional command-line options are available and described in “Command-line options.”