Skip to content

Commit 5ed89d1

Browse files
committed
Docs: add compose example, k8s+helm scenario, and DNS guidance
1 parent 7c4a538 commit 5ed89d1

1 file changed

Lines changed: 87 additions & 36 deletions

File tree

docs/deployment-scenarios.md

Lines changed: 87 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,42 @@ This document shows common deployment patterns for Agoda.DevExTelemetry and how
55
## Scenario A: Single-host Docker Compose (small team / PoC)
66

77
- API and PostgreSQL run on one host.
8-
- Clients point directly to host URL or internal DNS.
8+
- Good for quick validation and small-team internal usage.
99

1010
```mermaid
1111
flowchart LR
1212
DevMachines["Developer machines<br/>(build/test clients)"] -->|HTTP metrics| API["DevExTelemetry API<br/>Docker container"]
1313
API --> DB[("PostgreSQL<br/>Docker volume")]
1414
```
1515

16+
### Example `docker-compose.yml`
17+
18+
```yaml
19+
services:
20+
app:
21+
image: agoda/devex-telemetry:latest
22+
ports:
23+
- "8080:8080"
24+
environment:
25+
- POSTGRES_CONNECTION_STRING=Host=db;Port=5432;Database=devex_telemetry;Username=devex;Password=devex
26+
depends_on:
27+
- db
28+
29+
db:
30+
image: postgres:17-alpine
31+
environment:
32+
POSTGRES_DB: devex_telemetry
33+
POSTGRES_USER: devex
34+
POSTGRES_PASSWORD: devex
35+
volumes:
36+
- pgdata:/var/lib/postgresql/data
37+
ports:
38+
- "5432:5432"
39+
40+
volumes:
41+
pgdata:
42+
```
43+
1644
### Pros
1745
- Fastest setup
1846
- Minimal infra dependencies
@@ -23,81 +51,104 @@ flowchart LR
2351
2452
---
2553
26-
## Scenario B: App Service / Managed host + managed PostgreSQL
54+
## Scenario B: Kubernetes + Helm (app) with externally managed PostgreSQL
2755
28-
- API runs on managed compute.
29-
- PostgreSQL runs as managed DB.
30-
- Clients use either internal DNS (`compilation-metrics`) or `DEVFEEDBACK_URL`.
56+
- App is deployed to Kubernetes via Helm.
57+
- PostgreSQL is managed externally (Azure Database for PostgreSQL / RDS / Cloud SQL / internal managed DB).
58+
- App receives DB connectivity via `POSTGRES_CONNECTION_STRING` in Helm values.
3159

3260
```mermaid
3361
flowchart LR
3462
Clients["Developer machines"] --> DNS["Internal DNS<br/>compilation-metrics"]
35-
DNS --> API["DevExTelemetry API<br/>Managed host"]
36-
API --> DB[("Managed PostgreSQL")]
63+
DNS --> Ingress["K8s Ingress / Internal LB"]
64+
Ingress --> App["DevExTelemetry API<br/>Kubernetes pods"]
65+
App --> DB[("Managed PostgreSQL<br/>outside cluster")]
3766
```
3867

39-
### Pros
40-
- Better uptime and managed operations
41-
- Easier backups/patching
68+
### Minimal Helm chart (app layer)
4269

43-
### Cons
44-
- Needs DNS + infra coordination
70+
#### `Chart.yaml`
4571

46-
---
72+
```yaml
73+
apiVersion: v2
74+
name: devex-telemetry
75+
version: 0.1.0
76+
appVersion: "latest"
77+
```
4778

48-
## Scenario C: Mixed rollout (transition state)
79+
#### `values.yaml`
4980

50-
- Some teams use DNS default.
51-
- Some teams use workstation-level `DEVFEEDBACK_URL` override.
81+
```yaml
82+
image:
83+
repository: agoda/devex-telemetry
84+
tag: latest
85+
pullPolicy: IfNotPresent
5286
53-
```mermaid
54-
flowchart LR
55-
A["Team A clients<br/>default URL"] --> DNS["compilation-metrics DNS"]
56-
B["Team B clients<br/>DEVFEEDBACK_URL set"] --> API
57-
DNS --> API["DevExTelemetry API"]
58-
API --> DB[("PostgreSQL")]
87+
replicaCount: 2
88+
89+
service:
90+
type: ClusterIP
91+
port: 8080
92+
93+
ingress:
94+
enabled: true
95+
className: nginx
96+
host: devex-telemetry.internal.example.com
97+
98+
env:
99+
POSTGRES_CONNECTION_STRING: "Host=managed-pg.internal;Port=5432;Database=devex_telemetry;Username=devex;Password=***"
100+
```
101+
102+
#### `templates/deployment.yaml` (env excerpt)
103+
104+
```yaml
105+
env:
106+
- name: POSTGRES_CONNECTION_STRING
107+
value: {{ .Values.env.POSTGRES_CONNECTION_STRING | quote }}
59108
```
60109

61110
### Pros
62-
- Incremental migration
63-
- Lower rollout friction
111+
- Better scalability and operability
112+
- Clean separation between app runtime and managed database
64113

65114
### Cons
66-
- Multiple connection patterns to support temporarily
115+
- Requires Kubernetes + Helm + ingress setup
116+
- Requires platform/DNS coordination
67117

68118
---
69119

70-
## Client Routing Rules
120+
## Pointing Clients at Your Deployment
71121

72122
Compilation/test clients route as follows:
73123

74124
1. If `DEVFEEDBACK_URL` is set, use it.
75125
2. Otherwise, use default `http://compilation-metrics`.
76126

77-
Recommended enterprise pattern:
78-
- Keep client defaults untouched.
79-
- Control destination centrally with DNS.
127+
### Preferred enterprise pattern: DNS default host
80128

81-
---
129+
Most corporate networks already use internal DNS for service discovery (for internal APIs, proxies, package mirrors, etc.).
82130

83-
## Example environment variables
131+
Because clients default to `http://compilation-metrics`, your network/workstation team can create an internal DNS record for `compilation-metrics` pointing to your telemetry API endpoint (ingress/internal LB/service host). Once this is in place:
84132

85-
### API host
133+
- no per-developer setup is required,
134+
- telemetry works out-of-the-box,
135+
- rollout and changes stay centralized with infra/network teams.
86136

87-
```bash
88-
export POSTGRES_CONNECTION_STRING='Host=postgres;Port=5432;Database=devex_telemetry;Username=devex;Password=devex'
89-
```
137+
If you don’t control DNS yet, use `DEVFEEDBACK_URL` as a temporary bridge.
90138

91-
### Client machine override (optional)
139+
### Workstation override (optional)
92140

93141
```bash
94142
export DEVFEEDBACK_URL='https://your-devex-telemetry.example.com'
95143
```
96144

145+
Your IT support team can also push this centrally with endpoint/device management tooling if needed.
146+
97147
---
98148

99149
## Security notes
100150

101151
- Keep the API internal (VPN/private network/internal ingress).
102152
- Do not expose PostgreSQL directly to the public internet.
103153
- Use TLS for cross-network telemetry traffic.
154+
- Prefer secrets management (K8s secrets / vault / parameter store) over plaintext credentials in Helm values.

0 commit comments

Comments
 (0)