You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tinkerpop.apache.org by rd...@apache.org on 2019/03/01 14:58:39 UTC

[tinkerpop] 01/01: added docker gremlin-server test script

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

rdale pushed a commit to branch docker-test-server
in repository https://gitbox.apache.org/repos/asf/tinkerpop.git

commit be1bb364df3c5871cc10c68b4ccf979edcea231b
Author: Robert Dale <ro...@gmail.com>
AuthorDate: Fri Mar 1 09:57:39 2019 -0500

    added docker gremlin-server test script
---
 docker/gremlin-server.sh                  | 55 +++++++++++++++++++++++++++++++
 docker/gremlin-server/Dockerfile.template | 27 +++++++++++++++
 docker/gremlin-server/run.sh              |  8 +++++
 3 files changed, 90 insertions(+)

diff --git a/docker/gremlin-server.sh b/docker/gremlin-server.sh
new file mode 100755
index 0000000..0a414e7
--- /dev/null
+++ b/docker/gremlin-server.sh
@@ -0,0 +1,55 @@
+#!/bin/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.
+#
+
+# Build docker images first
+# Build gremlin-server:  mvn clean install -pl :gremlin-server -am
+
+DIR=`dirname $0`
+PROJECT_HOME=${DIR}/../
+
+TIMESTAMP=$(date +%s)
+BUILD_TAG="gremlin-server-test-${TIMESTAMP}"
+
+function cleanup {
+  BUILD_IMAGE=$(docker images tinkerpop | awk "{if (\$2 == \"${BUILD_TAG}\") print \$3}")
+  [ ! -z ${BUILD_IMAGE} ] && docker rmi ${BUILD_IMAGE}
+  rm -f ${PROJECT_HOME}/Dockerfile
+}
+trap cleanup EXIT
+
+REMOVE_CONTAINER="--rm"
+[[ -n ${KEEP_CONTAINER} ]] && unset REMOVE_CONTAINER
+
+pushd ${PROJECT_HOME} > /dev/null
+
+#mvn clean package -DskipTests=true -pl :gremlin-server || mvn clean install -pl :gremlin-server -am
+
+HADOOP_VERSION=$(cat pom.xml | grep -o '<hadoop.version>[^<]*' | head -n1 | cut -d '>' -f2)
+
+docker/build-containers.sh -h "${HADOOP_VERSION}"
+
+sed -e "s/HADOOP_VERSION\$/${HADOOP_VERSION}/" docker/gremlin-server/Dockerfile.template > Dockerfile
+
+docker build -t tinkerpop:${BUILD_TAG} .
+docker run ${TINKERPOP_DOCKER_OPTS} ${REMOVE_CONTAINER} -ti tinkerpop:${BUILD_TAG}
+
+status=$?
+popd > /dev/null
+exit $status
diff --git a/docker/gremlin-server/Dockerfile.template b/docker/gremlin-server/Dockerfile.template
new file mode 100644
index 0000000..ef3d17e
--- /dev/null
+++ b/docker/gremlin-server/Dockerfile.template
@@ -0,0 +1,27 @@
+# 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.
+
+FROM tinkerpop:hadoop-HADOOP_VERSION
+
+RUN mkdir -p /opt
+WORKDIR /opt
+COPY gremlin-server/target/apache-tinkerpop-gremlin-server-*-distribution.zip /opt/
+RUN unzip *.zip && rm *.zip
+COPY gremlin-server/src/test /opt/test/
+COPY docker/gremlin-server/run.sh /opt/
+RUN chmod 755 /opt/run.sh
+CMD /opt/run.sh
\ No newline at end of file
diff --git a/docker/gremlin-server/run.sh b/docker/gremlin-server/run.sh
new file mode 100644
index 0000000..4d661f0
--- /dev/null
+++ b/docker/gremlin-server/run.sh
@@ -0,0 +1,8 @@
+
+TINKERPOP_HOME=$(find . -type d -name 'apache-tinkerpop-gremlin-server-*' -print -quit)
+
+cp /opt/test/scripts/* ${TINKERPOP_HOME}/scripts
+cp /opt/test/resources/org/apache/tinkerpop/gremlin/server/gremlin-server-integration.yaml ${TINKERPOP_HOME}/conf
+
+cd ${TINKERPOP_HOME}
+./bin/gremlin-server.sh conf/gremlin-server-integration.yaml