You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tinkerpop.apache.org by sp...@apache.org on 2018/06/04 20:45:03 UTC

[04/31] tinkerpop git commit: Add docker images for console and server TINKERPOP-1897

Add docker images for console and server TINKERPOP-1897


Project: http://git-wip-us.apache.org/repos/asf/tinkerpop/repo
Commit: http://git-wip-us.apache.org/repos/asf/tinkerpop/commit/5ac78169
Tree: http://git-wip-us.apache.org/repos/asf/tinkerpop/tree/5ac78169
Diff: http://git-wip-us.apache.org/repos/asf/tinkerpop/diff/5ac78169

Branch: refs/heads/TINKERPOP-1975
Commit: 5ac78169ccd7c6674343204fa22e1af83d2fddcc
Parents: 1a0947b
Author: Florian Hockmann <fh...@florian-hockmann.de>
Authored: Sun Feb 25 18:14:03 2018 +0100
Committer: Florian Hockmann <fh...@florian-hockmann.de>
Committed: Mon Jun 4 15:57:28 2018 +0200

----------------------------------------------------------------------
 .dockerignore                                   |  2 +
 .gitignore                                      |  1 +
 CHANGELOG.asciidoc                              |  2 +-
 .../developer/development-environment.asciidoc  | 16 +++-
 .../src/reference/gremlin-applications.asciidoc | 89 ++++++++++++++++++++
 gremlin-console/Dockerfile                      | 31 +++++++
 gremlin-console/pom.xml                         | 34 ++++++++
 .../src/main/docker/docker-entrypoint.sh        | 24 ++++++
 gremlin-server/Dockerfile                       | 35 ++++++++
 gremlin-server/pom.xml                          | 34 ++++++++
 .../src/main/docker/docker-entrypoint.sh        | 31 +++++++
 pom.xml                                         |  6 ++
 12 files changed, 303 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/5ac78169/.dockerignore
----------------------------------------------------------------------
diff --git a/.dockerignore b/.dockerignore
index afe0e54..50d6801 100644
--- a/.dockerignore
+++ b/.dockerignore
@@ -1,5 +1,7 @@
 **/*.log
 **/target
+!gremlin-server/target/apache-tinkerpop-gremlin-server-*
+!gremlin-console/target/apache-tinkerpop-gremlin-console-*
 *.iml
 .idea
 **/*.DS_Store

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/5ac78169/.gitignore
----------------------------------------------------------------------
diff --git a/.gitignore b/.gitignore
index 0109f82..10e5b4f 100644
--- a/.gitignore
+++ b/.gitignore
@@ -20,6 +20,7 @@ __pycache__/
 *.py[cdo]
 __version__.py
 .glv
+.docker
 settings.xml
 tools/
 [Dd]ebug/

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/5ac78169/CHANGELOG.asciidoc
----------------------------------------------------------------------
diff --git a/CHANGELOG.asciidoc b/CHANGELOG.asciidoc
index 6297210..a1d0963 100644
--- a/CHANGELOG.asciidoc
+++ b/CHANGELOG.asciidoc
@@ -23,6 +23,7 @@ image::https://raw.githubusercontent.com/apache/tinkerpop/master/docs/static/ima
 [[release-3-2-10]]
 === TinkerPop 3.2.10 (Release Date: NOT OFFICIALLY RELEASED YET)
 
+* Added Docker images for Gremlin Console and Gremlin Server
 * Fixed bug in `branch()` where reducing steps as options would produce incorrect results.
 * Removed recursive handling of streaming results from Gremlin-Python driver to avoid max recursion depth errors.
 * Improved performance of `TraversalVertexProgram` and related infrastructure.
@@ -56,7 +57,6 @@ image::https://raw.githubusercontent.com/apache/tinkerpop/master/docs/static/ima
 * TINKERPOP-1950 Traversal construction performance enhancements
 * TINKERPOP-1953 Bump to Groovy 2.4.15
 
-
 [[release-3-2-8]]
 === TinkerPop 3.2.8 (Release Date: April 2, 2018)
 

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/5ac78169/docs/src/dev/developer/development-environment.asciidoc
----------------------------------------------------------------------
diff --git a/docs/src/dev/developer/development-environment.asciidoc b/docs/src/dev/developer/development-environment.asciidoc
index 4dfbcaa..cb19a65 100644
--- a/docs/src/dev/developer/development-environment.asciidoc
+++ b/docs/src/dev/developer/development-environment.asciidoc
@@ -106,7 +106,7 @@ The build optionally requires link:https://www.microsoft.com/net/core[.NET Core
 `gremlin-dotnet` module. If .NET Core SDK is not installed, TinkerPop will still build with Maven, but .NET projects
 will be skipped.
 
-`gremlin-dotnet` can be build and tested from the command line with:
+`gremlin-dotnet` can be built and tested from the command line with:
 
 [source,text]
 mvn clean install -Pgremlin-dotnet
@@ -127,6 +127,20 @@ other existing Node.js runtime instances in your machine.
 
 See the <<release-environment,Release Environment>> section for more information on release manager configurations.
 
+[[docker-environment]]
+=== Docker Environment
+The build optionally requires Docker to build Docker images of Gremlin Server and Gremlin Console.
+
+The Docker images can be built from the command line with:
+[source,text]
+----
+mvn clean install -Pdocker-images
+----
+which enables the "docker-images" Maven profile or in a more automated fashion simply add a `.docker` file to the
+directories of the `gremlin-server` and/or `gremlin-console` modules which will signify to Maven that Docker is present
+in the environment.
+
+
 [[release-environment]]
 === Release Environment
 

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/5ac78169/docs/src/reference/gremlin-applications.asciidoc
----------------------------------------------------------------------
diff --git a/docs/src/reference/gremlin-applications.asciidoc b/docs/src/reference/gremlin-applications.asciidoc
index 522bcfd..80659af 100644
--- a/docs/src/reference/gremlin-applications.asciidoc
+++ b/docs/src/reference/gremlin-applications.asciidoc
@@ -353,6 +353,38 @@ variable initialization code into the console.
 Like, execution mode, it is also possible to pass multiple scripts by specifying multiple `-i` options. See the
 <<execution-mode, Execution Mode Section>> for more information on the specifics of that capability.
 
+[[gremlin-console-docker-image]]
+=== Docker Image
+The Gremlin Console can also be started as a link:https://hub.docker.com/r/tinkerpop/gremlin-console/[Docker image]:
+
+[source,text]
+----
+$ docker run -it tinkerpop/gremlin-console:x.y.z
+Feb 25, 2018 3:47:24 PM java.util.prefs.FileSystemPreferences$1 run
+INFO: Created user preferences directory.
+
+         \,,,/
+         (o o)
+-----oOOo-(3)-oOOo-----
+plugin activated: tinkerpop.server
+plugin activated: tinkerpop.utilities
+plugin activated: tinkerpop.tinkergraph
+gremlin>
+----
+
+The Docker image offers the same options as the standalone Console. It can be used for example to execute scripts:
+
+[source,bash]
+----
+$ docker run -it tinkerpop/gremlin-console:x.y.z -e gremlin.groovy
+v[1]
+v[2]
+v[3]
+v[4]
+v[5]
+v[6]
+----
+
 [[gremlin-server]]
 == Gremlin Server
 
@@ -1901,6 +1933,63 @@ $ curl -X POST -d "{\"gremlin\":\"divideIt(8, 2)\"}" "http://localhost:8182"
 In the above REST-based requests, the bindings contain a special parameter that tells the `ScriptEngine` cache to
 immediately forget the script after execution. In this way, the function does not end up being globally available.
 
+[[gremlin-server-docker-image]]
+=== Docker Image
+The Gremlin Server can also be started as a link:https://hub.docker.com/r/tinkerpop/gremlin-server/[Docker image]:
+
+[source,text]
+----
+$ docker run tinkerpop/gremlin-server:x.y.z
+[INFO] GremlinServer - 
+         \,,,/
+         (o o)
+-----oOOo-(3)-oOOo-----
+
+[INFO] GremlinServer - Configuring Gremlin Server from conf/gremlin-server.yaml
+[INFO] MetricManager - Configured Metrics ConsoleReporter configured with report interval=180000ms
+[INFO] MetricManager - Configured Metrics CsvReporter configured with report interval=180000ms to fileName=/tmp/gremlin-server-metrics.csv
+[INFO] MetricManager - Configured Metrics JmxReporter configured with domain= and agentId=
+[INFO] MetricManager - Configured Metrics Slf4jReporter configured with interval=180000ms and loggerName=org.apache.tinkerpop.gremlin.server.Settings$Slf4jReporterMetrics
+[INFO] DefaultGraphManager - Graph [graph] was successfully configured via [conf/tinkergraph-empty.properties].
+[INFO] ServerGremlinExecutor - Initialized Gremlin thread pool.  Threads in pool named with pattern gremlin-*
+[INFO] ScriptEngines - Loaded gremlin-groovy ScriptEngine
+[INFO] GremlinExecutor - Initialized gremlin-groovy ScriptEngine with scripts/empty-sample.groovy
+[INFO] ServerGremlinExecutor - Initialized GremlinExecutor and preparing GremlinScriptEngines instances.
+[INFO] ServerGremlinExecutor - Initialized gremlin-groovy GremlinScriptEngine and registered metrics
+[INFO] ServerGremlinExecutor - A GraphTraversalSource is now bound to [g] with graphtraversalsource[tinkergraph[vertices:0 edges:0], standard]
+[INFO] OpLoader - Adding the standard OpProcessor.
+[INFO] OpLoader - Adding the control OpProcessor.
+[INFO] OpLoader - Adding the session OpProcessor.
+[INFO] OpLoader - Adding the traversal OpProcessor.
+[INFO] TraversalOpProcessor - Initialized cache for TraversalOpProcessor with size 1000 and expiration time of 600000 ms
+[INFO] GremlinServer - Executing start up LifeCycleHook
+[INFO] Logger$info - Executed once at startup of Gremlin Server.
+[INFO] GremlinServer - idleConnectionTimeout was set to 0 which resolves to 0 seconds when configuring this value - this feature will be disabled
+[INFO] GremlinServer - keepAliveInterval was set to 0 which resolves to 0 seconds when configuring this value - this feature will be disabled
+[INFO] AbstractChannelizer - Configured application/vnd.gremlin-v1.0+gryo with org.apache.tinkerpop.gremlin.driver.ser.GryoMessageSerializerV1d0
+[INFO] AbstractChannelizer - Configured application/vnd.gremlin-v1.0+gryo-stringd with org.apache.tinkerpop.gremlin.driver.ser.GryoMessageSerializerV1d0
+[INFO] AbstractChannelizer - Configured application/vnd.gremlin-v1.0+json with org.apache.tinkerpop.gremlin.driver.ser.GraphSONMessageSerializerGremlinV1d0
+[INFO] AbstractChannelizer - Configured application/vnd.gremlin-v2.0+json with org.apache.tinkerpop.gremlin.driver.ser.GraphSONMessageSerializerGremlinV2d0
+[INFO] AbstractChannelizer - Configured application/json with org.apache.tinkerpop.gremlin.driver.ser.GraphSONMessageSerializerV1d0
+[INFO] GremlinServer$1 - Gremlin Server configured with worker thread pool of 1, gremlin pool of 4 and boss thread pool of 1.
+[INFO] GremlinServer$1 - Channel started at port 8182.
+----
+
+By default, Gremlin Server listens on port 8182. So that port should be exposed if it should be reachable on the host:
+
+[source,bash]
+----
+$ docker run -p 8182:8182 tinkerpop/gremlin-server:x.y.z
+----
+
+Arguments provided with `docker run` are forwarded to the script that starts Gremlin Server. This allows for example
+to use an alternative config file:
+
+[source,bash]
+----
+$ docker run tinkerpop/gremlin-server:x.y.z conf/gremlin-server-secure.yaml
+----
+
 [[gremlin-plugins]]
 == Gremlin Plugins
 

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/5ac78169/gremlin-console/Dockerfile
----------------------------------------------------------------------
diff --git a/gremlin-console/Dockerfile b/gremlin-console/Dockerfile
new file mode 100644
index 0000000..909952f
--- /dev/null
+++ b/gremlin-console/Dockerfile
@@ -0,0 +1,31 @@
+# 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 openjdk:8u151-jre-alpine3.7
+
+ARG GREMLIN_CONSOLE_DIR
+
+RUN apk add --update \
+    bash \
+    && rm -rf /var/cache/apk/*
+
+COPY src/main/docker/docker-entrypoint.sh /
+COPY ${GREMLIN_CONSOLE_DIR} /opt/gremlin-console
+
+WORKDIR /opt/gremlin-console
+
+ENTRYPOINT ["/docker-entrypoint.sh"]
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/5ac78169/gremlin-console/pom.xml
----------------------------------------------------------------------
diff --git a/gremlin-console/pom.xml b/gremlin-console/pom.xml
index 49e7f4a..b7933fb 100644
--- a/gremlin-console/pom.xml
+++ b/gremlin-console/pom.xml
@@ -335,5 +335,39 @@ limitations under the License.
                 </plugins>
             </build>
         </profile>
+
+        <profile>
+            <id>docker-images</id>
+            <activation>
+                <activeByDefault>false</activeByDefault>
+                <file>
+                    <exists>.docker</exists>
+                </file>
+            </activation>
+            <build>
+                <plugins>
+                    <plugin>
+                        <groupId>com.spotify</groupId>
+                        <artifactId>dockerfile-maven-plugin</artifactId>
+                        <executions>
+                            <execution>
+                            <id>docker-image</id>
+                            <goals>
+                                <goal>build</goal>
+                                <goal>push</goal>
+                            </goals>
+                            </execution>
+                        </executions>
+                        <configuration>
+                            <repository>tinkerpop/gremlin-console</repository>
+                            <tag>${project.version}</tag>
+                            <buildArgs>
+                                <GREMLIN_CONSOLE_DIR>target/apache-tinkerpop-${project.artifactId}-${project.version}-standalone</GREMLIN_CONSOLE_DIR>
+                            </buildArgs>
+                        </configuration>
+                    </plugin>
+                </plugins>                
+            </build>
+        </profile>
     </profiles>
 </project>

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/5ac78169/gremlin-console/src/main/docker/docker-entrypoint.sh
----------------------------------------------------------------------
diff --git a/gremlin-console/src/main/docker/docker-entrypoint.sh b/gremlin-console/src/main/docker/docker-entrypoint.sh
new file mode 100644
index 0000000..2c8d204
--- /dev/null
+++ b/gremlin-console/src/main/docker/docker-entrypoint.sh
@@ -0,0 +1,24 @@
+#!/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.
+#
+
+set -e
+
+exec /opt/gremlin-console/bin/gremlin.sh "$@"
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/5ac78169/gremlin-server/Dockerfile
----------------------------------------------------------------------
diff --git a/gremlin-server/Dockerfile b/gremlin-server/Dockerfile
new file mode 100644
index 0000000..c47e0cf
--- /dev/null
+++ b/gremlin-server/Dockerfile
@@ -0,0 +1,35 @@
+# 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 openjdk:8u151-jre-alpine3.7
+
+ARG GREMLIN_SERVER_DIR
+
+RUN apk add --update \
+    bash \
+    perl \
+    && rm -rf /var/cache/apk/*
+
+COPY src/main/docker/docker-entrypoint.sh /
+COPY ${GREMLIN_SERVER_DIR} /opt/gremlin-server
+
+WORKDIR /opt/gremlin-server
+
+EXPOSE 8182
+
+ENTRYPOINT ["/docker-entrypoint.sh"]
+CMD ["conf/gremlin-server.yaml"]
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/5ac78169/gremlin-server/pom.xml
----------------------------------------------------------------------
diff --git a/gremlin-server/pom.xml b/gremlin-server/pom.xml
index 68733a9..dfc6570 100644
--- a/gremlin-server/pom.xml
+++ b/gremlin-server/pom.xml
@@ -243,5 +243,39 @@ limitations under the License.
                 </plugins>
             </build>
         </profile>
+
+        <profile>
+            <id>docker-images</id>
+            <activation>
+                <activeByDefault>false</activeByDefault>
+                <file>
+                    <exists>.docker</exists>
+                </file>
+            </activation>
+            <build>
+                <plugins>
+                    <plugin>
+                        <groupId>com.spotify</groupId>
+                        <artifactId>dockerfile-maven-plugin</artifactId>
+                        <executions>
+                            <execution>
+                                <id>docker-image</id>
+                                <goals>
+                                    <goal>build</goal>
+                                    <goal>push</goal>
+                                </goals>
+                            </execution>
+                        </executions>
+                        <configuration>
+                            <repository>tinkerpop/gremlin-server</repository>
+                            <tag>${project.version}</tag>
+                            <buildArgs>
+                                <GREMLIN_SERVER_DIR>target/apache-tinkerpop-${project.artifactId}-${project.version}-standalone</GREMLIN_SERVER_DIR>
+                            </buildArgs>
+                        </configuration>
+                    </plugin>
+                </plugins>                
+            </build>
+        </profile>
     </profiles>
 </project>

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/5ac78169/gremlin-server/src/main/docker/docker-entrypoint.sh
----------------------------------------------------------------------
diff --git a/gremlin-server/src/main/docker/docker-entrypoint.sh b/gremlin-server/src/main/docker/docker-entrypoint.sh
new file mode 100644
index 0000000..d869b8c
--- /dev/null
+++ b/gremlin-server/src/main/docker/docker-entrypoint.sh
@@ -0,0 +1,31 @@
+#!/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.
+#
+
+set -e
+
+CONF_FILE=$1
+
+# IP substitution hack borrowed from:
+# https://github.com/htaox/NEAT/blob/94a004831cf89767e116d955192fc14ac82e5069/docker-scripts/gremlin-server-3.0.0/files/default_cmd#L5
+IP=$(ip -o -4 addr list eth0 | perl -n -e 'if (m{inet\s([\d\.]+)\/\d+\s}xms) { print $1 }')
+sed -i "s|^host:.*|host: $IP|" $CONF_FILE
+
+exec /opt/gremlin-server/bin/gremlin-server.sh "$@"
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/tinkerpop/blob/5ac78169/pom.xml
----------------------------------------------------------------------
diff --git a/pom.xml b/pom.xml
index 9c4b507..5251de3 100644
--- a/pom.xml
+++ b/pom.xml
@@ -319,6 +319,7 @@ limitations under the License.
                         <exclude>**/_bsp/**</exclude>
                         <exclude>DEPENDENCIES</exclude>
                         <exclude>**/.glv</exclude>
+                        <exclude>**/.docker</exclude>
                         <exclude>bin/gremlin.sh</exclude>
                         <exclude>gremlin-console/bin/gremlin.sh</exclude>
                         <exclude>**/Debug/**</exclude>
@@ -496,6 +497,11 @@ limitations under the License.
                     <artifactId>maven-jar-plugin</artifactId>
                     <version>3.0.2</version>
                 </plugin>
+                <plugin>
+                    <groupId>com.spotify</groupId>
+                    <artifactId>dockerfile-maven-plugin</artifactId>
+                    <version>1.3.7</version>
+                </plugin>
             </plugins>
         </pluginManagement>
     </build>