Package: daml-dit-api
daml-dit-apiAPI definitions for DIT packages to be hosted in Daml Hub. This mainly
contains thetype definitionsfor the format of thedabl-meta.yamlfile at the root of each DIT file.DIT files are also used to contain integrations loaded and run by Daml
Hub. This repository also contains documentation (in thisREADME)
describing the runtime environment that Daml Hub provides to
integrations.Package MetadataAt their core, DIT files areZIP archivesthat follow a specific set of conventions regarding their content. The
most important of these conventions is the presence of a YAML metadata
file at the root of the archive and nameddabl-meta.yaml. This
metadata file contains catalog information describing the contents of
the DIT, as well as any packaging details needed to successfully
deploy a DIT file into Daml Hub. An example of a deployment instruction is
asubdeployment. A subdeployment instructs Daml Hub to deploy a specific
subfile within the DIT file. A DIT file that contains an embedded DAR
file could use a subdeployment to ensure that the embedded DAR file is
deployed to the ledger when the DIT is deployed. In this way, a DIT
file composed of multiple artifacts (DARs, Bots, UI's, etc.) can be
constructed to deploy a set of artifacts to a single ledger in a
single action.IntegrationsIntegrations are a special case of DIT file that are augmented with
the ability to run as an executable within a Daml Hub cluster. This is
done by packaging PythonDAZL botcode into anexecutable ZIPusingPEXand augmenting tha
resulting file with the metadata and other resources needed to make it
a correctly formed DIT file.Logically speaking, Daml Hub integrations are DAZL bots packaged with
information needed to fit them into the Daml Hub runtime and user
interface. The major functional contrast between a Daml Hub integration
and a Python Bot is that the integration has the external network
access needed to connect to an outside system and the Python Bot does
not. Due to the security implications of running within Daml Hub with
external network access, integrations can only be deployed with the
approval of DA staff.Developing IntegrationsThe easiest way to develop an integration for Daml Hub is to use theframework libraryanddditbuild tool.
The integration framework presents a Python API closely related to the
DAZL bot api and ensures that integrations follow the conventions
required to integrate into Daml Hub.Unless you know exactly what you are doing and why you are doing it,
use the framework.The Integration Runtime EnvironmentBy convention, integrations accept a number of environment variables
that specify key paramaters.  Integrations built with the framework
use defaults for these variables that connect to a default locally
configured sandbox instance.Variables provided by Daml Hub include the following:VariableDefaultPurposeDAML_LEDGER_URLhttp://localhost:6865Address of local ledger gRPC APIDABL_HEALTH_PORT8089Port for HTTP endpoint. (Used for both liveness/readiness and webhooks)DABL_JWKS_URLHTTP URL for JWKS RepositoryDABL_INTEGRATION_METADATA_PATH'int_args.yaml'Path to local metadata fileDABL_INTEGRATION_TYPE_IDType ID for the specific integration within the DIT to runDABL_LEDGER_PARTYParty identifier for network connectionDABL_LOG_LEVEL0Log verbosity level - 0 up to 50, inclusive.(Note that for legacy reasons, the ledger URL is also available under
theDABL_LEDGER_URLenvironment variable.)LoggingDABL integrations use the default Python logging package, and the
framework provides specific support for controlling log level at
runtime. To integrate properly with this logic, it is important that
integrations use theintegrationlogger. This logger is switched fromINFOlevel toDEBUGlevel at aDABL_LOG_LEVELsetting of 10 or above.The preferred way of creating an integration logger is via thegetIntegrationLoggerfunction in the API package.