Skip to content
This repository was archived by the owner on Oct 23, 2024. It is now read-only.

Commit a35a115

Browse files
authored
[TOOLS] Support remote debugging in helloworld framework (#2660)
Add debug cmd to helloworld
1 parent 237f2ad commit a35a115

File tree

3 files changed

+30
-1
lines changed

3 files changed

+30
-1
lines changed

TESTING.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -130,3 +130,10 @@ Running
130130
./test.sh --help
131131
```
132132
Will show all the options that are available for the `test.sh` script.
133+
134+
#### Experimental Commands
135+
136+
Remote debugging is supported in `helloworld` framework. This is ONLY for developing purposes. You can launch the `helloworld` framework with debugging as using the `debug` section of config.json. Once the marathon app for scheduler is ready, bind to the remote port using
137+
`ssh -L ${DEBUG_PORT:-6242}:${CUSTOM_SERVICE_NAME:-"hello-world"}.marathon.mesos:${DEBUG_PORT:-6242} -N core@${MASTER_IP}`
138+
139+
SDK prints GIT SHA of its build at bootstrap and that can be used to checkout the current codebase. Connect to the above debug server and you should be able to remotely debug the scheduler.

frameworks/helloworld/universe/config.json

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -144,6 +144,28 @@
144144
}
145145
}
146146
},
147+
"debug" : {
148+
"description": "Config to start the scheduler with remote debug options enabled. THIS SHOULD NOT HAVE ANY DEFAULTS",
149+
"type": "object",
150+
"properties" : {
151+
"suspend": {
152+
"description": "Suspend the JVM until a debugger is attached",
153+
"type": "string",
154+
"enum":[
155+
"y",
156+
"n"
157+
]
158+
},
159+
"address": {
160+
"description": "Interface to listen. This is a string to support *:6242 style to bind to all interfaces",
161+
"type": "string"
162+
}
163+
},
164+
"required": [
165+
"suspend",
166+
"address"
167+
]
168+
},
147169
"hello": {
148170
"description": "Hello pod configuration properties",
149171
"type": "object",

frameworks/helloworld/universe/marathon.json.mustache

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
"mem": 1024,
55
"instances": 1,
66
"user": "{{service.user}}",
7-
"cmd": "export LD_LIBRARY_PATH=$MESOS_SANDBOX/libmesos-bundle/lib:$LD_LIBRARY_PATH; export MESOS_NATIVE_JAVA_LIBRARY=$(ls $MESOS_SANDBOX/libmesos-bundle/lib/libmesos-*.so); export JAVA_HOME=$(ls -d $MESOS_SANDBOX/jdk*/jre/); export JAVA_HOME=${JAVA_HOME%/}; export PATH=$(ls -d $JAVA_HOME/bin):$PATH && export JAVA_OPTS=\"-Xms256M -Xmx512M -XX:-HeapDumpOnOutOfMemoryError\" && ./bootstrap -resolve=false -template=false && ./hello-world-scheduler/bin/helloworld {{service.yaml}} {{service.yamls}}",
7+
"cmd": "export LD_LIBRARY_PATH=$MESOS_SANDBOX/libmesos-bundle/lib:$LD_LIBRARY_PATH; export MESOS_NATIVE_JAVA_LIBRARY=$(ls $MESOS_SANDBOX/libmesos-bundle/lib/libmesos-*.so); export JAVA_HOME=$(ls -d $MESOS_SANDBOX/jdk*/jre/); export JAVA_HOME=${JAVA_HOME%/}; export PATH=$(ls -d $JAVA_HOME/bin):$PATH && export JAVA_OPTS=\"-Xms256M -Xmx512M -XX:-HeapDumpOnOutOfMemoryError {{#debug}}-agentlib:jdwp=transport=dt_socket,server=y,suspend={{debug.suspend}},address={{debug.address}}{{/debug}}\" && ./bootstrap -resolve=false -template=false && ./hello-world-scheduler/bin/helloworld {{service.yaml}} {{service.yamls}}",
88
"constraints": {{service.constraints}},
99
"labels": {
1010
"DCOS_COMMONS_API_VERSION": "v1",

0 commit comments

Comments
 (0)