WillemJiang closed pull request #164: SCB-436 Clean up the docker-compose file 
of booking demo
URL: https://github.com/apache/incubator-servicecomb-saga/pull/164
 
 
   

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/booking/README.md b/saga-demo/booking/README.md
index 64443901..4c642b31 100644
--- a/saga-demo/booking/README.md
+++ b/saga-demo/booking/README.md
@@ -26,7 +26,7 @@ You can run the demo using either docker compose or 
executable files.
 
 2. start application up
    ```
-   docker-compose up
+   ./saga-demo.sh up
    ```
 
    **Note:** If you prefer to use MySQL as alpha's backend database, you need 
to try the following steps instead:
@@ -47,9 +47,14 @@ You can run the demo using either docker compose or 
executable files.
       ```
    4. start application up in `saga-demo/booking` with the following command
       ```
-      docker-compose -f docker-compose.yaml -f docker-compose.mysql.yaml up
+      ./saga-demo.sh up-mysql
       ```
 
+3. stop application
+   ```
+   ./saga-demo.sh down
+   ```
+
 ### via executable files
 1. run the following command to generate executable alpha server jar in 
`alpha/alpha-server/target/saga/alpha-server-${saga_version}-exec.jar`.
    ```
diff --git a/saga-demo/booking/docker-compose.yaml 
b/saga-demo/booking/docker-compose.yaml
index b8b329da..e9f8dd15 100644
--- a/saga-demo/booking/docker-compose.yaml
+++ b/saga-demo/booking/docker-compose.yaml
@@ -32,7 +32,7 @@ services:
         retries: 5
 
   alpha:
-    image: "alpha-server:0.2.0-SNAPSHOT"
+    image: "alpha-server:${TAG}"
     hostname: alpha-server
     links:
       - "database:postgresql.servicecomb.io"
@@ -48,7 +48,7 @@ services:
         condition: service_healthy
 
   pack-hotel:
-    image: "pack-hotel:0.2.0-SNAPSHOT"
+    image: "pack-hotel:${TAG}"
     hostname: pack-hotel
     links:
       - "alpha:alpha-server.servicecomb.io"
@@ -59,7 +59,7 @@ services:
         condition: service_healthy
 
   pack-car:
-    image: "pack-car:0.2.0-SNAPSHOT"
+    image: "pack-car:${TAG}"
     hostname: pack-car
     links:
       - "alpha:alpha-server.servicecomb.io"
@@ -70,7 +70,7 @@ services:
         condition: service_healthy
 
   pack-booking:
-    image: "pack-booking:0.2.0-SNAPSHOT"
+    image: "pack-booking:${TAG}"
     hostname: pack-booking
     links:
       - "alpha:alpha-server.servicecomb.io"
diff --git a/saga-demo/booking/saga-demo.sh b/saga-demo/booking/saga-demo.sh
new file mode 100755
index 00000000..8e4f4641
--- /dev/null
+++ b/saga-demo/booking/saga-demo.sh
@@ -0,0 +1,45 @@
+#!/usr/bin/env bash
+
+service=saga-demo
+
+show_usage() {
+  echo "Usage: $0 {up|up-mysql|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 $?
+  ;;
+  
+  up-mysql)
+    fetch_version
+    echo "Starting ${service}:${version}"
+    TAG=$version docker-compose -f docker-compose.yaml -f 
docker-compose.mysql.yaml 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:
[email protected]


With regards,
Apache Git Services

Reply via email to