Landscape Task Handler configuration reference¶
The Landscape Task Handler service is configured entirely through environment variables. There is no separate configuration file format; all settings are expressed as environment variables, which can be supplied directly or through the snap configuration system.
The task handler snap (landscape-task-handler) provides four services:
landscape-task-handler.server: the gRPC server other Landscape services can connect with to create a task.landscape-task-handler.worker: the service that performs queued tasks.landscape-task-handler.cert-renewer: a periodic job that automatically renews client and server mTLS certificates when they near their expiration dates. It has no configurable settings of its own; its behavior is controlled entirely through the certificate directories described in mTLS certificate management below.landscape-task-handler.cleanup: a periodic cleanup job that purges old task handler entries from the database.
service.conf integration¶
To perform hard deletion tasks, the task handler needs to use the same databases that Landscape server uses. By default, the task handler will read database configurations from /etc/landscape/service.conf and will populate the corresponding environment variables. The path to the service.conf file can be overridden via the LANDSCAPE_CONFIG_FILE environment variable or equivalently the landscape.service-conf-file snap key.
This means that several environment variables marked as required in this reference do not need to be set directly and can instead be read from the service.conf. These configurations are marked with service.conf-supplied: Yes. It is recommended to use this integration instead of setting these environment variables directly. In cases where the task handler cannot use the same configuration value as the Landscape server, it is necessary to use the snap configuration. A snap configuration takes priority over the equivalent value in the service.conf.
The table below lists every environment variable that is populated from service.conf. Note that all three Landscape server databases share the same host, port, user, password, and SSL settings from the [stores] section. The task handler’s own database (LANDSCAPE_DATABASE_TASK_HANDLER_*) is not populated from service.conf and must be configured directly.
Environment variable |
|
|
|---|---|---|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
landscape-task-handler.server and landscape-task-handler.worker services¶
Database settings¶
The task handler service connects to four PostgreSQL databases. Three of these (MAIN, ACCOUNT, RESOURCE) are the Landscape server databases and can be populated from service.conf. The fourth (TASK_HANDLER) is the task handler’s own database and must be configured directly.
Each database is configured with the same set of keys; replace <DB> below with TASK_HANDLER, MAIN, ACCOUNT, or RESOURCE when setting the environment variable. Replace <db> with task-handler, main, account, or resource when setting the snap key. Note that environment variables and snap keys are case-sensitive.
LANDSCAPE_DATABASE_<DB>_NAME¶
Purpose: The PostgreSQL database name to connect to.
Snap key:
landscape.database.<db>.nameDefault: None
Required: Yes
service.conf-supplied: Yes (exceptTASK_HANDLER)
LANDSCAPE_DATABASE_<DB>_HOST¶
Purpose: The hostname or IP address of the PostgreSQL server.
Snap key:
landscape.database.<db>.hostDefault: None
Required: Yes
service.conf-supplied: Yes (exceptTASK_HANDLER)
LANDSCAPE_DATABASE_<DB>_PORT¶
Purpose: The port on which the PostgreSQL server is listening.
Snap key:
landscape.database.<db>.portDefault:
5432Required: Yes
service.conf-supplied: Yes (exceptTASK_HANDLER)
LANDSCAPE_DATABASE_<DB>_USER¶
Purpose: The username used to authenticate with the PostgreSQL server.
Snap key:
landscape.database.<db>.userDefault: None
Required: Yes
service.conf-supplied: Yes (exceptTASK_HANDLER)
LANDSCAPE_DATABASE_<DB>_PASSWORD¶
Purpose: The password used to authenticate with the PostgreSQL server. Required unless SSL client certificate authentication is configured (both
SSL_CERTandSSL_KEYare set).Snap key:
landscape.database.<db>.passwordDefault: None
Required: No
service.conf-supplied: Yes (exceptTASK_HANDLER)
LANDSCAPE_DATABASE_<DB>_SSL¶
Purpose: The SSL mode to use when connecting to PostgreSQL. Valid values are
disable,allow,prefer,require,verify-ca, andverify-full.Snap key:
landscape.database.<db>.sslDefault:
preferRequired: Yes
service.conf-supplied: Yes (exceptTASK_HANDLER)
LANDSCAPE_DATABASE_<DB>_SSL_ROOT_CERT¶
Purpose: Path to the root CA certificate file used to verify the server’s certificate. Required when
SSLis set toverify-caorverify-full.Snap key:
landscape.database.<db>.ssl-root-certDefault: None
Required: No
service.conf-supplied: Yes (exceptTASK_HANDLER)
LANDSCAPE_DATABASE_<DB>_SSL_CERT¶
Purpose: Path to the client certificate file used for SSL client certificate authentication. Must be set together with
SSL_KEY.Snap key:
landscape.database.<db>.ssl-certDefault: None
Required: No
service.conf-supplied: Yes (exceptTASK_HANDLER)
LANDSCAPE_DATABASE_<DB>_SSL_KEY¶
Purpose: Path to the private key file for the client certificate. Must be set together with
SSL_CERT.Snap key:
landscape.database.<db>.ssl-keyDefault: None
Required: No
service.conf-supplied: Yes (exceptTASK_HANDLER)
Server settings¶
These settings apply to the landscape-task-handler.server service only.
LANDSCAPE_TASK_HANDLER_SERVER_HOST¶
Purpose: The hostname or IP address the gRPC server binds to.
Snap key:
landscape.task-handler.server.hostDefault: None
Required: Yes
service.conf-supplied: No
LANDSCAPE_TASK_HANDLER_SERVER_GRPC_PORT¶
Purpose: The port on which the gRPC server listens.
Snap key:
landscape.task-handler.server.grpc-portDefault:
50053Required: Yes
service.conf-supplied: No
LANDSCAPE_TASK_HANDLER_SERVER_DB_POOL_SIZE¶
Purpose: The maximum number of database connections the server maintains in its connection pool.
Snap key:
landscape.task-handler.server.db-pool-sizeDefault:
20Required: No
service.conf-supplied: No
LANDSCAPE_TASK_HANDLER_SERVER_CONN_MAX_LIFETIME¶
Purpose: The maximum length of time a database connection in the server pool may be reused. Accepts Go duration strings.
Snap key:
landscape.task-handler.server.conn-max-lifetimeDefault:
5mRequired: No
service.conf-supplied: No
LANDSCAPE_TASK_HANDLER_GRPC_CERTS_DIR¶
Purpose: Path to the directory containing the gRPC mTLS certificates. When unset, defaults to the auto-generated location under
$SNAP_COMMON/certs/active.Snap key:
landscape.task-handler.grpc.certs-dirDefault:
$SNAP_COMMON/certs/activeRequired: No
service.conf-supplied: No
LANDSCAPE_TASK_HANDLER_GRPC_ALLOWED_CLIENT_CNS¶
Purpose: Comma-separated list of client certificate common names (CNs) that are permitted to connect to the gRPC server.
Snap key:
landscape.task-handler.grpc.allowed-client-cnsDefault:
landscape-outboxRequired: No
service.conf-supplied: No
Worker settings¶
These settings apply to the landscape-task-handler.worker service only.
LANDSCAPE_TASK_HANDLER_WORKER_BATCH_SIZE¶
Purpose: The maximum number of task entries to dequeue and process in a single iteration of the worker loop.
Snap key:
landscape.task-handler.worker.batch-sizeDefault:
10Required: No
service.conf-supplied: No
LANDSCAPE_TASK_HANDLER_WORKER_SLEEP¶
Purpose: A fixed delay introduced between every worker loop iteration, regardless of whether entries were found. Accepts Go duration strings (for example
500ms,1s).Snap key:
landscape.task-handler.worker.sleepDefault:
5sRequired: No
service.conf-supplied: No
LANDSCAPE_TASK_HANDLER_WORKER_MAX_RETRIES¶
Purpose: The maximum number of times the worker will retry a failed task before marking it as permanently failed.
Snap key:
landscape.task-handler.worker.max-retriesDefault:
3Required: No
service.conf-supplied: No
LANDSCAPE_TASK_HANDLER_WORKER_LEASE_DURATION¶
Purpose: How long a claimed task is leased to this worker before it can be reclaimed by another worker. Accepts Go duration strings.
Snap key:
landscape.task-handler.worker.lease-durationDefault:
2mRequired: No
service.conf-supplied: No
LANDSCAPE_TASK_HANDLER_WORKER_LEASE_RESET_INTERVAL¶
Purpose: How often the worker scans for tasks with expired leases and makes them available for reprocessing. Accepts Go duration strings.
Snap key:
landscape.task-handler.worker.lease-reset-intervalDefault:
5mRequired: No
service.conf-supplied: No
LANDSCAPE_TASK_HANDLER_WORKER_CONCURRENCY¶
Purpose: The number of tasks the worker processes concurrently.
Snap key:
landscape.task-handler.worker.concurrencyDefault:
4Required: No
service.conf-supplied: No
LANDSCAPE_TASK_HANDLER_WORKER_CONN_MAX_LIFETIME¶
Purpose: The maximum length of time a database connection in the worker pool may be reused. Accepts Go duration strings.
Snap key:
landscape.task-handler.worker.conn-max-lifetimeDefault:
5mRequired: No
service.conf-supplied: No
Logging settings¶
LANDSCAPE_LOGGING_LEVEL¶
Purpose: The minimum log level for the service. Valid values are
trace,debug,info,warn,error, andfatal.Snap key:
landscape.logging.levelDefault:
infoRequired: No
service.conf-supplied: No
LANDSCAPE_LOGGING_HUMAN_READABLE¶
Purpose: When
true, log output is formatted for human readability. Whenfalse, logs are emitted as structured JSON.Snap key:
landscape.logging.human-readableDefault:
falseRequired: No
service.conf-supplied: No
Service identity settings¶
These settings identify the service instance to telemetry and observability systems. They are optional; if unset, the corresponding fields are omitted from telemetry data.
LANDSCAPE_SERVICE_NAME¶
Purpose: The name reported by this service instance to the telemetry backend.
Snap key:
landscape.service.nameDefault: None
Required: No
service.conf-supplied: No
LANDSCAPE_SERVICE_VERSION¶
Purpose: The version string reported by this service instance to the telemetry backend.
Snap key: None (set automatically by the snap)
Default: None
Required: No
service.conf-supplied: No
LANDSCAPE_SERVICE_NAMESPACE¶
Purpose: The namespace reported by this service instance to the telemetry backend.
Snap key:
landscape.service.namespaceDefault: None
Required: No
service.conf-supplied: No
LANDSCAPE_SERVICE_ENVIRONMENT¶
Purpose: The environment name (for example
productionorstaging) reported by this service instance to the telemetry backend.Snap key:
landscape.service.environmentDefault: None
Required: No
service.conf-supplied: No
Telemetry settings¶
LANDSCAPE_TELEMETRY_ENDPOINT¶
Purpose: The OTLP endpoint URL to which the service sends telemetry data (traces and metrics). When unset, telemetry is disabled.
Snap key:
landscape.telemetry.endpointDefault: None
Required: No
service.conf-supplied: No
LANDSCAPE_TELEMETRY_METRICS_INTERVAL¶
Purpose: How often the service reports metrics to the telemetry backend. Accepts Go duration strings.
Snap key:
landscape.telemetry.metrics-intervalDefault:
30sRequired: No
service.conf-supplied: No
mTLS certificate management¶
The task handler gRPC server and its clients (such as the outbox) communicate over mutual TLS (mTLS). The snap manages the certificate material under $SNAP_COMMON (typically /var/snap/landscape-task-handler/common).
Auto-generated certificates¶
By default, the landscape-task-handler.cert-renewer service automatically generates a self-signed CA, a server certificate, and a client certificate. These are written to the active directory:
$SNAP_COMMON/certs/active/
ca.crt # CA certificate (server-side trust anchor)
server.crt # gRPC server certificate
server.key # gRPC server private key
client/
ca.crt # CA certificate (client-side trust anchor, exposed to outbox)
client.crt # gRPC client certificate (exposed to outbox)
client.key # gRPC client private key (exposed to outbox)
Auto-generated certificates have a 90-day lifetime and are rotated automatically when fewer than 30 days remain. The landscape-task-handler.cert-renewer timer runs once per day to check for rotation.
The $SNAP_COMMON/certs/active/client/ directory is exposed to the outbox snap via the grpc-client-certs snap content slot, so the outbox can read the client certificates without any manual copying.
Operator-provided certificates¶
To use your own certificates instead of the auto-generated ones, place all five of the following files in $SNAP_COMMON/custom-certs/:
File |
Contents |
|---|---|
|
CA certificate (PEM) |
|
Server certificate (PEM), must chain to |
|
Server private key (PEM) |
|
Client certificate (PEM), must chain to |
|
Client private key (PEM) |
All five files must be present; a partial set found before any custom certificates have been adopted is ignored (a warning is logged, and the cert-manager falls back to generating self-signed certificates as usual). On the next cert-manager run (which happens on every service start, snap refresh, and daily rotation), the certificates are validated, copied into the active directory, and a .custom-managed sentinel file is written.
Important
Once the .custom-managed sentinel is present (that is, after custom certificates have been adopted at least once), the cert-manager will no longer silently fall back to auto-generated certificates. If the files in custom-certs/ are later removed or made incomplete, the cert-manager errors instead. To revert to auto-generated certificates, remove both the custom-certs/ files and the .custom-managed sentinel from $SNAP_COMMON/certs/active/.
There are no snap keys for providing certificate content directly; operator certificates must be placed on the filesystem as described above.
Overriding the active certificate directory¶
If you manage certificate placement outside of the snap’s cert-manager (for example, via a secrets management system), you can tell the server where to find the active certificates using the LANDSCAPE_TASK_HANDLER_GRPC_CERTS_DIR environment variable or its snap key equivalent. See LANDSCAPE_TASK_HANDLER_GRPC_CERTS_DIR in the server settings above.
Because landscape-task-handler is strictly confined, the snap can only read files from paths it has been granted access to. The snap ships with no system-files plug beyond etc-landscape (scoped to /etc/landscape), so any override path must be within $SNAP_COMMON or a subdirectory of /etc/landscape. The practical options are to write certificates directly to $SNAP_COMMON/certs/active/, use the custom-certs/ mechanism described above, or place certificates under /etc/landscape/ (for example /etc/landscape/task-handler-certs/).
landscape-task-handler.cleanup service¶
The cleanup service purges old task handler entries from the database on a periodic schedule. It shares logging configuration with the main task handler services but uses only the task handler’s own database.
Database settings¶
The cleanup service connects only to the task handler database (LANDSCAPE_DATABASE_TASK_HANDLER_*). The configuration keys are identical to those described in the server and worker database settings above.
The cleanup service does not use the main, account, or resource databases.
Logging settings¶
The cleanup service uses the same LANDSCAPE_LOGGING_LEVEL and LANDSCAPE_LOGGING_HUMAN_READABLE environment variables described in logging settings above.
Cleanup settings¶
LANDSCAPE_CLEANUP_FAILED_RETENTION_DURATION¶
Purpose: How long to retain failed task handler entries before they are eligible for deletion. Accepts Go duration strings.
Snap key:
landscape.cleanup.failed-retention-durationDefault:
720h(30 days)Required: No
service.conf-supplied: No
LANDSCAPE_CLEANUP_BATCH_SIZE¶
Purpose: The maximum number of entries to delete in a single database operation.
Snap key:
landscape.cleanup.batch-sizeDefault:
50Required: No
service.conf-supplied: No
LANDSCAPE_CLEANUP_BATCH_SLEEP¶
Purpose: The duration the cleanup job sleeps between successive delete batches. Accepts Go duration strings.
Snap key:
landscape.cleanup.batch-sleepDefault:
50msRequired: No
service.conf-supplied: No