This is an automated email from the ASF dual-hosted git repository. elserj pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/incubator-ratis.git
commit 912365d94c212d5226390ed5a784ea4362646522 Author: Josh Elser <els...@apache.org> AuthorDate: Wed Apr 10 19:29:00 2019 -0400 RATIS-526. Push building the docker image and launching the client env into scripts --- ratis-logservice/README.md | 5 +++-- ratis-logservice/build-docker.sh | 31 +++++++++++++++++++++++++++++++ ratis-logservice/client-env.sh | 19 +++++++++++++++++++ 3 files changed, 53 insertions(+), 2 deletions(-) diff --git a/ratis-logservice/README.md b/ratis-logservice/README.md index 7aa83fc..8337257 100644 --- a/ratis-logservice/README.md +++ b/ratis-logservice/README.md @@ -73,13 +73,14 @@ $ mvn exec:java -Dexec.mainClass=org.apache.ratis.logservice.shell.LogServiceShe Similarly, a full quorum can be started by building a docker container and then start the docker-compose cluster: ```bash $ cd ratis-logservice && mvn package assembly:single -DskipTests -$ docker build -t ratis-logservice --build-arg BINARY=target/ratis-logservice-0.4.0-SNAPSHOT-bin.tar.gz --build-arg VERSION=0.4.0-SNAPSHOT . +$ ./build-docker.sh $ docker-compose up ``` Then, a client container can be launched to connect to the cluster: ```bash -$ docker run --rm --network ratis-logservice_default -it ratis-logservice java -cp "/opt/ratis-logservice/current/conf:/opt/ratis-logservice/current/lib/*" org.apache.ratis.logservice.shell.LogServiceShell -q master1.logservice.ratis.org:9999,master2.logservice.ratis.org:9999,master3.logservice.ratis.org:9999 +$ ./client-env.sh +$ ./bin/shell -q master1.logservice.ratis.org:9999,master2.logservice.ratis.org:9999,master3.logservice.ratis.org:9999 ``` Take care that the correct network is provided to the LogServiceShell command. diff --git a/ratis-logservice/build-docker.sh b/ratis-logservice/build-docker.sh new file mode 100755 index 0000000..eb4ba44 --- /dev/null +++ b/ratis-logservice/build-docker.sh @@ -0,0 +1,31 @@ +#!/usr/bin/env bash +# +# 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. + +LOGSERVICE="$(dirname "$0")" +LOGSERVICE="$(cd "$LOGSERVICE">/dev/null; pwd)" + +# Get the version of the project +VERSION="$(mvn help:evaluate -Dexpression=project.version -q -DforceStdout)" + +# Validate that the tarball is there +if [[ ! -f "target/ratis-logservice-${VERSION}-bin.tar.gz" ]]; then + echo "LogService assembly tarball missing, run 'mvn package assembly:single' first!" + exit 1 +fi + +docker build -t ratis-logservice --build-arg BINARY=target/ratis-logservice-$VERSION-bin.tar.gz --build-arg VERSION=$VERSION . diff --git a/ratis-logservice/client-env.sh b/ratis-logservice/client-env.sh new file mode 100755 index 0000000..e44d0bd --- /dev/null +++ b/ratis-logservice/client-env.sh @@ -0,0 +1,19 @@ +#!/usr/bin/env bash +# +# 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. + +docker run --rm --network ratis-logservice_default -it ratis-logservice