When ServiceControl is hosted in containers, the particular/ image provides the database storage to the Error and Audit instances.
The database container extends the official RavenDB container and is provided to ensure compatibility with ServiceControl instances. In other words, for any version x. of ServiceControl, the same version x. of the database container should be used to ensure data storage compatibility.
Licensing
The RavenDB license bundled with ServiceControl covers storage of NServiceBus data, including the error and audit data stored by ServiceControl. It does not cover unrelated application data. If the same RavenDB deployment also stores unrelated application data, a separate RavenDB license is required.
- Embedded RavenDB: ServiceControl instances installed on Windows using the ServiceControl Management Utility or PowerShell include RavenDB and its license.
- The
particular/container: This image includes the RavenDB license. The same terms apply on Kubernetes.servicecontrol-ravendb - Self-managed RavenDB: The bundled license also covers self-managed RavenDB servers and high-availability clusters used exclusively for NServiceBus data, within the limits shown in RavenDB Studio. Use the RavenDB version that ServiceControl expects, as shown in the version map.
- RavenDB Cloud: RavenDB Cloud is licensed separately.
Production deployment
In production, dedicate each database container to a single ServiceControl Error or Audit instance.
This is a deployment recommendation. Each database container must run the same version as its ServiceControl instance, and a dedicated container allows each instance to be upgraded, backed up, and sized independently.
The database container runs a single RavenDB server and doesn't provide database high availability by default. For database high availability, configure a RavenDB cluster separately. See Licensing for coverage.
Basic usage
This minimal example creates a database container using docker run:
docker run -d --name servicecontrol-db \
-v db-config:/etc/ravendb \
-v db-data:/var/lib/ravendb/data \
particular/servicecontrol-ravendb:latest
Once the database container is running, the connection string http:/ can be used for the RAVENDB_CONNECTIONSTRING value for an Error instance or Audit instance.
From ServiceControl 7, also set STORAGETYPE to RavenDB on the Error or Audit container, as the storage type has no default.
RavenDB connection string
Environment variable: RAVENDB_CONNECTIONSTRING
Set this variable on the Error or Audit container to the URL of its RavenDB server.
For examples of Particular Service Platform containers used together, including Docker Compose and Kubernetes using a Helm chart, see the Platform Container Examples repository.
Required settings
A volume must be mounted to / to provide persistent storage for database contents between container updates. Failure to specify a path for the volume will result in loss of all data when the container is removed.
RavenDB has specific requirements about the types of storage it supports. See the RavenDB deployment storage considerations documentation for more information.
If these storage requirements can't be met, an external RavenDB server can be used or consider using a different storage.
Additional settings
As the ServiceControl RavenDB container extends the official RavenDB container, additional configuration details can be found in the RavenDB Docker container documentation, according to this version map:
| ServiceControl Versions | RavenDB Version | Container Documentation |
|---|---|---|
| 6.x | 6.2 | RavenDB 6.2 container docs |
| 5.4 to 5.11 | 5.4 | RavenDB 5.4 container docs |
RavenDB client certificate
Added in ServiceControl version 6.3.0
Configure the following settings on the Error or Audit container, not the RavenDB database container. When connecting to an external RavenDB instance, the client certificate settings are attempted in this order:
- An environment variable
RAVENDB_CLIENTCERTIFICATEBASE64can be used to supply the client certificate as a Base64-encoded string. - An environment variable
RAVENDB_CLIENTCERTIFICATEPATHcan be used to identify the local path to a certificate that has been added to the container via a mounted volume. - The app will attempt to load the certificate from
/.app/ raven-client-certificate. pfx - The app will attempt to access the database without a client certificate.
In any of the above cases, the certificate can be password-protected, in which case the password can be supplied using the RAVENDB_CLIENTCERTIFICATEPASSWORD environment variable.
The RavenDB container overview on Docker Hub is specific to the most recent version of RavenDB which may not match the version used by ServiceControl.
Do not run the RavenDB database container in Azure Container Apps. Azure Container Apps can store persistent data only on Azure Files shares (SMB or NFS). RavenDB supports only local file systems, such as ext4 or NTFS, and does not support network file shares in production.
To host ServiceControl and ServicePulse in Azure Container Apps, use ServiceControl v6 with RavenDB Cloud for hosting the database. See Licensing.
Troubleshooting
The database container reports an AGPL license
From ServiceControl version 6, a new database container reports AGPL - Open Source from its / endpoint until the first database is created. RavenDB applies the bundled license at that point, so this status is expected before an Error or Audit instance has connected for the first time.
If the data volume was first used by a RavenDB server that did not have the ServiceControl license, for example a container based on the official ravendb/ image, ServiceControl versions 6.9 to 6.22 keep the unlicensed state stored in the volume. The database container doesn't apply the bundled license or log anything about licensing, and the Error and Audit instances stop at startup with the message Cannot validate the current RavenDB license. From version 7.0.1, the database container applies the bundled license to such a volume when it starts.
On versions 6.9 to 6.22, apply the bundled license to the existing data by running the following command, replacing servicecontrol-db with the name of the database container:
docker exec servicecontrol-db sh -c 'curl -s -X POST http://localhost:8080/admin/license/activate -H "Content-Type: application/json" --data-binary @/usr/lib/ravendb/servicecontrol-license.json'
Then restart the Error and Audit instances. RavenDB stores the license with the data in the volume, so the license remains in place when the database container is restarted or replaced by a new container that uses the same volume.