This project contains the Edge Agent.
The settings to run the Edge Agent may be configured through the appsettings.json
file or environment variables.
The application will read the appsettings.json
for configuration. The format is:
{
"DockerUri": "<docker service uri>",
"DeviceConnectionString": "<Your IoT Hub Device Connection String>",
"ConfigSource": "<twin|local>",
"LocalConfigPath": "<Path to the custom configuration JSON file in 'local' mode>",
"DockerLoggingDriver": "<json-file|journald|fluentd|etwlogs|none>",
"NetworkId": "<Docker network id>",
"EdgeDeviceHostName": "<Edge device host name>"
}
ALternatively, you may override the settings in appsettings.json
by setting
environment variables.
DockerUri
DeviceConnectionString
ConfigSource
LocalConfigPath
DockerLoggingDriver
NetworkId
EdgeDeviceHostName
This is the URI for the docker service. Typically this is "http://localhost:2375" on Windows and "unix:///var/run/docker.sock" on Linux.
Set to the IoT Hub connection string of the edge device. Needed when
ConfigSource
is "twin".
May be set to "twin" or "local". When set to "twin",
the edge device twin is used as a configuration source for modules. When set to
"local", a file (config.json
) is used as a configuration source for modules.
A custom configuration JSON file can be used by bind mounting a directory containing the
custom configuration file into the edge agent container and specifying the path to the
configuration file in the container using the LocalConfigPath
environment variable.
DeviceConnectionString
must be set to a device connection string if ConfigSource
is set to "twin".
Path to the custom configuration JSON file used as the configuration source in the "local" mode.
All modules created by MMA will use this setting to assign a logging driver for the Docker container. See the Docker logger driver documentation for information on each log. Drivers "json-file" (the default logger), and "journald" will be used by MMA.
Our current repository is set up to use the "json-file" option when MMA is running in Windows, and to use "journald" when running on a Linux target.
The default option for the docker daemon is "json-file." The Docker service
maintains one log per container. Logs are accessed through the docker logs
command. Logs are only available for containers that have not been removed.
The journald logging system is available for all Linux system which support the systemd init system.
On the host machine, get all docker logs by running:
journalctl --unit=docker
Or get logs per module by running:
journalctl -a CONTAINER_NAME=<module-name>
Logs are not available through the docker logs
command when using "journald."
The following logging drivers have default options which should work when assigned: "fluentd", "etwlogs", and "none". No testing or validation was done on these logging drivers.
Set to the Docker network you want the modules in the Edge deployment to be a part of. If not provided, it will run under "azure-iot-edge" docker network, which uses docker bridge
network drvier.
Set to the host name of the edge device, which will be used by the modules and downstream devices to connect to the EdgeHub.