-
Notifications
You must be signed in to change notification settings - Fork 5
Configuration
The CDP4-COMET Web Services are configured using multiple json files. The main application is configured using the appsettings.json
in the root of the application. The authentication providers are configured using their respective configuration files. The Community Edition provides support for CDP4-COMET Database authentication, the Enterprise Edition provides support for other authentication providers such as LDAP.
The COMET-Webservices are configured using multiple configuration sections:
- Kestrel: This section is used to configure the lightweight high-performance web server used to host the CDP4-COMET WebServices.
- Midtier: The
Midtier
section is used to configure the application server. - Backtier: The
Midtier
section is used to configure the connection to the PostgreSQL database. - MessageBroker: This section is used to configure the AMQP MessageBroker that is used to send messages to other systems for any kind of automation that needs to be realised outside of the CDP4-COMET WebServices.
- EmailService: This section is used to configure email services such that the CDP4-COMET WebServices can send out emails.
- Defaults: Default settings for the CDP4-COMET WebServices
- Changelog: Settings for recording changelogs and sending out email notifications
- Health: Settings to configure the Health Endpoints
- LongRunningTasks: Settings to configure long running tasks
- Serilog: settings to configure logging (using Serilog)
The authentication plugins are configured in separate configuration files placed in their respective folders and are not configured here.
A full example of the configuration file is presented below. Each secrion is explained in the text after.
{
"Kestrel": {
"Endpoints": {
"Http": {
"Url": "http://localhost:5000"
}
}
},
"Midtier": {
"UploadDirectory": "upload",
"FileStorageDirectory": "storage",
"TemporaryFileStorageDirectory": "tempstorage",
"IsExportEnabled": true,
"ExportDirectory": "export",
"BacktierWaitTime": 300
},
"Backtier": {
"HostName": "localhost",
"Port": 5432,
"UserName": "cdp4",
"Password": "cdp4",
"Database": "cdp4server",
"DatabaseRestore": "cdp4serverrestore",
"DatabaseManage": "cdp4manage",
"StatementTimeout": 180,
"IsDbSeedEnabled": true,
"IsDbRestoreEnabled": true,
"IsDbImportEnabled": false
},
"MessageBroker": {
"IsEnabled": false,
"HostName": "localhost",
"Port": 5672
},
"EmailService": {
"Sender": "CDP4",
"SMTP": "smtp.cdp4.org",
"Port": 587,
"UserName": "cdp4postmaster-username",
"Password": "cdp4postmaster-password"
},
"Defaults": {
"PersonPassword": "pass"
},
"Changelog": {
"CollectChanges": false,
"AllowEmailNotification": false
},
"Health": {
"RequireHost": []
},
"LongRunningTasks": {
"RetentionTime": 3600,
},
"Serilog": {
"Using": [ "Serilog.Sinks.Console", "Serilog.Sinks.File", "Serilog.Sinks.Grafana.Loki" ],
"MinimumLevel": {
"Default": "Debug",
"Override": {
"Microsoft": "Warning",
"System": "Warning"
}
},
"WriteTo": [
{
"Name": "GrafanaLoki",
"Args": {
"uri": "http://localhost:3100",
"labels": [
{
"key": "app",
"value": "CDP4-COMET WebServices-01"
}
],
"propertiesAsLabels": [
"app"
]
}
}
],
"WriteTo:Async": {
"Name": "Async",
"Args": {
"configure": [
{
"Name": "File",
"Args": {
"path": "logs/log-development-.txt",
"rollingInterval": "Day",
"rollOnFileSizeLimit": true
}
}
]
}
},
"Enrich": [ "FromLogContext", "WithMachineName", "WithProcessId", "WithThreadId" ],
"Properties": {
"Application": "CDP4-COMET WebServices",
"Environment": "Development"
}
}
}
The Kestrel configuration follows the format presribed by aspnetcore and microsoft. The part that is required by CDP4-COMET is to specify what the endpoint is that the web server should listen on for any incoming HTTP requests. In the example the protocal, hostname and port are specified. In this case http
is specified, we typically use a reverse proxy to handle encryption using SSL. Our preferred solution for this is Nginx.
"Kestrel": {
"Endpoints": {
"Http": {
"Url": "http://localhost:5000"
}
}
}
The Midtier
section is used to configure the application server behaviour.
- UploadDirectory: The directory used to upload temporary files, this is a relative path with respect to the root of the application.
- FileStorageDirectory: The directory used to store files, this is a relative path with respect to the root of the application.
- TemporaryFileStorageDirectory: The directory used to store temporary files, this is a relative path with respect to the root of the application.
- IsExportEnabled: determines whether the export of an Annex C.3 file is enabled
- ExportDirectory:the path to the directory used to store export files that are to be downloaded once created and then cleaned up
- BacktierWaitTime: the time in seconds to wait for the backtier to become available at startup (wait time for PostgreSQL becomes responsive)
"Midtier": {
"UploadDirectory": "upload",
"FileStorageDirectory": "storage",
"TemporaryFileStorageDirectory": "tempstorage",
"IsExportEnabled": true,
"ExportDirectory": "export",
"BacktierWaitTime": 300
}
The Backtier
section is used to configure the connection to the database
- HostName: The hostname or IP address of the PostgreSQL database, this can be a FQDN or an IPv4 IP address, when the midtier and backtier are installed on the same box your best choice is 127.0.0.1
- Port: The port on which the PostgreSQL cluster is listening.
- UserName: The username that is used to connect to the PostgreSQL database. The default installation uses "cdp4".
- Password: The password that is used to connect to the PostgreSQL database. The default installation uses "cdp4".
- Database: The name of the CDP4-COMET database on the PostgreSQL cluster. The default installation uses "cdp4server".
- DatabaseRestore: The name of the CDP4-COMET Restore database on the PostgreSQL cluster. The default installation uses "cdp4serverrestore".
- DatabaseManage: The name of the CDP4-COMET management database on the PostgreSQL cluster. The default installation uses "cdp4manage".
- StatementTimeout: The time to wait (in seconds) while trying to execute a command before terminating the attempt and generating an error. The default installation uses 180. Setting this value to zero means infinity.
- IsDbSeedEnabled: a value indicating whether the CDP4-COMET Services can be seed with an ECSS-E-TM-10-25A Annex C.3 file. This should only be used when setting up a new server and loading the data from an Annex C.3 file. During production this value should be set to false.
- IsDbRestoreEnabled: a value indicating whether the CDP4-COMET Services can be restored. This is used during testing and development to quickly reset the content of the database. During production this value should be set to false.
- IsDbImportEnabled: a value indicating whether the CDP4-COMET Services allow for importing data from an Annex C.3 file in combination with the SAT tool.
"Backtier": {
"HostName": "localhost",
"Port": 5432,
"UserName": "cdp4",
"Password": "cdp4",
"Database": "cdp4server",
"DatabaseRestore": "cdp4serverrestore",
"DatabaseManage": "cdp4manage",
"StatementTimeout": 180,
"IsDbSeedEnabled": true,
"IsDbRestoreEnabled": true,
"IsDbImportEnabled": false
}
CDP4-COMET can make use of RabbitMQ to message to other systems that data has changed (added, updated or deleted). The following settings are used to enable this feature, and what the hostname and port are of the RabbitMQ MessageBroker that is to be used.
- IsEnabled: a value indicating whether the MessageBroker is enable
- HostName: the hostname of RabbitMQ server
- Port: the port of RabbitMQ server
"MessageBroker": {
"IsEnabled": false,
"HostName": "localhost",
"Port": 5672
}
The CDP4-COMET server is able to send email messages.
- Sender: The name of the sender of any emails
- SMTP: The IP address or Hostname of the SMTP server that is used for sending emails
- Port: The port of the SMTP server that is used for sending emails
- UserName: The user name of the account that will connect with the SMPT server
- Password: The user password of the account that will connect with the SMPT server
"EmailService": {
"Sender": "CDP4",
"SMTP": "smtp.cdp4.org",
"Port": 587,
"UserName": "cdp4postmaster-username",
"Password": "cdp4postmaster-password"
}
When the CDP4-COMET server is seeded from an Annex C3 file default settings are configured.
- PersonPassword: The default password for all users seeded from an Annex C.3 file.
"Defaults": {
"PersonPassword": "pass"
}
CDP4-COMET can keep collect changes over a period of time and send these changes as an email report to users.
- CollectChanges: a value indicating whether the CDP4-COMET Services shall collect changes
- AllowEmailNotification: a value indicating whether the CDP4-COMET Services shall email the collected changes
"Changelog": {
"CollectChanges": false,
"AllowEmailNotification": false
}
The health services provide essential monitoring and management capabilities for the CDP4-COMET WebServices. These endpoints are crucial for ensuring that the application remains operational and responsive, particularly in production environments.
- RequireHost: The RequireHost is used to enforce that requests to the Health endpoints are only processed if they are made from specific host or set of hosts. This means that the incoming HTTP request's Host header must match the specified host(s) for the endpoint to be executed. If the Host header does not match, the server will not route the request to the endpoint and will likely return a 404 Not Found or another appropriate error response.
"Health": {
"RequireHost": []
}
CDP4-COMET supports long running tasks. These are tasks or operations that are executed in the background and do not return a typical ECSS-E-TM-10-25 result but a Task
object.
- RetentionTime: the amount of time in seconds before a POST message becomes a long running task that is pushed to the background.
"LongRunningTasks": {
"RetentionTime": 3600,
}
The Serilog is used as logging library. The configuration is adopted from the Serilog documentation. The provided configuration supports logging to the console, a file as well as Grafana/Loki.
"Serilog": {
"Using": [ "Serilog.Sinks.Console", "Serilog.Sinks.File", "Serilog.Sinks.Grafana.Loki" ],
"MinimumLevel": {
"Default": "Debug",
"Override": {
"Microsoft": "Warning",
"System": "Warning"
}
},
"WriteTo": [
{
"Name": "GrafanaLoki",
"Args": {
"uri": "http://localhost:3100",
"labels": [
{
"key": "app",
"value": "CDP4-COMET WebServices-01"
}
],
"propertiesAsLabels": [
"app"
]
}
}
],
"WriteTo:Async": {
"Name": "Async",
"Args": {
"configure": [
{
"Name": "File",
"Args": {
"path": "logs/log-development-.txt",
"rollingInterval": "Day",
"rollOnFileSizeLimit": true
}
}
]
}
},
"Enrich": [ "FromLogContext", "WithMachineName", "WithProcessId", "WithThreadId" ],
"Properties": {
"Application": "CDP4-COMET WebServices",
"Environment": "Development"
}
}
The authentication configuration is placed in the same folder as the Authentication plugin. The Community Edition only supports CDP4-COMET Database Authentication. Multiple authentication plugins can be installed at the same time. The configuration files can be used to determine the rank (priority) in which authentication should occur. A typical scenario would be to use 1 LDAP server and as fallback the CDP4-COMET Database Authentication plugin.
The default configuration is the following:
{
"AuthenticatorConnectorProperties": [{
"Rank": 0,
"IsEnabled": true,
"Name": "Basic Authentication",
"Description": "Provides basic password authentication against the Person retrieved from the database."
}]
}
- Rank: the order in which the plugins should be executed, 0 is first
- IsEnabled: a value indicating whether the plugin is enabled. The default installation uses true
- Name: A descriptive name of the plugin, this value should not be changed from "Basic Authentication"
- Description: a description of the authentication plugin, this value should not be changed from "Provides basic password authentication against the Person retrieved from the database."
copyright @ Starion Group S.A.