Configuration files

DMSContainer Configuration files in conf folder

DMS Container uses a lot of configuration files and some of them are even hierarchy linked. All the configuration files are located in <DMS_HOME>\conf. Let’s explain all of them.

database.conf

This file is a standard FireDAC connection definition file. The connections defined here can be used by the job of type class and is used also by the EMAIL built-in job. More information about this file can be found on the Embarcadero website (see Defining Connection with FireDAC). Normally you should not modify this file.

dmscontainer.config.json

This file is in JSON format and is quite simple. This is a sample of this file.

{
	"ServerPort": 443,
	"PrivKey": "$(DMS_HOME)\\conf\\privkey.pem",
	"CertPassword": "",
	"CACert": "$(DMS_HOME)\\conf\\cacert.pem",
	"DMSSupervisorEmail": "",
	"ExternalJobsFolder": "",
	"RPCTrace": false,
	"HTTPS": true,
   	"MaxConnections": 2048,
	"MaxRequestSizeMiB": 10,
	"AuditEventsRetainingInDays": 30,
	"UserBanningDurationInMinutes": 5,
	"LoginFailuresBeforeBanning": 3,	
	"EventStreams": {
		"Enabled": true,
		"MaxSize": 10000,
		"TTLMinutes": 4320
	}
}

ServerPort: Contains only the TCP/IP port where the server must listen. By default the service binds on all the available interfaces on the post defined by this file.

PrivKey: The absolute path of the file containing the private key

CertPassword: The password to access the privkey file (optional)

CACert: The absolute path of the file containing the public certificate

DMSSupervisorEmail: The email address that should be notified if some errors occurs in the log files monitored by the supervisor. DMSSupervisor monitors all the DMSContainer job files.

DMSSupervisor will send 1 email every 10 minutes maximum. This is because an higher rate could flood the global DMSContainer instance which take care of all the DMSInstances all over the world. All the activities of the DMSSupervisor are logged in the related file in the logs folder.

ExternalJobsFolder: This key is optional and can be used to allow DMSContainer to load ClassJob BPLs which are not located under the <DMS_HOME>\jobpackages folder. It is very useful if you want to deploy DMSContainer as part of your bigger system which contains specific custom ClassJobs related to your system which are under version control.

MaxRequestSizeMiB: Set the max request size in MiB (default 5MiB).

RPCTrace: Allows to log all the HTTP/S communication for the RPC API in a log file. It is very useful for troubleshooting and debug purposes.

HTTPS: If true the built-in service will uses the certificates provided to bind as HTTPS service. If false, no certificates will be used and plain HTTP is used (default true).

MaxConnections: Indicates the maximum numer of peer connections allowed for the DMSContainer server. MaxConnections is an integer property (or an env var reference containing an integer value) that indicates the maximum number of simultaneous peer connections allowed for the TCP server. MaxConnections can be used to insure that a pre-determined memory or bandwidth threshold is not exceeded. When MaxConnection is 0 (zero), the server does not impose a limit on the maximum number of client connections. Default 2048.

EventStreams: configure Event stream Module:

  • enabled: if true Event Stream module is active
  • MaxSize: is maximums number of events per queue
  • TTLMinutes: it’s the timelife of each event in the queue, expressed in minutes

AuditEventsRetainingInDays: After how many days audit events can be deleted

Variables Expansion

Among all the DMSContainer config files, dmscontainer.config.json is a bit different. During the reading phase, all the references to environment variables get expanded. The syntax must be $(varname).

Here’s some examples:

{
	"ServerPort": "$(MY_CONFIGURED_PORT)",
	"PrivKey": "$(DMS_HOME)\\conf\\privkey.pem",
	"CertPassword": "$(MY_SECRET_PASSWORD)",
	"CACert": "$(DMS_HOME)\\conf\\cacert.pem",
	"DMSSupervisorEmail": "itdept@mycorp.com",
	"ExternalJobsFolder": "",
    "MaxRequestSizeMiB": "$(CUSTOM_REQUEST_SIZE)",
	"RPCTrace": "$(TRACE_ENABLED)",
    "HTTPS": "$(ENABLE_HTTPS)"   
}

All the variables referenced in this must be defined in the host OS, otherwise errors will be raised.

This feature is very useful because allows to copy this configuration file among different machines and different instances without changing it (if the environmental variables are correctly defined).

job.default.config.json

This file is in JSON format and is the default configuration file for the JOBs. All the JOBs have a list of required configuration keys (see method GetConfigKeys: TArray<string>;). If these keys cannot be found in the specific JSON config file (which is named job.<jobname>.config.json) then the same keys are searched in this file. This mechanism allows to centralize different configuration parts without clutter all these config values all over the files. If the services share a subset of config keys then those keys can be defined in the job.default.config.json file while the specific ones must be defined in the specific config file for the JOB. Is a required key is not found in the specific job config file nor in the default config file, then an exception is raised.