Commit 0c229a6
authored
feat(spin-node): --detach for persistent local devnets + --dockerWithSudo for genesis (#181)
* feat(spin-node): add --detach to keep local devnets running after exit
Local docker mode ran each node in the foreground and tore the devnet down on exit (SIGINT/SIGTERM trap -> kill -9, plus --rm), so it never survived spin-node.sh returning. The opt-in --detach flag runs nodes with 'docker run -d --restart unless-stopped' and skips the wait/cleanup, leaving the devnet running once the script ends.
The existing --stop already tears these down (docker rm -f overrides the restart policy); the detach summary now points at it for discoverability.
* fix(genesis): add --dockerWithSudo so genesis gen works where docker needs root
generate-genesis.sh called docker directly for hash-sig keygen and PK's genesis tool, so on hosts where the docker socket requires root (user not in the docker group) 'spin-node.sh --generateGenesis' failed at keygen with permission denied. Add a --dockerWithSudo flag that sudo-prefixes those docker calls (via $DOCKER_CMD), and forward it from set-up.sh when spin-node.sh receives --dockerWithSudo.
* fix(spin-node): restrict --detach to docker mode and make detach hints sudo-aware
Address PR review:
- Fail fast if --detach is used with a binary node. --detach relies on
docker's --restart unless-stopped to outlive the script; a binary has no
supervisor, so it would run in the foreground (or die on exit). Guard it
right after the client cmd is sourced (earliest point node_setup is known).
- Make the detached-mode hints honor --dockerWithSudo: prefix docker logs/rm
with sudo and forward --dockerWithSudo to the suggested --stop command, so
copy-pasted hints work on hosts where the docker socket needs root.1 parent f17682d commit 0c229a6
4 files changed
Lines changed: 78 additions & 18 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
90 | 90 | | |
91 | 91 | | |
92 | 92 | | |
| 93 | + | |
93 | 94 | | |
94 | 95 | | |
95 | 96 | | |
| |||
128 | 129 | | |
129 | 130 | | |
130 | 131 | | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
131 | 136 | | |
132 | 137 | | |
133 | 138 | | |
| |||
274 | 279 | | |
275 | 280 | | |
276 | 281 | | |
277 | | - | |
| 282 | + | |
278 | 283 | | |
279 | | - | |
| 284 | + | |
280 | 285 | | |
281 | 286 | | |
282 | 287 | | |
| |||
469 | 474 | | |
470 | 475 | | |
471 | 476 | | |
472 | | - | |
| 477 | + | |
473 | 478 | | |
474 | | - | |
| 479 | + | |
475 | 480 | | |
476 | 481 | | |
477 | 482 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
134 | 134 | | |
135 | 135 | | |
136 | 136 | | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
137 | 143 | | |
138 | 144 | | |
139 | 145 | | |
| |||
191 | 197 | | |
192 | 198 | | |
193 | 199 | | |
| 200 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
33 | 33 | | |
34 | 34 | | |
35 | 35 | | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
36 | 41 | | |
37 | | - | |
| 42 | + | |
38 | 43 | | |
39 | 44 | | |
40 | 45 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
908 | 908 | | |
909 | 909 | | |
910 | 910 | | |
| 911 | + | |
| 912 | + | |
| 913 | + | |
| 914 | + | |
| 915 | + | |
| 916 | + | |
| 917 | + | |
| 918 | + | |
| 919 | + | |
911 | 920 | | |
912 | 921 | | |
913 | 922 | | |
| |||
927 | 936 | | |
928 | 937 | | |
929 | 938 | | |
930 | | - | |
| 939 | + | |
| 940 | + | |
| 941 | + | |
| 942 | + | |
| 943 | + | |
| 944 | + | |
| 945 | + | |
| 946 | + | |
931 | 947 | | |
932 | 948 | | |
933 | 949 | | |
| |||
961 | 977 | | |
962 | 978 | | |
963 | 979 | | |
| 980 | + | |
| 981 | + | |
| 982 | + | |
| 983 | + | |
| 984 | + | |
| 985 | + | |
| 986 | + | |
964 | 987 | | |
965 | 988 | | |
966 | 989 | | |
| |||
1066 | 1089 | | |
1067 | 1090 | | |
1068 | 1091 | | |
1069 | | - | |
1070 | | - | |
1071 | | - | |
1072 | | - | |
1073 | | - | |
1074 | | - | |
1075 | | - | |
1076 | | - | |
1077 | | - | |
| 1092 | + | |
| 1093 | + | |
| 1094 | + | |
| 1095 | + | |
| 1096 | + | |
| 1097 | + | |
| 1098 | + | |
| 1099 | + | |
| 1100 | + | |
| 1101 | + | |
| 1102 | + | |
| 1103 | + | |
| 1104 | + | |
| 1105 | + | |
| 1106 | + | |
| 1107 | + | |
| 1108 | + | |
| 1109 | + | |
1078 | 1110 | | |
1079 | | - | |
1080 | | - | |
| 1111 | + | |
| 1112 | + | |
| 1113 | + | |
| 1114 | + | |
| 1115 | + | |
| 1116 | + | |
| 1117 | + | |
| 1118 | + | |
| 1119 | + | |
| 1120 | + | |
| 1121 | + | |
| 1122 | + | |
| 1123 | + | |
| 1124 | + | |
1081 | 1125 | | |
1082 | | - | |
| |||
0 commit comments