Commit e55b6bd
authored
MM-60255: Address once and for all the remote-exec error (#973)
* Migrate instance provisioning to cloud-init
Replace Terraform `file` + `remote-exec` provisioner blocks across all
instance types (app, metrics, proxy, agent, job, keycloak, etc.) with a
single `user_data.sh.tpl` template that embeds the provisioner scripts
inline via cloud-init. This eliminates the need for SSH connection
blocks during `terraform apply` and makes provisioning more reliable.
* Set USER and HOME in cloud-init user_data template
Cloud-init runs user_data as root with a minimal environment, so
$HOME and $USER are unset or point to root. Export them as the AMI
user so provisioner scripts (nvm, otel-collector, keycloak) install
files to the correct locations. Also replaces `$(whoami)` calls in
RHEL scripts with `${USER}` for consistency.
* Upload license via SSH instead of file provisioner
Replace the Terraform `file` provisioner blocks for the license file
on app and job servers with an explicit SSH upload in `setupAppServer`.
* Remove connection blocks from Terraform instances
These `connection` blocks were used by `remote-exec` and `file`
provisioners which have been replaced by cloud-init user_data.
They are now unused and can be safely removed.
* Remove connection blocks from Terraform instances
These `connection` blocks were used by `remote-exec` and `file`
provisioners which have been replaced by cloud-init user_data.
They are now unused and can be safely removed.
* Use templated user for otelcol-contrib service
The sed commands that configure the otelcol-contrib systemd service
were hardcoding User=ubuntu and Group=ubuntu. Use ${USER} instead
so the service runs as the same runtime user as the rest of the
provisioner script.
* Write failure sentinel when provisioner.sh exits non-zero
On failure, write the exit code to provisioning-exitcode and touch
provisioning-failed. The waitForProvisioning poller now checks for
the failure sentinel each iteration and aborts immediately instead
of waiting for the full timeout.
* Add per-attempt dial timeout to SSH retry loop
NewClientWithRetry now computes remaining time each iteration and
passes min(backoff, remaining) as the dial timeout via a new
newClientWithTimeout helper that sets ssh.ClientConfig.Timeout,
preventing a single ssh.Dial from blocking past the deadline.
* Capture provisioner exit code before branching
Run /tmp/provisioner.sh with || to capture its exit code into a
variable before the conditional, rather than relying on $? inside the
else branch which is fragile if any command is inserted between the
condition and the echo.
* Use ${USER} in Debian provisioner sed commands
The agent.sh and rhel/common.sh provisioners already use ${USER} for the
otelcol-contrib service unit. Apply the same pattern to proxy.sh, job.sh,
and app.sh so the service runs as the configured AMI user.
* Fix double-budget issue in provisioning timeout
Track elapsed time during SSH connection so the polling loop uses only
the remaining budget instead of starting a fresh full timeout.1 parent 7cdbb5f commit e55b6bd
File tree
17 files changed
+276
-259
lines changed- deployment/terraform
- assets
- provisioners
- debian
- rhel
- ssh
17 files changed
+276
-259
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
51 | 51 | | |
52 | 52 | | |
53 | 53 | | |
54 | | - | |
55 | | - | |
56 | | - | |
57 | | - | |
58 | | - | |
59 | | - | |
60 | 54 | | |
61 | 55 | | |
62 | 56 | | |
| |||
75 | 69 | | |
76 | 70 | | |
77 | 71 | | |
78 | | - | |
79 | | - | |
80 | | - | |
81 | | - | |
82 | | - | |
83 | | - | |
84 | | - | |
85 | | - | |
86 | | - | |
87 | | - | |
88 | | - | |
89 | | - | |
90 | | - | |
91 | | - | |
92 | | - | |
93 | | - | |
94 | | - | |
95 | | - | |
96 | | - | |
97 | | - | |
98 | | - | |
99 | | - | |
100 | | - | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
101 | 78 | | |
102 | 79 | | |
103 | 80 | | |
| |||
204 | 181 | | |
205 | 182 | | |
206 | 183 | | |
207 | | - | |
208 | | - | |
209 | | - | |
210 | | - | |
211 | | - | |
212 | | - | |
213 | 184 | | |
214 | 185 | | |
215 | 186 | | |
| |||
228 | 199 | | |
229 | 200 | | |
230 | 201 | | |
231 | | - | |
232 | | - | |
233 | | - | |
234 | | - | |
235 | | - | |
236 | | - | |
237 | | - | |
238 | | - | |
239 | | - | |
240 | | - | |
241 | | - | |
242 | | - | |
243 | | - | |
244 | | - | |
245 | | - | |
246 | | - | |
247 | | - | |
248 | | - | |
249 | | - | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
250 | 208 | | |
251 | 209 | | |
252 | 210 | | |
| |||
271 | 229 | | |
272 | 230 | | |
273 | 231 | | |
274 | | - | |
275 | | - | |
276 | | - | |
277 | | - | |
278 | | - | |
279 | | - | |
280 | | - | |
281 | | - | |
282 | | - | |
283 | | - | |
284 | | - | |
285 | | - | |
286 | | - | |
287 | | - | |
288 | | - | |
289 | | - | |
290 | | - | |
291 | | - | |
292 | | - | |
293 | | - | |
294 | | - | |
295 | | - | |
296 | | - | |
297 | | - | |
298 | | - | |
| 232 | + | |
| 233 | + | |
| 234 | + | |
| 235 | + | |
| 236 | + | |
| 237 | + | |
299 | 238 | | |
300 | 239 | | |
301 | 240 | | |
| |||
448 | 387 | | |
449 | 388 | | |
450 | 389 | | |
451 | | - | |
452 | | - | |
453 | | - | |
454 | | - | |
455 | | - | |
456 | | - | |
457 | 390 | | |
458 | 391 | | |
459 | 392 | | |
| |||
470 | 403 | | |
471 | 404 | | |
472 | 405 | | |
473 | | - | |
474 | | - | |
475 | | - | |
476 | | - | |
477 | | - | |
478 | | - | |
479 | | - | |
480 | | - | |
481 | | - | |
482 | | - | |
483 | | - | |
484 | | - | |
485 | | - | |
486 | | - | |
487 | | - | |
488 | | - | |
489 | | - | |
490 | | - | |
491 | | - | |
| 406 | + | |
| 407 | + | |
| 408 | + | |
| 409 | + | |
| 410 | + | |
| 411 | + | |
492 | 412 | | |
493 | 413 | | |
494 | 414 | | |
495 | 415 | | |
496 | 416 | | |
497 | 417 | | |
498 | 418 | | |
499 | | - | |
500 | | - | |
501 | | - | |
502 | | - | |
503 | | - | |
504 | | - | |
505 | 419 | | |
506 | 420 | | |
507 | 421 | | |
| |||
518 | 432 | | |
519 | 433 | | |
520 | 434 | | |
521 | | - | |
522 | | - | |
523 | | - | |
524 | | - | |
525 | | - | |
526 | | - | |
527 | | - | |
528 | | - | |
529 | | - | |
530 | | - | |
531 | | - | |
532 | | - | |
533 | | - | |
534 | | - | |
535 | | - | |
536 | | - | |
537 | | - | |
538 | | - | |
539 | | - | |
| 435 | + | |
| 436 | + | |
| 437 | + | |
| 438 | + | |
| 439 | + | |
| 440 | + | |
540 | 441 | | |
541 | 442 | | |
542 | 443 | | |
| |||
936 | 837 | | |
937 | 838 | | |
938 | 839 | | |
939 | | - | |
940 | | - | |
941 | | - | |
942 | | - | |
943 | | - | |
944 | | - | |
945 | 840 | | |
946 | 841 | | |
947 | 842 | | |
| |||
958 | 853 | | |
959 | 854 | | |
960 | 855 | | |
961 | | - | |
962 | | - | |
963 | | - | |
964 | | - | |
965 | | - | |
966 | | - | |
967 | | - | |
968 | | - | |
969 | | - | |
970 | | - | |
971 | | - | |
972 | | - | |
973 | | - | |
974 | | - | |
975 | | - | |
976 | | - | |
977 | | - | |
978 | | - | |
979 | | - | |
980 | | - | |
981 | | - | |
982 | | - | |
983 | | - | |
984 | | - | |
| 856 | + | |
| 857 | + | |
| 858 | + | |
| 859 | + | |
| 860 | + | |
| 861 | + | |
985 | 862 | | |
986 | 863 | | |
987 | 864 | | |
| |||
1002 | 879 | | |
1003 | 880 | | |
1004 | 881 | | |
1005 | | - | |
1006 | | - | |
1007 | | - | |
1008 | | - | |
1009 | | - | |
1010 | | - | |
1011 | 882 | | |
1012 | 883 | | |
1013 | 884 | | |
| |||
1024 | 895 | | |
1025 | 896 | | |
1026 | 897 | | |
1027 | | - | |
1028 | | - | |
1029 | | - | |
1030 | | - | |
1031 | | - | |
1032 | | - | |
1033 | | - | |
1034 | | - | |
1035 | | - | |
1036 | | - | |
1037 | | - | |
1038 | | - | |
1039 | | - | |
1040 | | - | |
1041 | | - | |
1042 | | - | |
1043 | | - | |
1044 | | - | |
| 898 | + | |
| 899 | + | |
| 900 | + | |
| 901 | + | |
| 902 | + | |
| 903 | + | |
1045 | 904 | | |
1046 | 905 | | |
1047 | 906 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
7 | | - | |
8 | | - | |
9 | | - | |
10 | | - | |
11 | | - | |
12 | | - | |
13 | 7 | | |
14 | 8 | | |
15 | 9 | | |
| |||
26 | 20 | | |
27 | 21 | | |
28 | 22 | | |
29 | | - | |
30 | | - | |
31 | | - | |
32 | | - | |
33 | | - | |
34 | | - | |
35 | | - | |
36 | | - | |
37 | | - | |
38 | | - | |
39 | | - | |
40 | | - | |
41 | | - | |
42 | | - | |
43 | | - | |
44 | | - | |
45 | | - | |
46 | | - | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
47 | 29 | | |
48 | 30 | | |
49 | 31 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
5 | | - | |
6 | | - | |
7 | | - | |
8 | | - | |
9 | | - | |
10 | | - | |
11 | 5 | | |
12 | 6 | | |
13 | 7 | | |
| |||
26 | 20 | | |
27 | 21 | | |
28 | 22 | | |
29 | | - | |
| 23 | + | |
30 | 24 | | |
31 | 25 | | |
32 | | - | |
33 | | - | |
| 26 | + | |
| 27 | + | |
34 | 28 | | |
| 29 | + | |
35 | 30 | | |
36 | 31 | | |
37 | 32 | | |
| |||
0 commit comments