This is an automated email from the ASF dual-hosted git repository.

ningjiang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-servicecomb-saga.git


The following commit(s) were added to refs/heads/master by this push:
     new b44697c  SCB-875: Start the old saga demo with sh script (#279)
b44697c is described below

commit b44697c0d1550140e11c0134045d3c866c4b7b93
Author: fcg <565817...@qq.com>
AuthorDate: Wed Aug 29 16:48:25 2018 +0800

    SCB-875: Start the old saga demo with sh script (#279)
    
     SCB-875: Start the old saga demo with sh script
    https://issues.apache.org/jira/browse/SCB-875
---
 saga-demo/conditional-transaction-demo/README.md   | 17 ++++---
 .../conditional-transaction-demo.sh                | 53 ++++++++++++++++++++++
 .../docker-compose.yaml                            | 10 ++--
 .../dependency-free-transaction-demo/README.md     | 17 ++++---
 .../dependency-free-transaction-demo.sh            | 53 ++++++++++++++++++++++
 .../docker-compose.yaml                            | 12 ++---
 saga-demo/saga-servicecomb-demo/README.md          | 14 ++++--
 .../saga-servicecomb-demo/docker-compose.yaml      |  8 ++--
 .../saga-servicecomb-demo/saga-servicecomb-demo.sh | 53 ++++++++++++++++++++++
 9 files changed, 207 insertions(+), 30 deletions(-)

diff --git a/saga-demo/conditional-transaction-demo/README.md 
b/saga-demo/conditional-transaction-demo/README.md
index 505a666..2f8ce61 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 0000000..2f0c8fe
--- /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 b8b1bb6..c9eb9f4 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 4fb6e0f..9c72e0e 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 0000000..d0aa52b
--- /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 5bf8660..4c85dda 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 e08b416..96a7b80 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 b6e6b38..036a206 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 0000000..90aeffd
--- /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
+

Reply via email to