-
Notifications
You must be signed in to change notification settings - Fork 373
Expand file tree
/
Copy pathdocker-compose.spanner.yaml
More file actions
185 lines (185 loc) · 6.54 KB
/
docker-compose.spanner.yaml
File metadata and controls
185 lines (185 loc) · 6.54 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
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
---
# FOR DEVELOPMENT ONLY. Run with
# docker-compose -f docker-compose.spanner.yaml up --build
services:
spanner:
image: "gcr.io/cloud-spanner-emulator/emulator"
restart: "no"
ports:
- "9010:9010"
spanner-init:
image: "gcr.io/google.com/cloudsdktool/cloud-sdk"
command: >
bash -c 'gcloud config configurations create emulator &&
gcloud config set auth/disable_credentials true &&
gcloud config set project $${PROJECT_ID} &&
gcloud config set api_endpoint_overrides/spanner $${SPANNER_EMULATOR_URL} &&
gcloud config set auth/disable_credentials true &&
gcloud spanner instances create $${INSTANCE_NAME} --config=emulator-config --description=Emulator --nodes=1 &&
gcloud spanner databases create $${DATABASE_NAME} --instance=$${INSTANCE_NAME}'
environment:
PROJECT_ID: "test-project"
SPANNER_EMULATOR_URL: "http://spanner:9020/"
INSTANCE_NAME: "test-instance"
DATABASE_NAME: "test-database"
migrate:
depends_on:
spanner-init:
condition: "service_completed_successfully"
required: false
build: "."
container_name: "migrate"
environment:
- "SPICEDB_DATASTORE_ENGINE=spanner"
- "SPICEDB_DATASTORE_CONN_URI=projects/test-project/instances/test-instance/databases/test-database"
- "SPANNER_EMULATOR_HOST=spanner:9010"
command: "datastore migrate head"
networks:
- "default"
# Envoy is used instead of nginx for gRPC load balancing. nginx balances at the
# connection level: once a client opens an HTTP/2 connection, all RPCs on that
# connection go to the same backend. Envoy speaks HTTP/2 to the backends and
# balances individual RPCs across pods, which is required for even cache warming.
envoy:
image: "envoyproxy/envoy:v1.33-latest"
ports:
- "50051:50051" # grpc
- "8443:8443" # http
volumes:
- "./development/envoy.yaml:/etc/envoy/envoy.yaml"
command: "-c /etc/envoy/envoy.yaml"
depends_on:
spicedb-1:
condition: "service_healthy"
spicedb-2:
condition: "service_healthy"
spicedb-1:
container_name: "spicedb-1"
build: "."
command: "serve"
restart: "no"
ports:
- "9090" # prometheus metrics
- "50051" # grpc endpoint
- "8443" # http endpoint
- "50053" # dispatch endpoint
environment:
- "SPICEDB_LOG_FORMAT=json"
- "SPICEDB_LOG_LEVEL=info"
- "SPICEDB_HTTP_ENABLED=true"
- "SPICEDB_GRPC_PRESHARED_KEY=foobar"
- "SPICEDB_DATASTORE_ENGINE=spanner"
- "SPICEDB_DATASTORE_CONN_URI=projects/test-project/instances/test-instance/databases/test-database"
- "SPANNER_EMULATOR_HOST=spanner:9010"
- "SPICEDB_DISPATCH_CLUSTER_ENABLED=true"
- "SPICEDB_DISPATCH_UPSTREAM_ADDR=spicedb-2:50053"
- "SPICEDB_OTEL_PROVIDER=otlpgrpc"
- "SPICEDB_OTEL_SAMPLE_RATIO=1"
- "SPICEDB_TELEMETRY_ENDPOINT="
- "SPICEDB_GRPC_LOG_REQUESTS_ENABLED=false"
- "SPICEDB_GRPC_LOG_RESPONSES_ENABLED=false"
- "SPICEDB_STREAMING_API_RESPONSE_DELAY_TIMEOUT=0s"
- "OTEL_EXPORTER_OTLP_ENDPOINT=http://otel-collector:4317"
- "SPICEDB_ENABLE_PERFORMANCE_INSIGHT_METRICS=true"
depends_on:
migrate:
condition: "service_completed_successfully"
otel-collector:
condition: "service_started"
healthcheck:
test: ["CMD", "/bin/grpc_health_probe", "-addr=localhost:50051"]
interval: "5s"
timeout: "30s"
retries: 3
spicedb-2:
container_name: "spicedb-2"
build: "."
command: "serve"
restart: "no"
ports:
- "9090" # prometheus metrics
- "8443" # http endpoint
- "50051" # grpc endpoint
- "50053" # dispatch endpoint
environment:
- "SPICEDB_LOG_FORMAT=json"
- "SPICEDB_LOG_LEVEL=info"
- "SPICEDB_HTTP_ENABLED=true"
- "SPICEDB_GRPC_PRESHARED_KEY=foobar"
- "SPICEDB_DATASTORE_ENGINE=spanner"
- "SPICEDB_DATASTORE_CONN_URI=projects/test-project/instances/test-instance/databases/test-database"
- "SPANNER_EMULATOR_HOST=spanner:9010"
- "SPICEDB_DISPATCH_CLUSTER_ENABLED=true"
- "SPICEDB_DISPATCH_UPSTREAM_ADDR=spicedb-1:50053"
- "SPICEDB_OTEL_PROVIDER=otlpgrpc"
- "SPICEDB_OTEL_SAMPLE_RATIO=1"
- "SPICEDB_TELEMETRY_ENDPOINT="
- "SPICEDB_GRPC_LOG_REQUESTS_ENABLED=true"
- "SPICEDB_GRPC_LOG_RESPONSES_ENABLED=false"
- "SPICEDB_STREAMING_API_RESPONSE_DELAY_TIMEOUT=0s"
- "OTEL_EXPORTER_OTLP_ENDPOINT=http://otel-collector:4317"
- "SPICEDB_ENABLE_PERFORMANCE_INSIGHT_METRICS=true"
depends_on:
migrate:
condition: "service_completed_successfully"
otel-collector:
condition: "service_started"
healthcheck:
test: ["CMD", "/bin/grpc_health_probe", "-addr=localhost:50051"]
interval: "5s"
timeout: "30s"
retries: 3
prometheus:
image: "prom/prometheus:v2.47.0"
command:
- "--config.file=/etc/prometheus/prometheus.yaml"
- "--storage.tsdb.path=/prometheus"
- "--enable-feature=native-histograms"
volumes:
- "./development/prometheus.yaml:/etc/prometheus/prometheus.yaml"
ports:
- "9091:9090" # Prometheus UI
restart: "unless-stopped"
otel-collector:
image: "otel/opentelemetry-collector:0.60.0"
command: "--config /etc/otel-config.yaml"
volumes:
- "./development/otel-config.yaml:/etc/otel-config.yaml"
ports:
- "4317:4317" # OTLP gRPC
- "8888" # Prometheus metrics for collector
depends_on:
- "tempo"
loki:
image: "grafana/loki:2.9.0"
command: "-config.file=/etc/loki/loki.yaml"
volumes:
- "./development/loki.yaml:/etc/loki/loki.yaml"
ports:
- "3100" # Loki API
restart: "unless-stopped"
tempo:
image: "grafana/tempo:1.5.0"
command: "-search.enabled=true -config.file=/etc/tempo.yaml"
volumes:
- "./development/tempo.yaml:/etc/tempo.yaml"
restart: "unless-stopped"
ports:
- "4317" # OTLP gRPC
- "3100" # tempo
grafana:
image: "grafana/grafana:9.1.5-ubuntu"
volumes:
- "./development/grafana/provisioning/datasources:/etc/grafana/provisioning/datasources"
- "./development/grafana/provisioning/dashboards:/etc/grafana/provisioning/dashboards"
- "./development/grafana/dashboards:/etc/grafana/dashboards"
environment:
- "GF_AUTH_ANONYMOUS_ENABLED=true"
- "GF_AUTH_ANONYMOUS_ORG_ROLE=Admin"
- "GF_AUTH_DISABLE_LOGIN_FORM=true"
ports:
- "3000:3000" # UI
depends_on:
- "tempo"
- "prometheus"
- "loki"