Remote debug the invoker and controller in docker-compose (#169)
* Remote debug the invoker and controller in docker-compose
* Documentation on how to set up IntelliJ for remote debugging
diff --git a/docker-compose/README.md b/docker-compose/README.md
index 22fafbe..3b07e05 100644
--- a/docker-compose/README.md
+++ b/docker-compose/README.md
@@ -22,8 +22,8 @@
- `6379` for Redis
- `2181` for Zookeeper
- `5984` for CouchDB
-- `8085` for OpenWhisk's Invoker
-- `8888` for OpenWhisk's Controller
+- `8085`, `9333` for OpenWhisk's Invoker
+- `8888`, `9222` for OpenWhisk's Controller
- `9092` for Kafka
- `8001` for Kafka Topics UI
@@ -199,6 +199,25 @@
- Feed provider instance logs - `~/tmp/openwhisk/<feed_name>provider`
- Action output such as stdout or console.log(): `wsk -i activation logs <activationId>`
+## Debugging OpenWhisk Invoker and Controller
+Both invoker and controller can be remotely debugged using any preferred IDE by setting these command line arguments for the remote JVM:
+
+```
+-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=$port
+```
+These ports are available for debugging on `localhost`:
+- `9333` for the Invoker
+- `9222` for the Controller
+
+Using IntelliJ:
+
+Follow these steps to create a new `Run/Debug Configuration` for the `Invoker`. Same can be done for the `Controller`:
+- Go to `Run` -> `Edit Configurations` -> `Add new Configuration` -> `Remote`
+- Change port to `9333` and leave the host as `localhost`
+- You can now debug the `Invoker` remotely by setting breakpoints inside the code
+
+> Please be aware that changes done in the code are not automatically deployed. In order to be able to debug new changes, you need to rebuild the application and redeploy it with `docker-compose`.
+
## Custom Docker containers for actions
diff --git a/docker-compose/docker-compose.yml b/docker-compose/docker-compose.yml
index 729bf25..b33226f 100644
--- a/docker-compose/docker-compose.yml
+++ b/docker-compose/docker-compose.yml
@@ -75,6 +75,7 @@
ports:
- "8888:8888"
- "2551:2551"
+ - "9222:9222"
# WHISK INVOKER AGENT
invoker:
@@ -121,6 +122,7 @@
- /sys/fs/cgroup:/sys/fs/cgroup
ports:
- "8085:8085"
+ - "9333:9222"
# The API Gateway is currently used to expose the Controller API
# see apigateway/conf/whisk-docker-compose.conf
diff --git a/docker-compose/docker-whisk-controller.env b/docker-compose/docker-whisk-controller.env
index cccf79f..8d2b459 100644
--- a/docker-compose/docker-whisk-controller.env
+++ b/docker-compose/docker-whisk-controller.env
@@ -40,7 +40,7 @@
CONFIG_whisk_containerPool_userMemory=1024m
CONTROLLER_BLACKBOXFRACTION=0.10
-CONTROLLER_OPTS=-Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.ssl=false -Dcom.sun.management.jmxremote.authenticate=false -Dcom.sun.management.jmxremote.port=1098
+CONTROLLER_OPTS=-Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.ssl=false -Dcom.sun.management.jmxremote.authenticate=false -Dcom.sun.management.jmxremote.port=1098 -Xdebug -Xrunjdwp:transport=dt_socket,address=9222,server=y,suspend=n
CONTROLLER_HA=False
CONTROLLER_INSTANCES=1
CONTROLLER_LOCALBOOKKEEPING=true
@@ -53,7 +53,7 @@
LOADBALANCER_USERMEMORY=1024m
CONFIG_whisk_docker_containerFactory_useRunc=False
-INVOKER_OPTS=-Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.ssl=false -Dcom.sun.management.jmxremote.authenticate=false -Dcom.sun.management.jmxremote.port=1098
+INVOKER_OPTS=-Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.ssl=false -Dcom.sun.management.jmxremote.authenticate=false -Dcom.sun.management.jmxremote.port=1098 -Xdebug -Xrunjdwp:transport=dt_socket,address=9222,server=y,suspend=n
INVOKER_INSTANCES=1
AKKA_CLUSTER_HOST=localhost