You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@servicecomb.apache.org by ni...@apache.org on 2018/03/27 09:33:55 UTC

[incubator-servicecomb-saga] branch master updated: SCB-436 Clean up the docker-compose file of booking demo

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 81d669f  SCB-436 Clean up the docker-compose file of booking demo
81d669f is described below

commit 81d669f56ac93f7ee60281965dc5fd1af7a0b0c4
Author: Daniel Qian <ch...@gmail.com>
AuthorDate: Tue Mar 27 14:46:56 2018 +0800

    SCB-436 Clean up the docker-compose file of booking demo
---
 saga-demo/booking/README.md           |  9 +++++--
 saga-demo/booking/docker-compose.yaml |  8 +++----
 saga-demo/booking/saga-demo.sh        | 45 +++++++++++++++++++++++++++++++++++
 3 files changed, 56 insertions(+), 6 deletions(-)

diff --git a/saga-demo/booking/README.md b/saga-demo/booking/README.md
index 6444390..4c642b3 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 b8b329d..e9f8dd1 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 0000000..8e4f464
--- /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
+

-- 
To stop receiving notification emails like this one, please contact
ningjiang@apache.org.