You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@@ -7,28 +7,131 @@ Running ServiceControl and ServicePulse locally in containers provides a way to
7
7
## Usage
8
8
9
9
**Pull the latest images:** Before running the containers, ensure you're using the latest version of each image by executing the following command:
10
-
```shell
10
+
11
+
```pwsh
11
12
docker compose pull
12
13
```
13
-
This command checks for any updates to the images specified in the docker-compose.yml file and pulls them if available.
14
+
15
+
This command checks for any updates to the images specified in the docker-compose.yml file and pulls them if available.
14
16
15
17
**Start the containers:** After pulling the latest images, modify the [environment file](.env), if necessary, and then start up the containers using:
16
-
```shell
18
+
19
+
```pwsh
17
20
docker compose up -d
18
21
```
19
22
20
23
Once composed:
21
24
22
-
*[ServicePulse](https://docs.particular.net/servicepulse/) can be accessed at http://localhost:9090
23
-
*[ServiceInsight](https://docs.particular.net/serviceinsight/) can be used with a connection URL of http://localhost:33333/api
25
+
-[ServicePulse](https://docs.particular.net/servicepulse/) can be accessed at http://localhost:9090
26
+
-[ServiceInsight](https://docs.particular.net/serviceinsight/) can be used with a connection URL of http://localhost:33333/api
24
27
25
28
## Implementation details
26
29
27
-
* The ports for all services are exposed to localhost:
28
-
*`33333`: ServiceControl API
29
-
*`44444`: Audit API
30
-
*`33633`: Monitoring API
31
-
*`8080`: Database backend
32
-
*`9090` ServicePulse UI
33
-
* One instance of the [`servicecontrol-ravendb` container](https://docs.particular.net/servicecontrol/ravendb/containers) is used for both the [`servicecontrol`](https://docs.particular.net/servicecontrol/servicecontrol-instances/deployment/containers) and [`servicecontrol-audit`](https://docs.particular.net/servicecontrol/audit-instances/deployment/containers) containers.
34
-
*_A single database container should not be shared between multiple ServiceControl instances in production scenarios._
30
+
- The ports for all services are exposed to localhost:
31
+
-`33333`: ServiceControl API
32
+
-`44444`: Audit API
33
+
-`33633`: Monitoring API
34
+
-`8080`: Database backend
35
+
-`9090` ServicePulse UI
36
+
- One instance of the [`servicecontrol-ravendb` container](https://docs.particular.net/servicecontrol/ravendb/containers) is used for both the [`servicecontrol`](https://docs.particular.net/servicecontrol/servicecontrol-instances/deployment/containers) and [`servicecontrol-audit`](https://docs.particular.net/servicecontrol/audit-instances/deployment/containers) containers.
37
+
-_A single database container should not be shared between multiple ServiceControl instances in production scenarios._
38
+
39
+
## Running with HTTPS and authentication
40
+
41
+
The `compose-secure.yml` file provides a configuration with HTTPS enabled and OAuth2/OIDC authentication using Microsoft Entra ID (Azure AD).
42
+
43
+
### Prerequisites
44
+
45
+
1.**SSL Certificate**: A PFX certificate file for HTTPS
46
+
2.**CA Bundle**: A CA certificate bundle for validating the identity provider's certificates
47
+
3.**Microsoft Entra ID App Registration**: Configure an app registration for authentication
48
+
49
+
> [!NOTE]
50
+
> The [PFX file](#generate-a-pfx-certificate-for-local-testing-only) contains the private key and certificate for the service to **serve** HTTPS. The [CA bundle](#generate-a-ca-bundle-for-local-testing-only) contains only public CA certificates for the service to **verify** other services' certificates. Both are required when containers communicate over HTTPS.
51
+
52
+
### Configuration
53
+
54
+
Add the following variables to your `.env` file and replace the `{placeholder}` values with your actual configuration:
|`CERTIFICATE_PASSWORD`| Password for the PFX certificate (e.g., the password used when generating with mkcert) |
69
+
|`CERTIFICATE_PATH`| Path to the PFX certificate file (e.g., `./certs/servicecontrol.pfx`) |
70
+
|`CA_BUNDLE_PATH`| Path to the CA bundle file (e.g., `./certs/ca-bundle.crt`) |
71
+
|`IDP_AUTHORITY`| Microsoft Entra ID authority URL (e.g., `https://login.microsoftonline.com/{tenant-id}`) |
72
+
|`SERVICECONTROL_AUDIENCE`| Application ID URI from ServiceControl app registration (e.g., `api://{servicecontrol-client-id}`) |
73
+
|`SERVICEPULSE_CLIENTID`| Application (client) ID from ServicePulse app registration AD |
74
+
|`SERVICEPULSE_APISCOPES`| Array of API scopes ServicePulse should request when calling ServiceControl (e.g., ["api://{servicecontrol-client-id}/{scope-name}"]) |
75
+
76
+
#### Generate a PFX Certificate for Local Testing Only
77
+
78
+
> [!WARNING]
79
+
> The certificate generated below is for local testing only. Use a certificate from a trusted Certificate Authority for production deployments.
80
+
81
+
The below assume the `mkcert` tool has been installed.
82
+
83
+
> [!IMPORTANT]
84
+
> The certificate must include every hostname that will be used to access a service over HTTPS. In a Docker Compose network, containers reach each other using service names as hostnames (e.g., `https://servicecontrol:33333`). During the TLS handshake the client checks that the server's certificate contains a [Subject Alternative Name](https://en.wikipedia.org/wiki/Subject_Alternative_Name) (SAN) matching the hostname it connected to. If the name is missing, the connection is rejected.
85
+
86
+
```pwsh
87
+
# Install mkcert's root CA (one-time setup)
88
+
mkcert -install
89
+
90
+
# Navigate/create a folder to store the certificates. e.g.
91
+
mkdir certs
92
+
cd certs
93
+
94
+
# Generate PFX certificate for localhost/servicecontrol instances
> The CA bundle generated below is for local testing only. Use certificates from a trusted Certificate Authority for production deployments.
102
+
103
+
When running ServiceControl in Docker containers, each container needs a CA bundle file to trust certificates presented by other services. The `SSL_CERT_FILE` environment variable tells .NET where to find this bundle.
104
+
105
+
#### What is a CA Bundle?
106
+
107
+
A CA bundle is a file containing one or more Certificate Authority (CA) certificates. When a container makes an HTTPS request to another service, it uses this bundle to verify the server's certificate chain. Without it, containers would reject connections to services using your mkcert certificates. Unlike your host machine (where `mkcert -install` adds the CA to the system trust store), Docker containers don't share the host's trust store. You must explicitly provide the CA certificates that containers should trust.
108
+
109
+
#### Generate the CA bundle
110
+
111
+
```pwsh
112
+
# Get the mkcert CA root location
113
+
$CA_ROOT = mkcert -CAROOT
114
+
115
+
# Navigate to the folder containing the PFX certificate
116
+
cd certs
117
+
118
+
# For local development only (just mkcert CA)
119
+
copy "$CA_ROOT/rootCA.pem" ca-bundle.crt
120
+
```
121
+
122
+
### Pull the latest images
123
+
Before running the containers, ensure you're using the latest version of each image by executing the following command:
124
+
125
+
```pwsh
126
+
docker compose -f compose-secure.yml pull
127
+
```
128
+
129
+
### Starting the secure containers
130
+
131
+
```pwsh
132
+
docker compose -f compose-secure.yml up -d
133
+
```
134
+
135
+
Once composed:
136
+
137
+
-[ServicePulse](https://docs.particular.net/servicepulse/) can be accessed at https://localhost:9090
0 commit comments