Commit 2a6926c
fix(consul-postgres-ha): live-test fallout — sidecar registration + self-VIP dispatch
Three issues surfaced from the first end-to-end run on a real
6-CVM dstack cluster:
1. **sidecar registration JSON format**: the brief's plan to use
`consul services register` failed because that CLI takes
HCL-style files with lowercase keys wrapped in `{"service": ...}`,
not the flat capital-letter struct the agent HTTP API takes.
Switched to `curl PUT /v1/agent/service/register` for consistency
with how webdemo registers itself.
2. **service-resolver service-name mismatch**: Patroni auto-registers
the parent service under `<scope>` (= `CLUSTER_NAME`), not under
the literal string `postgres`. Service-resolver entries +
intentions + the postgres-sidecar's `DestinationServiceName` now
parameterize on `${CLUSTER_NAME}` so consumer-facing names
(`postgres-master`/`postgres-replica`) redirect to the actual
Patroni-tagged scope.
3. **self-VIP dispatch**: Consul's "server health" probes self-dial
`127.50.0.<self-vip>:8300`, and mesh-conn dispatched inbound to
`127.0.0.1:port` while Consul (per the brief) also listened on
`127.0.0.1`. Self-dial then failed with connection-refused.
Fixed by (a) `-bind=127.50.0.${SELF_VIP}` so Consul listens on
the self-VIP (which is local-aliased on lo) and (b) mesh-conn's
accept-loop dispatches to `self.vipAddr():port` on the receive
side. Both directions now land on the same listener.
Also adds `MESH_CONN_RELAY_ONLY` as a Terraform variable + plumbs
it through to both coord and worker env so the documented
ICE-flakiness workaround can be flipped without a code change.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>1 parent 1b7aa91 commit 2a6926c
3 files changed
Lines changed: 81 additions & 46 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
101 | 101 | | |
102 | 102 | | |
103 | 103 | | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
104 | 113 | | |
105 | 114 | | |
106 | 115 | | |
| |||
177 | 186 | | |
178 | 187 | | |
179 | 188 | | |
180 | | - | |
| 189 | + | |
| 190 | + | |
181 | 191 | | |
182 | 192 | | |
183 | 193 | | |
| |||
222 | 232 | | |
223 | 233 | | |
224 | 234 | | |
| 235 | + | |
225 | 236 | | |
226 | 237 | | |
227 | 238 | | |
| |||
237 | 248 | | |
238 | 249 | | |
239 | 250 | | |
240 | | - | |
241 | | - | |
242 | | - | |
| 251 | + | |
| 252 | + | |
| 253 | + | |
| 254 | + | |
243 | 255 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
497 | 497 | | |
498 | 498 | | |
499 | 499 | | |
500 | | - | |
| 500 | + | |
501 | 501 | | |
502 | 502 | | |
503 | 503 | | |
| |||
539 | 539 | | |
540 | 540 | | |
541 | 541 | | |
542 | | - | |
| 542 | + | |
| 543 | + | |
| 544 | + | |
| 545 | + | |
| 546 | + | |
| 547 | + | |
| 548 | + | |
| 549 | + | |
543 | 550 | | |
544 | 551 | | |
545 | 552 | | |
| |||
554 | 561 | | |
555 | 562 | | |
556 | 563 | | |
557 | | - | |
558 | | - | |
559 | | - | |
560 | | - | |
| 564 | + | |
| 565 | + | |
| 566 | + | |
| 567 | + | |
| 568 | + | |
561 | 569 | | |
562 | 570 | | |
563 | 571 | | |
| |||
592 | 600 | | |
593 | 601 | | |
594 | 602 | | |
595 | | - | |
| 603 | + | |
596 | 604 | | |
597 | 605 | | |
598 | 606 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
94 | 94 | | |
95 | 95 | | |
96 | 96 | | |
97 | | - | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
98 | 105 | | |
| 106 | + | |
| 107 | + | |
99 | 108 | | |
100 | 109 | | |
101 | 110 | | |
| |||
154 | 163 | | |
155 | 164 | | |
156 | 165 | | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
157 | 170 | | |
158 | 171 | | |
159 | | - | |
160 | | - | |
161 | | - | |
162 | | - | |
163 | | - | |
164 | | - | |
165 | | - | |
166 | | - | |
167 | | - | |
168 | | - | |
169 | | - | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
170 | 182 | | |
171 | | - | |
172 | | - | |
173 | | - | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
174 | 186 | | |
175 | 187 | | |
176 | | - | |
177 | | - | |
178 | | - | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
179 | 191 | | |
180 | 192 | | |
181 | 193 | | |
182 | 194 | | |
183 | 195 | | |
184 | | - | |
185 | | - | |
186 | | - | |
187 | | - | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
188 | 201 | | |
189 | | - | |
| 202 | + | |
| 203 | + | |
190 | 204 | | |
191 | 205 | | |
192 | 206 | | |
| |||
195 | 209 | | |
196 | 210 | | |
197 | 211 | | |
198 | | - | |
| 212 | + | |
199 | 213 | | |
200 | 214 | | |
201 | 215 | | |
| |||
249 | 263 | | |
250 | 264 | | |
251 | 265 | | |
252 | | - | |
253 | | - | |
254 | | - | |
255 | | - | |
| 266 | + | |
| 267 | + | |
| 268 | + | |
| 269 | + | |
| 270 | + | |
256 | 271 | | |
257 | | - | |
| 272 | + | |
258 | 273 | | |
259 | 274 | | |
260 | 275 | | |
261 | 276 | | |
262 | 277 | | |
263 | 278 | | |
264 | | - | |
| 279 | + | |
265 | 280 | | |
266 | 281 | | |
267 | | - | |
| 282 | + | |
268 | 283 | | |
269 | 284 | | |
270 | | - | |
| 285 | + | |
271 | 286 | | |
272 | 287 | | |
273 | | - | |
| 288 | + | |
274 | 289 | | |
275 | 290 | | |
276 | 291 | | |
277 | 292 | | |
278 | 293 | | |
279 | | - | |
| 294 | + | |
280 | 295 | | |
281 | | - | |
| 296 | + | |
282 | 297 | | |
283 | 298 | | |
284 | 299 | | |
| |||
0 commit comments