Repository navigation
Expand file tree
/
Copy pathcompose.shared.yml
More file actions
72 lines (70 loc) · 2.73 KB
/
Copy pathcompose.shared.yml
File metadata and controls
72 lines (70 loc) · 2.73 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
# Shared infra — one copy across ALL git worktrees.
#
# Pub/Sub is stateful too, but its fully-qualified resource paths include a
# project ID. `git:workinit` gives every worktree a unique GRAM_GCP_PROJECT_ID,
# so one emulator can safely host identical topic and subscription IDs for all
# trees.
#
# The OTLP sink is a ~35MB collector that ACKs and drops traces/metrics/logs
# so local exporters have a listener on 4317/4318. `git:workinit` writes
# OTEL_RESOURCE_ATTRIBUTES=worktree=$COMPOSE_PROJECT_NAME; `mise.toml` holds
# the main tree defaults.
#
# Always manage this file under its fixed project:
#
# docker compose -f compose.shared.yml -p gram-shared up -d
# docker compose -f compose.shared.yml -p gram-shared down
#
# Pub/Sub and the OTLP sink are the default shared services.
#
# Host ports are hardcoded literals, not interpolated per-worktree variables.
# This prevents a worktree carrying stale remapped ports from republishing a
# shared container elsewhere and fragmenting the stack. Keep the literals in
# sync with mise.toml: Pub/Sub 8088 and OTLP 4317/4318.
#
# Every port is bound to 127.0.0.1. These unauthenticated local development
# services are consumed only by host processes and must not be externally
# reachable.
name: gram-shared
services:
pubsub-emulator:
image: gcr.io/google.com/cloudsdktool/google-cloud-cli:573.0.0-emulators@sha256:1b083a6a9647024a98d4f38c2b51906a0f61ca36adcba11672b8933544962efe
restart: unless-stopped
environment:
# The emulator is a JVM app launched without -Xmx, so its default maximum
# heap is one quarter of the whole Docker VM. This shared local instance
# does not need an unbounded multi-gigabyte ceiling.
JAVA_TOOL_OPTIONS: -Xmx128m
ports:
- "127.0.0.1:8088:8085"
command:
[
"gcloud",
"beta",
"emulators",
"pubsub",
"start",
"--host-port=0.0.0.0:8085",
]
healthcheck:
test: ["CMD", "bash", "-c", "exec 3<>/dev/tcp/127.0.0.1/8085"]
interval: 2s
timeout: 2s
retries: 15
start_period: 2s
# Local services (and Docker's own CLI, which honours
# OTEL_EXPORTER_OTLP_ENDPOINT) export here continuously; without a listener
# they retry and fill logs with connection errors. Nothing stores the
# signals — use pitchfork logs for application output.
otlp-sink:
image: otel/opentelemetry-collector:0.161.0@sha256:b6d2b9a85b1029d05b5ad913150c1f014eed4ae99be81a1813ca5ade4a191913
restart: unless-stopped
environment:
GOMEMLIMIT: 64MiB
GOMAXPROCS: 2
ports:
- "127.0.0.1:4317:4317"
- "127.0.0.1:4318:4318"
volumes:
- ./local/otel/otlp-sink.yaml:/etc/otelcol/config.yaml:ro
command: ["--config=/etc/otelcol/config.yaml"]