[ https://issues.apache.org/jira/browse/SCB-573?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16474014#comment-16474014 ]
ASF GitHub Bot commented on SCB-573: ------------------------------------ WillemJiang closed pull request #190: SCB-573 Split the docker-compose file for debugging easily URL: https://github.com/apache/incubator-servicecomb-saga/pull/190 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 1540e29a..161f886c 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. mvn clean package -DskipTests -Pdocker -Pdemo ``` -2. start application up +2. start the whole application up(including alpha server and three demo services) ``` ./saga-demo.sh up ``` @@ -52,6 +52,16 @@ You can run the demo using either docker compose or executable files. ./saga-demo.sh up-mysql ``` + **Note:** If you want start alpha server and demon services separatelly, you can try the following steps: + 1. start alpha server + ```bash + ./saga-demo.sh up-alpha + ``` + 2. when alpha server started complatelly, then start the demo services + ```bash + ./saga-demo.sh up-demo + ``` + 3. stop application ``` ./saga-demo.sh down diff --git a/saga-demo/booking/docker-compose-alpha.yaml b/saga-demo/booking/docker-compose-alpha.yaml new file mode 100644 index 00000000..a664c238 --- /dev/null +++ b/saga-demo/booking/docker-compose-alpha.yaml @@ -0,0 +1,48 @@ +## --------------------------------------------------------------------------- +## 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 + 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/booking/docker-compose-demo.yaml b/saga-demo/booking/docker-compose-demo.yaml new file mode 100644 index 00000000..b1d66390 --- /dev/null +++ b/saga-demo/booking/docker-compose-demo.yaml @@ -0,0 +1,48 @@ +## --------------------------------------------------------------------------- +## 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: + pack-hotel: + image: "pack-hotel:${TAG}" + hostname: pack-hotel + external_links: + - "alpha:alpha-server.servicecomb.io" + ports: + - "8081:8080" + + pack-car: + image: "pack-car:${TAG}" + hostname: pack-car + external_links: + - "alpha:alpha-server.servicecomb.io" + ports: + - "8082:8080" + + pack-booking: + image: "pack-booking:${TAG}" + hostname: pack-booking + external_links: + - "alpha:alpha-server.servicecomb.io" + - "pack-hotel:pack-hotel.servicecomb.io" + - "pack-car:pack-car.servicecomb.io" + ports: + - "8083:8080" + depends_on: + - pack-hotel + - pack-car diff --git a/saga-demo/booking/saga-demo.sh b/saga-demo/booking/saga-demo.sh index 8e4f4641..5379fd54 100755 --- a/saga-demo/booking/saga-demo.sh +++ b/saga-demo/booking/saga-demo.sh @@ -3,7 +3,7 @@ service=saga-demo show_usage() { - echo "Usage: $0 {up|up-mysql|down}" >&2 + echo "Usage: $0 {up|up-alpha|up-demo|up-mysql|down}" >&2 } fetch_version() { @@ -22,7 +22,21 @@ case $1 in TAG=$version docker-compose up exit $? ;; - + + up-alpha) + fetch_version + echo "Starting ${service}:${version}" + TAG=$version docker-compose -f docker-compose-alpha.yaml up + exit $? + ;; + + up-demo) + fetch_version + echo "Starting ${service}:${version}" + TAG=$version docker-compose -f docker-compose-demo.yaml up + exit $? + ;; + up-mysql) fetch_version echo "Starting ${service}:${version}" ---------------------------------------------------------------- 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 > Split the docker-compose file for debugging easily > -------------------------------------------------- > > Key: SCB-573 > URL: https://issues.apache.org/jira/browse/SCB-573 > Project: Apache ServiceComb > Issue Type: Improvement > Components: Saga > Reporter: longchun > Assignee: longchun > Priority: Minor > Fix For: saga-0.2.0 > > > currently the docker compose file will start all the services, but when we > would like to debug demo services, it is nice to start the alpha server > separately. > saga-demo.sh supporting 2 new arguments: > up-alpha: starting the alpha server only > up-demo:starting the 3 demo services > -- This message was sent by Atlassian JIRA (v7.6.3#76005)