You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@servicecomb.apache.org by GitBox <gi...@apache.org> on 2018/08/22 08:21:42 UTC

[GitHub] WillemJiang closed pull request #263: Docs/debugging

WillemJiang closed pull request #263: Docs/debugging
URL: https://github.com/apache/incubator-servicecomb-saga/pull/263
 
 
   

This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:

As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):

diff --git a/README.md b/README.md
index eb009f40..48ca2add 100644
--- a/README.md
+++ b/README.md
@@ -26,6 +26,7 @@ See [Saga Pack Design](docs/design.md) for details.
 * For ServiceComb Java Chassis application, please see [Booking Demo](saga-demo/saga-servicecomb-demo/README.md) for details.
 * For Spring applications, please see [Booking Demo](saga-demo/saga-spring-demo/README.md) for details.
 * For Dubbo applications, please see [Dubbo Demo](saga-demo/saga-dubbo-demo/README.md) for details.
+* To debug the applications, please see [Spring Demo Debugging](saga-demo/saga-spring-demo#debugging) for details.
 
 ## Build and Run the tests from source
 * Build the source code and run the tests
diff --git a/README_ZH.md b/README_ZH.md
index 05314410..200086f9 100644
--- a/README_ZH.md
+++ b/README_ZH.md
@@ -27,6 +27,7 @@ Saga是由 **alpha** 和 **omega**组成,其中:
 * Saga在ServiceComb Java Chassis应用可以参考[出行预订](saga-demo/saga-servicecomb-demo/README.md)
 * Saga在Spring应用的用法可参考[出行预订示例](saga-demo/saga-spring-demo/README.md)。
 * Saga在Dubbo应用的用法可参考[Dubbo示例](saga-demo/saga-dubbo-demo/README.md).
+* Saga的调试方法可以参考[调试Spring示例](saga-demo/saga-spring-demo#debugging).
 
 ## 编译和运行代码
 * 编译代码并且运行相关的单元测试
diff --git a/saga-demo/conditional-transaction-demo/README.md b/saga-demo/conditional-transaction-demo/README.md
index 9ae1deb6..505a6667 100755
--- a/saga-demo/conditional-transaction-demo/README.md
+++ b/saga-demo/conditional-transaction-demo/README.md
@@ -172,3 +172,6 @@ So the 2<sup>nd</sup> request will trigger product replenishment from supplier.
 for simplicity.
 
 To see all events generated by Saga, visit `http://<docker.host.ip>:8083/events` with postman.
+
+## Debugging
+Take the [spring-demo debugging](../saga-spring-demo#debugging) as a reference.
diff --git a/saga-demo/dependency-free-transaction-demo/README.md b/saga-demo/dependency-free-transaction-demo/README.md
index 611dfa5e..4fb6e0f5 100755
--- a/saga-demo/dependency-free-transaction-demo/README.md
+++ b/saga-demo/dependency-free-transaction-demo/README.md
@@ -166,3 +166,6 @@ Sending the request more than once will trigger compensation due to insufficient
 for simplicity.
 
 To see all events generated by Saga, visit `http://<docker.host.ip>:8083/events` with browser.
+
+## Debugging
+Take the [spring-demo debugging](../saga-spring-demo#debugging) as a reference.
diff --git a/saga-demo/saga-dubbo-demo/README.md b/saga-demo/saga-dubbo-demo/README.md
index 098fd853..deadb4f1 100644
--- a/saga-demo/saga-dubbo-demo/README.md
+++ b/saga-demo/saga-dubbo-demo/README.md
@@ -15,6 +15,10 @@ You will need:
 [alpha_server]: https://github.com/apache/incubator-servicecomb-saga/tree/master/alpha
 
 ## Running Demo
-1.mvn clean install -DskipTests -Pdocker
-2. ./saga-dubbo-demo.sh up
+```bash
+$ mvn clean install -DskipTests -Pdocker
+$ ./saga-dubbo-demo.sh up
+```
 
+## Debugging
+Take the [spring-demo debugging](../saga-spring-demo#debugging) as a reference.
diff --git a/saga-demo/saga-servicecomb-demo/README.md b/saga-demo/saga-servicecomb-demo/README.md
index f9cd821a..e08b4160 100644
--- a/saga-demo/saga-servicecomb-demo/README.md
+++ b/saga-demo/saga-servicecomb-demo/README.md
@@ -58,4 +58,7 @@ Check the car booking status with
 ```
 curl http://${host_address}:8082/bookings
 ```
-The second car booking will be marked with **cancel:true**
\ No newline at end of file
+The second car booking will be marked with **cancel:true**
+
+## Debugging
+Take the [spring-demo debugging](../saga-spring-demo#debugging) as a reference.
diff --git a/saga-demo/saga-spring-demo/README.md b/saga-demo/saga-spring-demo/README.md
index a5c7b5ae..05024938 100644
--- a/saga-demo/saga-spring-demo/README.md
+++ b/saga-demo/saga-spring-demo/README.md
@@ -125,3 +125,21 @@ The second car booking will be marked with **cancel:true**
 Open a browser with URL http://127.0.0.1:8083, You will get a html page. You can use this page to invoke test cases, and then get results.
 
 **Note** transactions and compensations implemented by services must be idempotent.
+
+## Debugging
+
+To debug the services of the demo, just add debug parameter to JVM through the environment field in docker-compose configs. Let's take alpha-server as an example:
+
+```yaml
+alpha:
+  image: "alpha-server:${TAG}"
+  environment:
+    - JAVA_OPTS=-Dspring.profiles.active=prd -agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=5005
+  ports:
+    - "6006:5005"
+...
+```
+
+We append the debug parameter `-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=5005` to the JAVA_OPTS environment variable, the Java process inside the container will listen on port 5005. With the port forwarding rule `6006:5005`, when alpha-server is ready, we can connect to port 6006 on the host and start debugging alpha-server.
+
+If  you're using [IntelliJ](https://www.jetbrains.com/idea/), open the saga project, create a new debug configuration with template 'Remote', fill "Host" and "Port" input with "localhost" and "6006", then select "alpha" in the drop-down list of "Use classpath of module". When alpha-server is running, hit shift+f9 to debug the remote application.


 

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services