Skip to content

Commit 0bc6786

Browse files
authored
fix: use template pattern for credential injection and improve docs (#47)
* use template pattern for credential injection and improve docs Signed-off-by: ps48 <pshenoy36@gmail.com> * update docker compose Signed-off-by: ps48 <pshenoy36@gmail.com> --------- Signed-off-by: ps48 <pshenoy36@gmail.com>
1 parent 228fcca commit 0bc6786

8 files changed

Lines changed: 349 additions & 370 deletions

File tree

AGENTS.md

Lines changed: 19 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ observability-stack/
2525
│ ├── otel-collector/ # OpenTelemetry Collector configuration
2626
│ │ └── config.yaml
2727
│ ├── data-prepper/ # Data Prepper pipeline configuration
28-
│ │ ├── pipelines.yaml
28+
│ │ ├── pipelines.template.yaml
2929
│ │ └── data-prepper-config.yaml
3030
│ ├── prometheus/ # Prometheus configuration
3131
│ │ └── prometheus.yml
@@ -80,7 +80,7 @@ Contains all files needed for local Docker Compose deployment. Each component ha
8080
- `QUICK_START.md`: Step-by-step quick start guide
8181
- `CHANGELOG.md`: History of configuration changes and updates
8282
- `otel-collector/config.yaml`: OpenTelemetry Collector receivers, processors, and exporters
83-
- `data-prepper/pipelines.yaml`: Data transformation pipelines for logs and traces
83+
- `data-prepper/pipelines.template.yaml`: Data transformation pipeline template for logs and traces (credentials injected at container startup)
8484
- `data-prepper/data-prepper-config.yaml`: Data Prepper server configuration
8585
- `prometheus/prometheus.yml`: Prometheus scrape and storage configuration
8686
- `opensearch-dashboards/opensearch_dashboards.yml`: Dashboard UI configuration
@@ -183,7 +183,7 @@ Contains context-specific guidance for AI coding assistants. These files are aut
183183

184184
- **Component-specific**: Configuration files are named after their component
185185
- `config.yaml` for OpenTelemetry Collector
186-
- `pipelines.yaml` for Data Prepper
186+
- `pipelines.template.yaml` for Data Prepper
187187
- `prometheus.yml` for Prometheus
188188

189189
### Services in docker-compose.yml
@@ -201,7 +201,7 @@ The `.env` file in the docker-compose directory provides centralized configurati
201201
# OpenSearch Configuration
202202
OPENSEARCH_VERSION=3.4.0
203203
OPENSEARCH_USER=admin
204-
OPENSEARCH_PASSWORD=admin
204+
OPENSEARCH_PASSWORD='My_password_123!@#'
205205
OPENSEARCH_HOST=opensearch
206206
OPENSEARCH_PORT=9200
207207
@@ -376,8 +376,8 @@ otel-logs-pipeline:
376376
sink:
377377
- opensearch:
378378
hosts: ["https://opensearch:9200"]
379-
username: admin
380-
password: admin
379+
username: OPENSEARCH_USER
380+
password: OPENSEARCH_PASSWORD
381381
insecure: true
382382
index_type: log-analytics-plain
383383
@@ -403,8 +403,8 @@ traces-raw-pipeline:
403403
sink:
404404
- opensearch:
405405
hosts: ["https://opensearch:9200"]
406-
username: admin
407-
password: admin
406+
username: OPENSEARCH_USER
407+
password: OPENSEARCH_PASSWORD
408408
insecure: true
409409
index_type: trace-analytics-plain-raw
410410
@@ -419,8 +419,8 @@ service-map-pipeline:
419419
sink:
420420
- opensearch:
421421
hosts: ["https://opensearch:9200"]
422-
username: admin
423-
password: admin
422+
username: OPENSEARCH_USER
423+
password: OPENSEARCH_PASSWORD
424424
insecure: true
425425
index_type: trace-analytics-service-map
426426
```
@@ -619,22 +619,14 @@ Example services (weather-agent and canary) are defined in `docker-compose.examp
619619
OPENSEARCH_PASSWORD=your-new-password
620620
```
621621

622-
2. **Update opensearch-dashboards/opensearch_dashboards.yml**:
623-
```yaml
624-
opensearch.password: "your-new-password"
625-
```
626-
627-
3. **Update data-prepper/pipelines.yaml** (all opensearch sinks):
628-
```yaml
629-
password: your-new-password
630-
```
631-
632-
4. **Restart services**:
622+
2. **Restart services** (remove volumes to clear stale credentials):
633623
```bash
634-
docker-compose down
624+
docker compose down -v
635625
docker compose up -d
636626
```
637627

628+
Data Prepper uses a template (`pipelines.template.yaml`) with credential placeholders that are injected from `.env` at container startup — no manual edits needed. OpenSearch Dashboards also reads credentials from `.env` automatically.
629+
638630
1. Add service definition to `docker-compose.yml`:
639631
```yaml
640632
new-service:
@@ -900,16 +892,16 @@ When creating examples or documentation, always reference the OpenTelemetry Gen-
900892
### Authentication Changes
901893

902894
When modifying OpenSearch credentials:
903-
1. Update `.env` file
904-
2. Update `opensearch-dashboards/opensearch_dashboards.yml`
905-
3. Update all OpenSearch sinks in `data-prepper/pipelines.yaml`
906-
4. Restart all services with `docker-compose down && docker compose up -d`
895+
1. Update `.env` file (single source of truth)
896+
2. Restart all services with `docker compose down -v && docker compose up -d`
897+
898+
Data Prepper uses a template (`pipelines.template.yaml`) with placeholders processed at container startup via `command:` in docker-compose.yml. No manual credential edits needed in pipeline configs.
907899

908900
### Configuration File Locations
909901

910902
- **OpenSearch**: No custom config file - uses environment variables in docker-compose.yml
911903
- **OpenTelemetry Collector**: `docker-compose/otel-collector/config.yaml`
912-
- **Data Prepper**: `docker-compose/data-prepper/pipelines.yaml` and `docker-compose/data-prepper/data-prepper-config.yaml`
904+
- **Data Prepper**: `docker-compose/data-prepper/pipelines.template.yaml` (credentials injected at startup) and `docker-compose/data-prepper/data-prepper-config.yaml`
913905
- **Prometheus**: `docker-compose/prometheus/prometheus.yml`
914906
- **OpenSearch Dashboards**: `docker-compose/opensearch-dashboards/opensearch_dashboards.yml`
915907
- **Environment Variables**: `.env` file in repository root

README.md

Lines changed: 86 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -25,10 +25,26 @@ curl -fsSL https://raw.githubusercontent.com/opensearch-project/observability-st
2525
```
2626

2727
The installer will:
28-
- ✅ Check system requirements
28+
- ✅ Check system requirements (Docker/Finch, Git, memory)
2929
- 🎨 Guide you through configuration with a beautiful TUI
3030
- 📦 Pull and start all services automatically
31-
- 🔐 Display credentials and access points
31+
- 🔐 Optionally set custom OpenSearch credentials
32+
- 📊 Display credentials and access points
33+
34+
**Installer flags:**
35+
36+
| Flag | Description |
37+
|------|-------------|
38+
| `--simulate` | Preview the installer output without actually installing |
39+
| `--skip-pull` | Skip pulling container images (uses cached images) |
40+
| `--help` | Show help message |
41+
42+
To run the installer locally (e.g. after cloning):
43+
```bash
44+
./install.sh # Full install
45+
./install.sh --simulate # Dry run
46+
./install.sh --skip-pull # Skip image pulls (useful for re-installs)
47+
```
3248

3349
**Installation takes 8-15 minutes.** After completion, access:
3450

@@ -84,17 +100,37 @@ docker compose down -v
84100

85101
## Instrumenting Your Agent
86102

87-
Observability Stack accepts telemetry data via the OpenTelemetry Protocol (OTLP) and follows the [OpenTelemetry Gen-AI Semantic Conventions](https://opentelemetry.io/docs/specs/semconv/gen-ai/) for standardized attribute naming and structure for AI agents.
103+
Observability Stack accepts telemetry data via the OpenTelemetry Protocol (OTLP) and follows the [OpenTelemetry Gen-AI Semantic Conventions](https://opentelemetry.io/docs/specs/semconv/gen-ai/) for standardized attribute naming and structure for AI agents.
104+
105+
### OTLP Endpoint Configuration
106+
107+
The OTel Collector exposes two OTLP endpoints — choose the one that matches your SDK's protocol:
108+
109+
| Port | Protocol | Endpoint | Used By |
110+
|------|----------|----------|---------|
111+
| **4317** | gRPC | `http://localhost:4317` | OpenTelemetry SDK (default), most language SDKs |
112+
| **4318** | HTTP/protobuf | `http://localhost:4318` | Strands SDK (`setup_otlp_exporter()`), HTTP-based exporters |
113+
114+
Configure via environment variables:
115+
```bash
116+
# For gRPC-based exporters (OpenTelemetry SDK default)
117+
export OTEL_EXPORTER_OTLP_ENDPOINT="http://localhost:4317"
118+
119+
# For HTTP/protobuf exporters (Strands SDK, OTLP HTTP exporters)
120+
export OTEL_EXPORTER_OTLP_ENDPOINT="http://localhost:4318"
121+
```
122+
123+
> **Note:** The Strands Agents SDK's `StrandsTelemetry().setup_otlp_exporter()` uses HTTP/protobuf, which requires **port 4318**. Using port 4317 with Strands will silently fail. When using `OTLPSpanExporter` directly with gRPC (as in the examples below), use **port 4317**.
88124
89-
### Example: Manual Instrumentation with OpenTelemetry
90-
For complete example, see [examples/plain-agents/weather-agent](./examples/plain-agents/weather-agent)
125+
### Example: Manual Instrumentation with OpenTelemetry
126+
For complete example, see [examples/plain-agents/weather-agent](./examples/plain-agents/weather-agent)
91127
```python
92128
from opentelemetry import trace
93129
from opentelemetry.exporter.otlp.proto.grpc.trace_exporter import OTLPSpanExporter
94130
from opentelemetry.sdk.trace import TracerProvider
95131
from opentelemetry.sdk.trace.export import BatchSpanProcessor
96132

97-
# Configure OTLP exporter
133+
# Configure OTLP exporter (gRPC — port 4317)
98134
tracer_provider = TracerProvider()
99135
otlp_exporter = OTLPSpanExporter(endpoint="http://localhost:4317", insecure=True)
100136
tracer_provider.add_span_processor(BatchSpanProcessor(otlp_exporter))
@@ -116,7 +152,7 @@ with tracer.start_as_current_span("invoke_agent") as span:
116152
span.set_attribute("gen_ai.usage.output_tokens", 75)
117153
```
118154
### Example: Instrument with StrandsTelemetry
119-
For complete example, see [examples/strands/code-assistant](./examples/strands/code-assistant)
155+
For complete example, see [examples/strands/code-assistant](./examples/strands/code-assistant)
120156
```python
121157
from opentelemetry.exporter.otlp.proto.grpc.trace_exporter import OTLPSpanExporter
122158
from opentelemetry.sdk.trace.export import BatchSpanProcessor
@@ -128,6 +164,8 @@ from strands.telemetry import StrandsTelemetry
128164
telemetry = StrandsTelemetry()
129165

130166
# 2. Configure OTLP exporter to send traces to your observability stack
167+
# Note: This example uses gRPC (port 4317) with OTLPSpanExporter directly.
168+
# If using setup_otlp_exporter() instead, it uses HTTP/protobuf (port 4318).
131169
exporter = OTLPSpanExporter(endpoint="localhost:4317", insecure=True)
132170
telemetry.tracer_provider.add_span_processor(BatchSpanProcessor(exporter))
133171

@@ -170,6 +208,33 @@ docker compose restart opensearch
170208
docker compose ps
171209
```
172210

211+
## Ports
212+
213+
| Port | Service | Protocol | Description |
214+
|------|---------|----------|-------------|
215+
| **4317** | OTel Collector | gRPC | OTLP gRPC receiver — used by most OpenTelemetry SDKs |
216+
| **4318** | OTel Collector | HTTP | OTLP HTTP receiver — used by Strands SDK, browser-based exporters |
217+
| **5601** | OpenSearch Dashboards | HTTP | Web UI for logs, traces, and dashboards |
218+
| **9090** | Prometheus | HTTP | Prometheus Web UI and API |
219+
| **9200** | OpenSearch | HTTPS | REST API (self-signed cert, use `curl -k`) |
220+
| **21890** | Data Prepper | gRPC | Internal OTLP receiver (from OTel Collector) |
221+
222+
When example services are enabled:
223+
224+
| Port | Service | Description |
225+
|------|---------|-------------|
226+
| **8000** | weather-agent | Weather lookup API with fault injection |
227+
| **8002** | events-agent | Local events lookup API |
228+
| **8003** | travel-planner | Multi-agent orchestrator |
229+
230+
When OpenTelemetry Demo is enabled:
231+
232+
| Port | Service | Description |
233+
|------|---------|-------------|
234+
| **8080** | frontend-proxy | Demo telescope web store |
235+
| **8080/loadgen/** | load-generator | Load generator dashboard |
236+
| **8080/feature** | feature-flag | Feature flag management UI |
237+
173238
## Configuration
174239

175240
### Environment Variables
@@ -209,42 +274,35 @@ docker compose down && docker compose up -d
209274
```
210275

211276
**Access points when running with OTel Demo:**
212-
- Frontend Proxy: http://localhost:8080
213-
- Load Generator UI: http://localhost:8089
277+
- Web Store: http://localhost:8080/
278+
- Load Generator UI: http://localhost:8080/loadgen/
279+
- Feature Flags UI: http://localhost:8080/feature
214280

215281
**Note:** Running with OTel Demo significantly increases resource requirements. See [Resource Requirements](#resource-requirements) below.
216282

217-
### Changing OpenSearch Credentials
283+
### OpenSearch Credentials
218284

219-
To change the OpenSearch username and password:
285+
The default credentials are `admin` / `My_password_123!@#` (development only).
220286

221-
1. **Edit `.env` file**:
287+
**Setting credentials during install:**
288+
289+
The interactive installer prompts "Customize OpenSearch credentials?" — enter `Y` to set a custom username and password. The installer writes them to `.env`, and all services pick them up automatically.
290+
291+
**Changing credentials after install:**
292+
293+
1. **Edit `.env` file** (single source of truth):
222294
```env
223295
OPENSEARCH_USER=your-new-username
224296
OPENSEARCH_PASSWORD=your-new-password
225297
```
226298

227-
2. **Update [Data Prepper configuration](docker-compose/data-prepper/pipelines.yaml)**:
228-
229-
The Data Prepper configuration has hardcoded credentials in three OpenSearch sink definitions. You can update them automatically:
230-
231-
```bash
232-
# Replace username (default: admin)
233-
sed -i.bak 's/username: admin/username: your-new-username/g' docker-compose/data-prepper/pipelines.yaml
234-
235-
# Replace password (default: My_password_123!@#)
236-
sed -i.bak 's/password: "My_password_123!@#"/password: "your-new-password"/g' docker-compose/data-prepper/pipelines.yaml
237-
```
238-
239-
Or manually update the `username` and `password` fields in all `opensearch:` sink sections.
240-
241-
3. **Restart the stack** (remove volumes to clear stale credentials):
299+
2. **Restart the stack** (remove volumes to clear stale credentials):
242300
```bash
243301
docker compose down -v
244302
docker compose up -d
245303
```
246304

247-
**Note**: The `opensearch-dashboards` and `opensearch-dashboards-init` services automatically use the values from `.env`, so no manual changes are needed for those components. OpenSearch uses HTTPS with self-signed certificates, so use `-k` flag with curl commands.
305+
**How it works:** `.env` is the single source of truth for credentials. OpenSearch, Dashboards, and the init script read from `.env` via environment variables. Data Prepper uses a [template](docker-compose/data-prepper/pipelines.template.yaml) with `OPENSEARCH_USER`/`OPENSEARCH_PASSWORD` placeholders that are injected via `sed` at container startup — no manual config edits needed. OpenSearch uses HTTPS with self-signed certificates, so use `-k` flag with curl commands.
248306

249307
## Resource Requirements
250308

0 commit comments

Comments
 (0)