[ 
https://issues.apache.org/jira/browse/SCB-875?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16596087#comment-16596087
 ] 

ASF GitHub Bot commented on SCB-875:
------------------------------------

WillemJiang closed pull request #279: SCB-875: Start the old saga demo with sh 
script
URL: https://github.com/apache/incubator-servicecomb-saga/pull/279
 
 
   

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/saga-demo/conditional-transaction-demo/README.md 
b/saga-demo/conditional-transaction-demo/README.md
index 505a6667..2f8ce618 100755
--- a/saga-demo/conditional-transaction-demo/README.md
+++ b/saga-demo/conditional-transaction-demo/README.md
@@ -38,14 +38,19 @@ when the recovery policy if backward recovery.
 
 ## Running Demo
 1. run the following command to create docker images in saga project root 
folder.
-```
-mvn package -DskipTests -Pdocker -Pdemo
-```
+       ```
+       mvn package -DskipTests -Pdocker -Pdemo
+       ```
 
 2. start application up in saga/saga-demo/conditional-transaction-demo with 
the following command
-```
-docker-compose up
-```
+    ```
+    chmod +x conditional-transaction-demo.sh
+    ./conditional-transaction-demo.sh up
+    ```
+3. stop application
+   ```
+   ./conditional-transaction-demo.sh down
+   ```
 
 ## User Requests
 The request JSON to ensure the workflow order looks like the following:
diff --git 
a/saga-demo/conditional-transaction-demo/conditional-transaction-demo.sh 
b/saga-demo/conditional-transaction-demo/conditional-transaction-demo.sh
new file mode 100644
index 00000000..2f0c8fe5
--- /dev/null
+++ b/saga-demo/conditional-transaction-demo/conditional-transaction-demo.sh
@@ -0,0 +1,53 @@
+#!/usr/bin/env bash
+
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License.  You may obtain a copy of the License at
+#
+#      http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+service=conditional-transaction-demo
+
+show_usage() {
+  echo "Usage: $0 {up|down}" >&2
+}
+
+fetch_version() {
+  version="$(printf 'VER\t${project.version}' | mvn help:evaluate | grep 
'^VER' | cut -f2)"
+}
+
+if [[ -z $1 ]]; then
+  show_usage
+  exit 2
+fi
+
+case $1 in
+  up)
+    fetch_version
+    echo "Starting ${service}:${version}"
+    TAG=$version docker-compose up
+    exit $?
+  ;;
+
+  down)
+    fetch_version
+    echo "Stopping ${service}:${version}"
+    TAG=$version docker-compose down
+    exit $?
+  ;;
+  
+  *)
+    show_usage
+    exit 2
+  ;;
+esac
+
diff --git a/saga-demo/conditional-transaction-demo/docker-compose.yaml 
b/saga-demo/conditional-transaction-demo/docker-compose.yaml
index b8b1bb62..c9eb9f4c 100755
--- a/saga-demo/conditional-transaction-demo/docker-compose.yaml
+++ b/saga-demo/conditional-transaction-demo/docker-compose.yaml
@@ -34,31 +34,31 @@ services:
         retries: 5
 
   payment:
-    image: "payment:0.3.0-SNAPSHOT"
+    image: "payment:${TAG}"
     hostname: payment
     ports:
       - "8080"
 
   membership:
-    image: "membership:0.3.0-SNAPSHOT"
+    image: "membership:${TAG}"
     hostname: membership
     ports:
       - "8080"
 
   inventory:
-    image: "inventory:0.3.0-SNAPSHOT"
+    image: "inventory:${TAG}"
     hostname: inventory
     ports:
       - "8080"
 
   supplier:
-    image: "supplier:0.3.0-SNAPSHOT"
+    image: "supplier:${TAG}"
     hostname: supplier
     ports:
       - "8080"
 
   saga:
-    image: "saga-spring:0.3.0-SNAPSHOT"
+    image: "saga-spring:${TAG}"
     hostname: saga
     links:
       - "postgres:postgres.servicecomb.io"
diff --git a/saga-demo/dependency-free-transaction-demo/README.md 
b/saga-demo/dependency-free-transaction-demo/README.md
index 4fb6e0f5..9c72e0ee 100755
--- a/saga-demo/dependency-free-transaction-demo/README.md
+++ b/saga-demo/dependency-free-transaction-demo/README.md
@@ -25,14 +25,19 @@ User ---> Saga -----> flight booking service
 
 ## Running Demo
 1. run the following command to create docker images in saga project root 
folder.
-```
-mvn package -DskipTests -Pdocker -Pdemo
-```
+       ```
+       mvn package -DskipTests -Pdocker -Pdemo
+       ```
 
 2. start application up in saga/saga-demo/dependency-free-transaction-demo 
with the following command
-```
-docker-compose up
-```
+    ```
+    chmod +x dependency-free-transaction-demo.sh
+    ./dependency-free-transaction-demo.sh up
+    ```
+3. stop application
+   ```
+   ./dependency-free-transaction-demo.sh down
+   ```
 
 ## User Requests
 A user normally expects to make payment only when transactions with all three 
services are completed successfully. So Saga
diff --git 
a/saga-demo/dependency-free-transaction-demo/dependency-free-transaction-demo.sh
 
b/saga-demo/dependency-free-transaction-demo/dependency-free-transaction-demo.sh
new file mode 100644
index 00000000..d0aa52b7
--- /dev/null
+++ 
b/saga-demo/dependency-free-transaction-demo/dependency-free-transaction-demo.sh
@@ -0,0 +1,53 @@
+#!/usr/bin/env bash
+
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License.  You may obtain a copy of the License at
+#
+#      http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+service=dependency-free-transaction-demo
+
+show_usage() {
+  echo "Usage: $0 {up|down}" >&2
+}
+
+fetch_version() {
+  version="$(printf 'VER\t${project.version}' | mvn help:evaluate | grep 
'^VER' | cut -f2)"
+}
+
+if [[ -z $1 ]]; then
+  show_usage
+  exit 2
+fi
+
+case $1 in
+  up)
+    fetch_version
+    echo "Starting ${service}:${version}"
+    TAG=$version docker-compose up
+    exit $?
+  ;;
+
+  down)
+    fetch_version
+    echo "Stopping ${service}:${version}"
+    TAG=$version docker-compose down
+    exit $?
+  ;;
+  
+  *)
+    show_usage
+    exit 2
+  ;;
+esac
+
diff --git a/saga-demo/dependency-free-transaction-demo/docker-compose.yaml 
b/saga-demo/dependency-free-transaction-demo/docker-compose.yaml
index 5bf86604..4c85dda1 100755
--- a/saga-demo/dependency-free-transaction-demo/docker-compose.yaml
+++ b/saga-demo/dependency-free-transaction-demo/docker-compose.yaml
@@ -40,7 +40,7 @@ services:
         retries: 5
 
   car-rental-service:
-    image: "car-rental-service:0.3.0-SNAPSHOT"
+    image: "car-rental-service:${TAG}"
     hostname: car
     links:
       - "service-center:sc.servicecomb.io"
@@ -48,7 +48,7 @@ services:
       - "8080"
 
   flight-booking-service:
-    image: "flight-booking-service:0.3.0-SNAPSHOT"
+    image: "flight-booking-service:${TAG}"
     hostname: flight
     links:
       - "service-center:sc.servicecomb.io"
@@ -56,7 +56,7 @@ services:
       - "8080"
 
   hotel-reservation-service:
-    image: "hotel-reservation-service:0.3.0-SNAPSHOT"
+    image: "hotel-reservation-service:${TAG}"
     hostname: hotel
     links:
       - "service-center:sc.servicecomb.io"
@@ -64,7 +64,7 @@ services:
       - "8080"
 
   payment-service:
-    image: "payment-service:0.3.0-SNAPSHOT"
+    image: "payment-service:${TAG}"
     hostname: payment
     links:
       - "service-center:sc.servicecomb.io"
@@ -72,7 +72,7 @@ services:
       - "8080"
 
   saga:
-    image: "saga-spring:0.3.0-SNAPSHOT"
+    image: "saga-spring:${TAG}"
     hostname: saga
     links:
       - "postgres:postgres.servicecomb.io"
@@ -90,7 +90,7 @@ services:
         condition: service_healthy
 
   web:
-    image: "saga-web:0.3.0-SNAPSHOT"
+    image: "saga-web:${TAG}"
     hostname: web
     links:
       - "service-center:sc.servicecomb.io"
diff --git a/saga-demo/saga-servicecomb-demo/README.md 
b/saga-demo/saga-servicecomb-demo/README.md
index e08b4160..96a7b803 100644
--- a/saga-demo/saga-servicecomb-demo/README.md
+++ b/saga-demo/saga-servicecomb-demo/README.md
@@ -26,11 +26,19 @@ You can run the demo using either docker compose or 
executable files.
    ```
    mvn clean package -DskipTests -Pdocker -Pdemo
    ```
-2. start the whole application up(including alpha server and three demo 
services)
+2. Enter the saga servicecomb demo directory and give permissions to script
    ```
-   docker-compose up
+   cd ./saga-demo/saga-servicecomb-demo
+   chmod +x saga-servicecomb-demo.sh
+   ```
+3. start the whole application up(including alpha server and three demo 
services)
+    ```
+    ./saga-servicecomb-demo.sh up
+    ```
+4. stop application
+   ```
+   ./saga-servicecomb-demo.sh down
    ```
-
 ## User Requests by command line tools
 1. Booking 2 rooms and 2 cars, this booking will be OK.
 ```
diff --git a/saga-demo/saga-servicecomb-demo/docker-compose.yaml 
b/saga-demo/saga-servicecomb-demo/docker-compose.yaml
index b6e6b382..036a2060 100644
--- a/saga-demo/saga-servicecomb-demo/docker-compose.yaml
+++ b/saga-demo/saga-servicecomb-demo/docker-compose.yaml
@@ -32,7 +32,7 @@ services:
         retries: 5
 
   alpha:
-    image: "alpha-server:0.3.0-SNAPSHOT"
+    image: "alpha-server:${TAG}"
     hostname: alpha-server
     links:
       - "database:postgresql.servicecomb.io"
@@ -54,7 +54,7 @@ services:
       - "30100:30100"
 
   hotel:
-    image: "scb-hotel:0.3.0-SNAPSHOT"
+    image: "scb-hotel:${TAG}"
     hostname: hotel
     links:
       - "alpha:alpha-server.servicecomb.io"
@@ -66,7 +66,7 @@ services:
         condition: service_healthy
 
   car:
-    image: "scb-car:0.3.0-SNAPSHOT"
+    image: "scb-car:${TAG}"
     hostname: car
     links:
       - "alpha:alpha-server.servicecomb.io"
@@ -78,7 +78,7 @@ services:
         condition: service_healthy
 
   booking:
-    image: "scb-booking:0.3.0-SNAPSHOT"
+    image: "scb-booking:${TAG}"
     hostname: booking
     links:
       - "alpha:alpha-server.servicecomb.io"
diff --git a/saga-demo/saga-servicecomb-demo/saga-servicecomb-demo.sh 
b/saga-demo/saga-servicecomb-demo/saga-servicecomb-demo.sh
new file mode 100644
index 00000000..90aeffd8
--- /dev/null
+++ b/saga-demo/saga-servicecomb-demo/saga-servicecomb-demo.sh
@@ -0,0 +1,53 @@
+#!/usr/bin/env bash
+
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License.  You may obtain a copy of the License at
+#
+#      http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+service=saga-servicecomb-demo
+
+show_usage() {
+  echo "Usage: $0 {up|down}" >&2
+}
+
+fetch_version() {
+  version="$(printf 'VER\t${project.version}' | mvn help:evaluate | grep 
'^VER' | cut -f2)"
+}
+
+if [[ -z $1 ]]; then
+  show_usage
+  exit 2
+fi
+
+case $1 in
+  up)
+    fetch_version
+    echo "Starting ${service}:${version}"
+    TAG=$version docker-compose up
+    exit $?
+  ;;
+
+  down)
+    fetch_version
+    echo "Stopping ${service}:${version}"
+    TAG=$version docker-compose down
+    exit $?
+  ;;
+  
+  *)
+    show_usage
+    exit 2
+  ;;
+esac
+


 

----------------------------------------------------------------
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:
us...@infra.apache.org


> Start the old saga demo with sh script
> --------------------------------------
>
>                 Key: SCB-875
>                 URL: https://issues.apache.org/jira/browse/SCB-875
>             Project: Apache ServiceComb
>          Issue Type: Improvement
>          Components: Saga
>            Reporter: Willem Jiang
>            Priority: Major
>             Fix For: saga-0.3.0
>
>
> As we put the old saga demo back, we need to update the docker-compose file 
> according to the sage-spring-demo. In this way we don't need to change the 
> version of image after the project version is changed. 



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to