Repository: camel Updated Branches: refs/heads/master e961a2a8e -> 89ba56d3d
Polished example Project: http://git-wip-us.apache.org/repos/asf/camel/repo Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/89ba56d3 Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/89ba56d3 Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/89ba56d3 Branch: refs/heads/master Commit: 89ba56d3de1b7181e158ac36d38d4d80ea56eca7 Parents: e961a2a Author: Claus Ibsen <davscl...@apache.org> Authored: Tue Apr 18 13:08:20 2017 +0200 Committer: Claus Ibsen <davscl...@apache.org> Committed: Tue Apr 18 13:08:20 2017 +0200 ---------------------------------------------------------------------- .../README.adoc | 3 +- .../service/src/main/bash/consul-run-linux.sh | 52 ++++++++++++++++++ .../service/src/main/bash/consul-run-osx.sh | 55 ++++++++++++++++++++ .../service/src/main/bash/consul-run.sh | 52 ------------------ 4 files changed, 109 insertions(+), 53 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/camel/blob/89ba56d3/examples/camel-example-spring-cloud-servicecall/README.adoc ---------------------------------------------------------------------- diff --git a/examples/camel-example-spring-cloud-servicecall/README.adoc b/examples/camel-example-spring-cloud-servicecall/README.adoc index 8d5f385..0d0fbce 100644 --- a/examples/camel-example-spring-cloud-servicecall/README.adoc +++ b/examples/camel-example-spring-cloud-servicecall/README.adoc @@ -24,7 +24,8 @@ Using multiple shells: - start consul: $ cd services - $ src/main/bash/consul-run.sh + $ src/main/bash/consul-run-linux.sh (for linux) + $ src/main/bash/consul-run-osx.sh (for mac osx) - start the service: http://git-wip-us.apache.org/repos/asf/camel/blob/89ba56d3/examples/camel-example-spring-cloud-servicecall/service/src/main/bash/consul-run-linux.sh ---------------------------------------------------------------------- diff --git a/examples/camel-example-spring-cloud-servicecall/service/src/main/bash/consul-run-linux.sh b/examples/camel-example-spring-cloud-servicecall/service/src/main/bash/consul-run-linux.sh new file mode 100755 index 0000000..14afcfe --- /dev/null +++ b/examples/camel-example-spring-cloud-servicecall/service/src/main/bash/consul-run-linux.sh @@ -0,0 +1,52 @@ +#!/usr/bin/env bash + +CONSUL_VER="0.8.1" +CONSUL_ZIP="consul_${CONSUL_VER}_linux_amd64.zip" + +# cleanup +rm -rf "target/consul-data" +rm -rf "target/consul-config" +rm -rf "target/consul" + +mkdir -p target/ +mkdir -p target/consul-data +mkdir -p target/consul-config + +if [ ! -f target/${CONSUL_ZIP} ]; then + wget "https://releases.hashicorp.com/consul/${CONSUL_VER}/${CONSUL_ZIP}" -O target/${CONSUL_ZIP} +fi + +cat > target/consul-config/services.json <<EOF +{ + "services": [{ + "id": "s1i1", "name": "service-1", "tags": ["camel", "service-call"], "address": "localhost", "port": 9011 + }, { + "id": "s1i2", "name": "service-1", "tags": ["camel", "service-call"], "address": "localhost", "port": 9012 + }, { + "id": "s1i3", "name": "service-1", "tags": ["camel", "service-call"], "address": "localhost", "port": 9013 + }, { + "id": "s1i4", "name": "service-1", "address": "localhost", "port": 9014 + }, { + "id": "s2i1", "name": "service-2", "tags": ["camel", "service-call"], "address": "localhost", "port": 9021 + }, { + "id": "s2i2", "name": "service-2", "tags": ["camel", "service-call"], "address": "localhost", "port": 9022 + }, { + "id": "s2i3", "name": "service-2", "tags": ["camel", "service-call"], "address": "localhost", "port": 9023 + }, { + "id": "s2i4", "name": "service-2", "address": "localhost", "port": 9024 + }] +} +EOF + +unzip -d target target/${CONSUL_ZIP} + +target/consul \ + agent \ + -server \ + -bootstrap \ + -datacenter camel \ + -advertise 127.0.0.1 \ + -bind 0.0.0.0 \ + -log-level trace \ + -data-dir target/consul-data \ + -config-dir target/consul-config \ No newline at end of file http://git-wip-us.apache.org/repos/asf/camel/blob/89ba56d3/examples/camel-example-spring-cloud-servicecall/service/src/main/bash/consul-run-osx.sh ---------------------------------------------------------------------- diff --git a/examples/camel-example-spring-cloud-servicecall/service/src/main/bash/consul-run-osx.sh b/examples/camel-example-spring-cloud-servicecall/service/src/main/bash/consul-run-osx.sh new file mode 100755 index 0000000..4b62282 --- /dev/null +++ b/examples/camel-example-spring-cloud-servicecall/service/src/main/bash/consul-run-osx.sh @@ -0,0 +1,55 @@ +#!/usr/bin/env bash + +CONSUL_VER="0.8.1" +CONSUL_ZIP="consul_${CONSUL_VER}_darwin_amd64.zip" + +# cleanup +rm -rf "target/consul-data" +rm -rf "target/consul-config" +rm -rf "target/consul" + +mkdir -p target/ +mkdir -p target/consul-data +mkdir -p target/consul-config + + +if [ ! -f target/$CONSUL_ZIP ]; then + echo Downloading: https://releases.hashicorp.com/consul/$CONSUL_VER/$CONSUL_ZIP + curl -o target/$CONSUL_ZIP "https://releases.hashicorp.com/consul/$CONSUL_VER/$CONSUL_ZIP" +fi + +cat > target/consul-config/services.json <<EOF +{ + "services": [{ + "id": "s1i1", "name": "service-1", "tags": ["camel", "service-call"], "address": "localhost", "port": 9011 + }, { + "id": "s1i2", "name": "service-1", "tags": ["camel", "service-call"], "address": "localhost", "port": 9012 + }, { + "id": "s1i3", "name": "service-1", "tags": ["camel", "service-call"], "address": "localhost", "port": 9013 + }, { + "id": "s1i4", "name": "service-1", "address": "localhost", "port": 9014 + }, { + "id": "s2i1", "name": "service-2", "tags": ["camel", "service-call"], "address": "localhost", "port": 9021 + }, { + "id": "s2i2", "name": "service-2", "tags": ["camel", "service-call"], "address": "localhost", "port": 9022 + }, { + "id": "s2i3", "name": "service-2", "tags": ["camel", "service-call"], "address": "localhost", "port": 9023 + }, { + "id": "s2i4", "name": "service-2", "address": "localhost", "port": 9024 + }] +} +EOF + +unzip -d target target/$CONSUL_ZIP +chmod +x target/consul + +target/consul \ + agent \ + -server \ + -bootstrap \ + -datacenter camel \ + -advertise 127.0.0.1 \ + -bind 0.0.0.0 \ + -log-level trace \ + -data-dir target/consul-data \ + -config-dir target/consul-config \ No newline at end of file http://git-wip-us.apache.org/repos/asf/camel/blob/89ba56d3/examples/camel-example-spring-cloud-servicecall/service/src/main/bash/consul-run.sh ---------------------------------------------------------------------- diff --git a/examples/camel-example-spring-cloud-servicecall/service/src/main/bash/consul-run.sh b/examples/camel-example-spring-cloud-servicecall/service/src/main/bash/consul-run.sh deleted file mode 100755 index f5ac79c..0000000 --- a/examples/camel-example-spring-cloud-servicecall/service/src/main/bash/consul-run.sh +++ /dev/null @@ -1,52 +0,0 @@ -#!/usr/bin/env bash - -CONSUL_VER="0.7.5" -CONSUL_ZIP="consul_${CONSUL_VER}_linux_amd64.zip" - -# cleanup -rm -rf "target/consul-data" -rm -rf "target/consul-config" -rm -rf "target/consul" - -mkdir -p target/ -mkdir -p target/consul-data -mkdir -p target/consul-config - -if [ ! -f target/${CONSUL_ZIP} ]; then - wget "https://releases.hashicorp.com/consul/${CONSUL_VER}/${CONSUL_ZIP}" -O target/${CONSUL_ZIP} -fi - -cat > target/consul-config/services.json <<EOF -{ - "services": [{ - "id": "s1i1", "name": "service-1", "tags": ["camel", "service-call"], "address": "localhost", "port": 9011 - }, { - "id": "s1i2", "name": "service-1", "tags": ["camel", "service-call"], "address": "localhost", "port": 9012 - }, { - "id": "s1i3", "name": "service-1", "tags": ["camel", "service-call"], "address": "localhost", "port": 9013 - }, { - "id": "s1i4", "name": "service-1", "address": "localhost", "port": 9014 - }, { - "id": "s2i1", "name": "service-2", "tags": ["camel", "service-call"], "address": "localhost", "port": 9021 - }, { - "id": "s2i2", "name": "service-2", "tags": ["camel", "service-call"], "address": "localhost", "port": 9022 - }, { - "id": "s2i3", "name": "service-2", "tags": ["camel", "service-call"], "address": "localhost", "port": 9023 - }, { - "id": "s2i4", "name": "service-2", "address": "localhost", "port": 9024 - }] -} -EOF - -unzip -d target target/${CONSUL_ZIP} - -target/consul \ - agent \ - -server \ - -bootstrap \ - -datacenter camel \ - -advertise 127.0.0.1 \ - -bind 0.0.0.0 \ - -log-level trace \ - -data-dir target/consul-data \ - -config-dir target/consul-config \ No newline at end of file