Skip to content

Commit 47cc7d1

Browse files
authored
DEVOPS-2758-added-system-config (#69)
Add System Configuration feature Introduce system configuration support for advanced Lightrun server settings. The feature allows providing a signed JSON config file through ConfigMap. Documentation available at docs/advanced/system_config.md
1 parent f9a9b85 commit 47cc7d1

File tree

6 files changed

+116
-10
lines changed

6 files changed

+116
-10
lines changed

README.md

Lines changed: 16 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -39,50 +39,57 @@ To ensure a smooth and secure production deployment of Lightrun, follow these ke
3939

4040
- Decide whether to use Helm-managed secrets or an external secrets manager.
4141
[More info on Secrets Management](docs/installation/secrets.md)
42-
#### **4. Lightrun Certificate**
42+
43+
#### **4. System Configuration**
44+
45+
- Obtain the system configuration file and signature from Lightrun.
46+
[More info on System Configuration](docs/advanced/system_config.md)
47+
48+
#### **5. Lightrun Certificate**
4349

4450
- Plan how Lightrun certificate will be issued and managed for secure communications.
4551
[More info on Certificate](docs/installation/certificate.md)
46-
#### **5. Database**
52+
53+
#### **6. Database**
4754

4855
> [!TIP]
4956
> Use external managed database
5057
5158
- Choose between a local or external database.
5259
[More info on Database Setup](docs/components/database.md)
5360

54-
#### **6. Router**
61+
#### **7. Router**
5562

5663
- Decide how external traffic will reach the Lightrun router (Ingress, Service, OpenShift Route).
5764
[More info on Router](docs/components/router/index.md)
5865

59-
#### **7. Container Images Registry**
66+
#### **8. Container Images Registry**
6067

6168
- Choose where to store and manage container images (e.g., private registry, Docker Hub, Azure Container Registry, AWS ECR).
6269
[More info on Container Image Registry](docs/installation/container_image_registry.md)
6370

64-
#### **8. Redis**
71+
#### **9. Redis**
6572
> [!TIP]
6673
> Use external managed redis
6774
- Determine if Redis will be local or external.
6875
[More info on Redis Setup](docs/components/redis.md)
6976

70-
#### **9. (Optional)RabbitMQ**
77+
#### **10. (Optional)RabbitMQ**
7178

7279
- Determine if RabbitMQ is needed for sending telemetry to Lightrun.
7380
[More info on RabbitMQ](docs/components/rabbitmq.md)
7481

75-
#### **10. (Optional)Network Policy**
82+
#### **11. (Optional)Network Policy**
7683

7784
- Establish network policies to restrict access between services and prevent unauthorized communication.
7885
[More info on Network Policy](docs/advanced/network_policy.md)
7986

80-
#### **11. (Optional)Internal TLS Communication**
87+
#### **12. (Optional)Internal TLS Communication**
8188

8289
- Decide whether internal TLS is necessary for secure component communication.
8390
[More info on Internal TLS](docs/advanced/internal_tls.md)
8491

85-
#### **12. Choose Your Deployment Option**
92+
#### **13. Choose Your Deployment Option**
8693

8794
Decide where to run your Kubernetes cluster based on your infrastructure needs. Consider whether you'll deploy all services locally (including RabbitMQ, Redis, and MySQL) or use managed cloud services.
8895
##### **Supported Kubernetes Platforms:**

chart/templates/backend-deployment.yaml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,9 @@ spec:
6060
{{- end }}
6161
serviceAccountName: {{ template "lightrun-be.serviceAccountName" . }}
6262
volumes:
63+
- name: system-config
64+
configMap:
65+
name: {{ include "lightrun.fullname" . }}-system-config
6366
- name: encryption-keys
6467
secret:
6568
secretName: {{ include "secrets.backend.name" . }}
@@ -130,6 +133,10 @@ spec:
130133
"/usr/src/lightrun/{{ .Values.deployments.backend.jar_name }}"
131134
]
132135
volumeMounts:
136+
- name: system-config
137+
mountPath: {{ .Values.general.system_config.file_path }}
138+
subPath: {{ base .Values.general.system_config.file_path }}
139+
readOnly: true
133140
- name: encryption-keys
134141
mountPath: /encryption-keys
135142
readOnly: true
@@ -193,6 +200,10 @@ spec:
193200
- secretRef:
194201
name: {{ include "secrets.backend.name" . }}
195202
env:
203+
- name: LIGHTRUN_SYSTEM_CONFIG_JSON_FILE_PATH
204+
value: {{ .Values.general.system_config.file_path }}
205+
- name: LIGHTRUN_SYSTEM_CONFIG_JSON_SIGNATURE
206+
value: {{ .Values.general.system_config.signature }}
196207
- name: SERVER_SECURITY_ENCRYPTION-KEYS-PATH
197208
value: file:/encryption-keys
198209
- name: LIGHTRUN_HOSTNAME
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
kind: ConfigMap
2+
apiVersion: v1
3+
metadata:
4+
name: {{ include "lightrun.fullname" . }}-system-config
5+
data:
6+
system_config.json: {{ .Values.general.system_config.content }}

chart/values.yaml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,14 @@ general:
1111
lightrun_endpoint: "lightrun.example.com"
1212
## DNS record that will be used to access the platform
1313
deployment_type: on-prem
14+
15+
system_config:
16+
# Path to the system config file
17+
file_path: "/opt/lightrun/system_config.json"
18+
# Content of the system config file, base64 encoded
19+
content: ""
20+
# Signature of the system config file, base64 encoded
21+
signature: ""
1422
## on-prem, saas, single-tenant
1523
deploy_secrets:
1624
enabled: true

docs/advanced/_index.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
This advanced guide covers in-depth configuration options for deploying Lightrun using the Helm chart
22

33
- [Internal TLS](internal_tls.md)
4-
- [Network Policy](network_policy.md)
4+
- [Network Policy](network_policy.md)
5+
- [System Configuration](system_config.md)

docs/advanced/system_config.md

Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
# System Configuration File
2+
3+
This document describes how to configure and use the System Configuration feature in the Lightrun platform. The system configuration file allows administrators to adjust settings that control the behavior of the Lightrun server.
4+
5+
## Overview
6+
7+
The System Configuration is a JSON file that contains various settings that modify the behavior of the Lightrun server. This configuration is provided via a ConfigMap and mounted into the backend container. The file is digitally signed to ensure authenticity and prevent unauthorized modifications.
8+
9+
## Configuration Options
10+
11+
To use the System Configuration feature, you need to provide:
12+
13+
1. **Content**: The base64-encoded JSON configuration content (provided by Lightrun)
14+
2. **Signature**: A base64-encoded signature of the JSON content (provided by Lightrun)
15+
3. **File Path**: The location where the configuration file will be mounted in the container (default: `/opt/lightrun/system_config.json`)
16+
17+
### Values.yaml Configuration
18+
19+
Add the following configuration to your `values.yaml` file or override the values when installing/upgrading the Helm chart:
20+
21+
```yaml
22+
general:
23+
system_config:
24+
# Path to the system config file
25+
file_path: "/opt/lightrun/system_config.json"
26+
# Content of the system config file, base64 encoded
27+
content: "ewogICJzb21lQ29uZmlndXJhdGlvbkZpZWxkIjogdHJ1ZSwKICAiYW5vdGhlckNvbmZpZ3VyYXRpb25GaWVsZCI6IDEyMwp9Cg=="
28+
# Signature of the system config file, base64 encoded (provided by Lightrun)
29+
signature: "c2lnbmF0dXJlLXZhbHVlLWZyb20tbGlnaHRydW4="
30+
```
31+
32+
> [!IMPORTANT]
33+
> - The content must be base64-encoded valid JSON
34+
> - The signature must be base64-encoded and match the content exactly to be considered valid
35+
> - Contact Lightrun support to obtain a valid signature and content
36+
37+
### How It Works
38+
39+
When the Lightrun backend starts:
40+
41+
1. The backend reads the system configuration file from the specified path
42+
2. It validates the file's signature against the provided signature value
43+
3. If valid, the configuration is applied to modify the backend's behavior
44+
4. If invalid, the backend will log an error and may use default settings instead
45+
46+
## Updating the Configuration
47+
48+
To update the system configuration:
49+
50+
1. Obtain a new configuration content and corresponding signature from Lightrun support
51+
2. Update your `values.yaml` file or use `--set` parameters with the new values
52+
3. Apply the changes using Helm:
53+
54+
```bash
55+
helm upgrade lightrun lightrun/lightrun -f values.yaml
56+
```
57+
58+
> [!NOTE]
59+
> Updating the system configuration requires a restart of the Lightrun backend deployment with strategy recreate to take effect.
60+
61+
## Troubleshooting
62+
63+
If you experience issues with the system configuration:
64+
65+
1. Verify that the content is properly base64-encoded
66+
2. Ensure the signature matches the provided content
67+
3. Check the backend logs for any error messages related to system configuration:
68+
69+
```bash
70+
kubectl logs -l <lightrun-backend> -n <namespace>
71+
```
72+
73+
For assistance with system configuration issues, contact Lightrun support.

0 commit comments

Comments
 (0)