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

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

commit e1119d0bbc0f96d2e2023a5aeeb897a06f521cd7
Author: wuzunqian <wuzunq...@msn.com>
AuthorDate: Sun May 13 14:51:52 2018 +0800

    saga-dubbo-demo add docker plugin(part1)
---
 .../saga-dubbo-demo/docker-compose.mysql.yaml      | 39 +++++++++++++++++
 saga-demo/saga-dubbo-demo/docker-compose.yaml      | 51 ++++++++++++++++++++++
 saga-demo/saga-dubbo-demo/saga-dubbo-demo.sh       | 45 +++++++++++++++++++
 3 files changed, 135 insertions(+)

diff --git a/saga-demo/saga-dubbo-demo/docker-compose.mysql.yaml 
b/saga-demo/saga-dubbo-demo/docker-compose.mysql.yaml
new file mode 100644
index 0000000..43f3b5e
--- /dev/null
+++ b/saga-demo/saga-dubbo-demo/docker-compose.mysql.yaml
@@ -0,0 +1,39 @@
+## ---------------------------------------------------------------------------
+## 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.
+## ---------------------------------------------------------------------------
+
+version: '2.1'
+
+services:
+  database:
+    image: "mysql/mysql-server:5.7"
+    hostname: mysql
+    environment:
+      - MYSQL_ROOT_PASSWORD=password
+      - MYSQL_DATABASE=saga
+      - MYSQL_USER=saga
+      - MYSQL_PASSWORD=password
+    healthcheck:
+        test: ["CMD-SHELL", "nc -z localhost 3306 &> /dev/null; echo $$?"]
+        interval: 30s
+        timeout: 10s
+        retries: 5
+
+  alpha:
+    links:
+      - "database:mysql.servicecomb.io"
+    environment:
+      - JAVA_OPTS=-Dspring.profiles.active=mysql
diff --git a/saga-demo/saga-dubbo-demo/docker-compose.yaml 
b/saga-demo/saga-dubbo-demo/docker-compose.yaml
new file mode 100644
index 0000000..7c3b8dd
--- /dev/null
+++ b/saga-demo/saga-dubbo-demo/docker-compose.yaml
@@ -0,0 +1,51 @@
+## ---------------------------------------------------------------------------
+## 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.
+## ---------------------------------------------------------------------------
+
+version: '2.1'
+
+services:
+  database:
+    image: "postgres"
+    hostname: postgres
+    environment:
+      - POSTGRES_DB=saga
+      - POSTGRES_USER=saga
+      - POSTGRES_PASSWORD=password
+    healthcheck:
+        test: ["CMD-SHELL", "nc -z localhost 5432 &> /dev/null; echo $$?"]
+        interval: 30s
+        timeout: 10s
+        retries: 5
+
+  alpha:
+    image: "alpha-server:${TAG}"
+    hostname: alpha-server
+    ports:
+      - "8081:8080"
+      - "8091:8090"
+    links:
+      - "database:postgresql.servicecomb.io"
+    environment:
+      - JAVA_OPTS=-Dspring.profiles.active=prd
+    healthcheck:
+        test: ["CMD-SHELL", "nc -z localhost 8080 &> /dev/null; echo $$?"]
+        interval: 30s
+        timeout: 10s
+        retries: 5
+    depends_on:
+      database:
+        condition: service_healthy
diff --git a/saga-demo/saga-dubbo-demo/saga-dubbo-demo.sh 
b/saga-demo/saga-dubbo-demo/saga-dubbo-demo.sh
new file mode 100755
index 0000000..48df117
--- /dev/null
+++ b/saga-demo/saga-dubbo-demo/saga-dubbo-demo.sh
@@ -0,0 +1,45 @@
+#!/usr/bin/env bash
+
+service=saga-dubbo-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
ningji...@apache.org.

Reply via email to