Skip to content

Commit 18f10b1

Browse files
committed
add --xud.debug
1 parent 9c4c634 commit 18f10b1

File tree

6 files changed

+25
-2
lines changed

6 files changed

+25
-2
lines changed

images/utils/launcher/config/config.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -365,6 +365,12 @@ def parse_command_line_arguments(self):
365365
action="store_true",
366366
help="Preserve xud xud.conf file during updates"
367367
)
368+
group.add_argument(
369+
"--xud.debug",
370+
nargs='?',
371+
metavar="<port>",
372+
help="Run xud with NodeJS --inspect option on specific port (default: 9229)"
373+
)
368374

369375
group = parser.add_argument_group("arby")
370376
group.add_argument(
@@ -778,6 +784,9 @@ def update_xud(self, parsed):
778784
"""
779785
node = self.nodes["xud"]
780786
self.update_ports(node, parsed)
787+
node["debug"] = self._get_value("debug", node, parsed, converter=lambda v: int(v))
788+
if node["debug"]:
789+
node["ports"].append(PortPublish("%s" % node["debug"]))
781790

782791
def update_disabled(self, node, parsed, opt):
783792
if "disabled" in parsed:

images/utils/launcher/config/mainnet.conf

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,7 @@
131131
# 8886 - gRPC port
132132
# 8080 - webproxy port
133133
#expose-ports = ["8885", "8886", "8080"]
134+
#debug = 9229
134135

135136
[arby]
136137
#live-cex="false"

images/utils/launcher/config/simnet.conf

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@
4444
# 28886 - gRPC port
4545
# 28080 - webproxy port
4646
#expose-ports = ["28885", "28886", "28080:8080"]
47+
#debug = 9229
4748

4849
[arby]
4950
#live-cex="false"

images/utils/launcher/config/testnet.conf

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,7 @@
131131
# 18886 - gRPC port
132132
# 18080 - webproxy port
133133
#expose-ports = ["18885", "18886", "18080:8080"]
134+
#debug = 9229
134135

135136
[arby]
136137
#live-cex="false"

images/utils/launcher/node/xud.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,11 @@ def _get_environment(self) -> List[str]:
9696
"LNDLTC_MACAROONPATH={}".format(lndbtc["macaroonpath"]),
9797
])
9898

99+
if "debug" in self.node_config:
100+
debug_port = self.node_config["debug"]
101+
if debug_port:
102+
env.append(f"DEBUG_PORT={debug_port}")
103+
99104
return env
100105

101106
def status(self):

images/xud/entrypoint.sh

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -160,5 +160,11 @@ update_lnds "${ARR[@]}"
160160

161161
/xud-backup.sh &
162162

163-
# use exec to properly respond to SIGINT
164-
exec xud $@
163+
164+
if [[ -n ${DEBUG_PORT:-} ]]; then
165+
export NODE_ENV=development
166+
exec node --inspect-brk="0.0.0.0:$DEBUG_PORT" bin/xud
167+
else
168+
# use exec to properly respond to SIGINT
169+
exec xud "$@"
170+
fi

0 commit comments

Comments
 (0)