# Factory Proxy Configuration Schema
Factory Proxy relies on the configuration that you provide for it in the Certificate Manager Portal. You can find the JSON schema of the configuration object expected by the Factory Proxy below.
Reference Architecture
The format and contents specified below apply to the reference Factory Proxy architecture. If you are about to use your own implementation, it is up to you what the configuration contains.
{
"type": "object",
"properties": {
"pollingFrequency": {
"type": "number"
},
"system-modules": {
"type": "object",
"properties": {
"factory-proxy": {
"type": "object",
"properties": {
"docker": {
"type": "object",
"properties": {
"image": {
"type": "string"
}
},
"required": ["image"]
},
"env": {
"type": "object",
"patternProperties": {
"^.*$": {
"anyOf": [
{
"type": "string"
},
{
"type": "number"
},
{
"type": "boolean"
}
]
}
}
}
},
"required": ["docker"]
},
"factory-broker": {
"type": "object",
"properties": {
"docker": {
"type": "object",
"properties": {
"image": {
"type": "string"
}
},
"required": ["image"]
},
"env": {
"type": "object",
"properties": {
"persistence": {
"type": "boolean"
},
"maxMessageSize": {
"type": "number"
},
"maxStorageSize": {
"type": "number"
},
"maxMessages": {
"type": "number"
},
"logDestination": {
"type": "string",
"enum": ["stdout", "stderr", "syslog", "none"]
},
"logLevel": {
"type": "string",
"enum": [
"debug",
"error",
"warning",
"notice",
"information",
"subscribe",
"unsubscribe",
"websockets",
"none",
"all"
]
},
"sessionTimeout": {
"type": "number"
}
},
"required": [
"persistence",
"maxMessageSize",
"maxStorageSize",
"maxMessages",
"logDestination",
"logLevel",
"sessionTimeout"
]
}
},
"required": ["docker"]
}
},
"required": ["factory-proxy", "factory-broker"]
},
"modules": {
"type": "object",
"patternProperties": {
"^.*$": {
"type": "object",
"properties": {
"docker": {
"type": "object",
"properties": {
"image": {
"type": "string"
},
"credentials": {
"type": "string"
},
"ports": {
"type": "object",
"properties": {
"tcp": {
"type": "array",
"items": {
"type": "object",
"properties": {
"publishedPort": {
"type": "number"
},
"targetPort": {
"type": "number"
}
},
"required": ["publishedPort", "targetPort"]
}
},
"udp": {
"type": "array",
"items": {
"type": "object",
"properties": {
"publishedPort": {
"type": "number"
},
"targetPort": {
"type": "number"
}
},
"required": ["publishedPort", "targetPort"]
}
}
}
},
"volumes": {
"type": "object",
"properties": {
"paths": {
"type": "array",
"items": {
"type": "object",
"properties": {
"dockerPath": {
"type": "string"
},
"hostPath": {
"type": "string"
}
},
"required": ["dockerPath", "hostPath"]
}
}
},
"required": ["paths"]
}
},
"required": ["image", "credentials", "ports"]
},
"env": {
"type": "object",
"patternProperties": {
"^.*$": {
"anyOf": [
{
"type": "string"
},
{
"type": "number"
},
{
"type": "boolean"
}
]
}
}
}
},
"required": ["docker"]
}
}
}
},
"required": ["pollingFrequency", "system-modules", "modules"]
}
# Meaning of the fields
pollingFrequency
- the frequency of polling the Certificate Manager Service for enrollment code generate request status. The default value is500
(ms).system-modules.factory-proxy.docker.image
- a Docker image of the Factory Proxy container.system-modules.factory-proxy.env
- optional object containing environment variables that will be attached to the Factory Proxy container.system-modules.factory-broker.docker.image
- a docker image of the Factory Broker container.system-modules.factory-broker.env
- optional object containing environment variables that will be attached to the Factory Broker container.system-modules.factory-broker.env.maxMessageSize
- individual message size limit in KiloBytes. A hard limit of 65536KB always applies. The default value is1024
.system-modules.factory-broker.env.persistence
- save outstanding message data and subscriptions periodically on system disk. It defaults totrue
.system-modules.factory-broker.env.maxStorageSize
- persisted data size limit in MegaBytes. A hard limit of 1024MB always applies. The default value is1024
.system-modules.factory-broker.env.maxMessages
- THis value is used for mosquitto'smax_inflight_messages
andmax_queued_messages
. The default value is100
.
system-modules.factory-broker.env.logDestination
- send log messages to a particular destination. Possible destinations are:stdout
,stderr
andsyslog
.Stdout
andstderr
log to the console on the named output. Usenone
if you wish to disable logging. Defaults tostdout
.system-modules.factory-broker.env.loglevel
- log level for the broker. The available options are: "debug", "error" "warning", "notice", "information", "subscribe", "unsubscribe", "websockets", "none", "all". The default value is "information".system-modules.factory-broker.env.sessionTimeout
- keep messages for this many minutes after a persistent client (clean session set tofalse
) disconnects. If not set or set to zero (0), sessions never expire and messages are kept forever. The default value is10
.modules
- an object containing your custom modules to be run on your Factory Proxy machine.modues.{moduleName}.image
- a Docker image representing your module.modues.{moduleName}.credentials
- the credentials to pull the container image of the module. It should refer to the secrets defined in the Certificate Manager Service for the Factory Proxy instance. An example:"{secrets:imageregistry}"
(assuming that there is a "imageregistry" secret). Note: This configuration does not work currently, factory-proxy will useimageregistry
setting from thesecrets
ignoring whatever you set up here.modues.{moduleName}.ports
- optional object allowing you to expose TCP/UDP ports from the container to the host machine.modues.{moduleName}.ports.tcp[].publishedPort
- a port on the container.modues.{moduleName}.ports.tcp[].targetPort
- a port on the host machine.modues.{moduleName}.ports.udp[].publishedPort
- a port on the container.modues.{moduleName}.ports.udp[].targetPort
- a port on the host machine.modues.{moduleName}.volumes
- optional object allowing you to mount host directires/files to the module's container.modues.{moduleName}.volumes.paths[].dockerPath
- a path where the volume will be mounted on the module's container.modues.{moduleName}.volumes.paths[].hostPath
- a path on the host machine to be mounted on the container.modules.{moduleName}.env
- optional environment variables that will be set for your module's process.
# Example
{
"pollingFrequency": 500,
"system-modules": {
"factory-proxy": {
"docker": {
"image": "abbability.azurecr.io/factory.machine/factory.proxy:1.0.1"
}
},
"factory-broker": {
"docker": {
"image": "abbability.azurecr.io/factory.machine/factory.broker:1.0.0"
},
"env": {
"maxMessageSize": 1024,
"maxStorageSize": 1024,
"maxMessages": 100,
"logDestination": "stdout",
"sessionTimeout": 10
}
}
},
"modules": {
"reference-BL": {
"docker": {
"image": "abbability.azurecr.io/factory.machine/referencemodule:1.0.0",
"credentials": "",
"ports": {
"tcp": [
{
"publishedPort": 7007,
"targetPort": 7007
}
]
},
"volumes": {
"paths": [
{
"dockerPath": "/var/rpc",
"hostPath": "/var/ability/factoryproxy/rpc"
}
]
}
},
"env": {
"envVar1": "value",
"envVar2": "value",
"envVar3": "value"
}
}
}
}