From 92fdf91fc70f13e801717eb2d18924b90d0cb02b Mon Sep 17 00:00:00 2001 From: Robert Dale Date: Tue, 27 Sep 2016 20:27:47 -0400 Subject: [PATCH 1/8] added sysv and systemd init scripts --- CHANGELOG.asciidoc | 1 + docs/src/upgrade/release-3.3.x.asciidoc | 51 ++++++ .../src/main/bin/gremlin-server.conf | 24 +++ .../src/main/bin/gremlin-server.initd | 173 ++++++++++++++++++ .../src/main/bin/gremlin-server.service | 18 ++ 5 files changed, 267 insertions(+) create mode 100644 gremlin-server/src/main/bin/gremlin-server.conf create mode 100755 gremlin-server/src/main/bin/gremlin-server.initd create mode 100644 gremlin-server/src/main/bin/gremlin-server.service diff --git a/CHANGELOG.asciidoc b/CHANGELOG.asciidoc index 7482d3f3896..105d7f43aba 100644 --- a/CHANGELOG.asciidoc +++ b/CHANGELOG.asciidoc @@ -44,6 +44,7 @@ TinkerPop 3.3.0 (Release Date: NOT OFFICIALLY RELEASED YET) * Added `gremlin-tools` and its submodule `gremlin-coverage`. * Removed `tryRandomCommit()` from `AbstractGremlinTest`. * Changed `gremlin-benchmark` system property for the report location to `benchmarkReportDir` for consistency. +* Added SysV and systemd init scripts. TinkerPop 3.2.0 (Nine Inch Gremlins) ------------------------------------ diff --git a/docs/src/upgrade/release-3.3.x.asciidoc b/docs/src/upgrade/release-3.3.x.asciidoc index b05ccff395c..6bcc8e6a57b 100644 --- a/docs/src/upgrade/release-3.3.x.asciidoc +++ b/docs/src/upgrade/release-3.3.x.asciidoc @@ -112,3 +112,54 @@ concerned with breaking changes related to the removal of: Those graph providers who relied on these tests should simply remove them from their respective test suites. See: link:https://issues.apache.org/jira/browse/TINKERPOP-1235[TINKERPOP-1235] + +SysV and Systemd Init Scripts +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +This replaces gremlin-server.sh + +*SysV* + +Certain parameters can be configured via bin/gremlin-server.conf + +[source,bash] +---- +# Install +ln -s /path/to/apache-tinkerpop-gremlin-server-x.y.z/bin/gremlin-server.initd /etc/init.d/gremlin-server + +# Systems with chkconfig/service. E.g. Fedora, Red Hat +chkconfig --add gremlin-server + +# Start +service gremlin-server start + +# Or call directly +/etc/init.d/gremlin-server restart + +# Can even be used without installing +./bin/gremlin-server.initd restart +---- + +*systemd* + +JAVA_HOME and JAVA_OPTIONS can be configured via bin/gremlin-server.conf + +[source,bash] +---- +# Install +cp /path/to/apache-tinkerpop-gremlin-server-x.y.z/bin/gremlin-server.service /etc/systemd/system/ + +# Configure systemd template +# Update WorkingDirectory, EnvironmentFile, ExecStart installation path locations +# Check User, Group +edit /etc/systemd/system/gremlin-server.service + +# Enable +systemctl enable gremlin-server + +# Start +systemctl start gremlin-server + +---- + +See: link:https://issues.apache.org/jira/browse/TINKERPOP-980[TINKERPOP-980] diff --git a/gremlin-server/src/main/bin/gremlin-server.conf b/gremlin-server/src/main/bin/gremlin-server.conf new file mode 100644 index 00000000000..e38f23931c4 --- /dev/null +++ b/gremlin-server/src/main/bin/gremlin-server.conf @@ -0,0 +1,24 @@ + +# initd: debug the initd script +#DEBUG=1 + +# initd: gremlin server install location +#GREMLIN_HOME= + +# initd: Yaml file passed to gremlin server. Path can be absolute or relative to GREMLIN_HOME e.g. conf/gremlin-server.yaml +#GREMLIN_YAML= + +# initd: console log location +#LOG_DIR= + +# initd: server PID location +#PID_DIR= + +# initd: run server as user +#RUNAS=gremlin + +# set java installation +#JAVA_HOME= + +# set java options +#JAVA_OPTIONS= diff --git a/gremlin-server/src/main/bin/gremlin-server.initd b/gremlin-server/src/main/bin/gremlin-server.initd new file mode 100755 index 00000000000..1049806444a --- /dev/null +++ b/gremlin-server/src/main/bin/gremlin-server.initd @@ -0,0 +1,173 @@ +#!/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. +# + +### BEGIN INIT INFO +# Provides: gremlin-server +# Required-Start: $remote_fs $syslog $network +# Required-Stop: $remote_fs $syslog $network +# Default-Start: 2 3 4 5 +# Default-Stop: 0 1 6 +# Short-Description: Gremlin Server +# Description: Apache Tinkerpop Gremlin Server +# chkconfig: 2345 98 01 +### END INIT INFO + +[[ -n "$DEBUG" ]] && set -x + +SOURCE="$0" +while [ -h "$SOURCE" ]; do + cd -P "$( dirname "$SOURCE" )" || exit 1 + DIR="$(pwd)" + SOURCE="$(readlink "$SOURCE")" + [[ $SOURCE != /* ]] && SOURCE="$DIR/$SOURCE" +done +cd -P "$( dirname "$SOURCE" )" || exit 1 +GREMLIN_BIN="$(pwd)" + +GREMLIN_CONF=$GREMLIN_BIN/gremlin-server.conf + +[[ -r $GREMLIN_CONF ]] && source $GREMLIN_CONF +[[ -n "$DEBUG" ]] && set -x + +if [ -z "$GREMLIN_HOME" ]; then + cd .. + GREMLIN_HOME="$(pwd)" +fi + +GREMLIN_CMD=$GREMLIN_HOME/bin/gremlin-server.sh + +if [ -z "$LOG_DIR" ] ; then + LOG_DIR="$GREMLIN_HOME/logs" +fi + +if [ ! -d "$LOG_DIR" ]; then + echo LOG_DIR $LOG_DIR does not exist + exit 1 +fi + +if [ -z "$LOG_FILE" ]; then + LOG_FILE="$LOG_DIR/gremlin.log" +fi + +if [ -z "$PID_DIR" ] ; then + PID_DIR="$GREMLIN_HOME/run" +fi + +if [ ! -d "$PID_DIR" ]; then + echo PID_DIR $PID_DIR does not exist + exit 1 +fi + +if [ -z "$PID_FILE" ]; then + PID_FILE=$PID_DIR/gremlin.pid +fi + +if [ -z "$GREMLIN_YAML" ]; then + GREMLIN_YAML=$GREMLIN_HOME/conf/gremlin-server.yaml +fi + +if [ ! -r "$GREMLIN_YAML" ]; then + # try relative to home + GREMLIN_YAML="$GREMLIN_HOME/$GREMLIN_YAML" + if [ ! -r "$GREMLIN_YAML" ]; then + echo WARNING: $GREMLIN_YAML is unreadable + fi +fi + +status() { + if [ -r "$PID_FILE" ] ; then + PID=$(cat "$PID_FILE") + ps -p "$PID" &> /dev/null + RUNNING=$? + if [ $RUNNING -gt 0 ]; then + echo Server not running + else + echo Server running with PID $(cat "$PID_FILE") + fi + else + echo Server not running or PID file not found. + fi +} + +stop() { + if [ -r "$PID_FILE" ] ; then + PID=$(cat "$PID_FILE") + ps -p "$PID" &> /dev/null + RUNNING=$? + if [ $RUNNING -gt 0 ]; then + echo Server not running + else + kill "$PID" &> /dev/null || { echo "Unable to kill server [$PID]"; exit 1; } + for i in $(seq 1 60); do + ps -p "$PID" &> /dev/null || { echo "Server stopped [$PID]"; rm -f "$PID_FILE"; return 0; } + [[ $i -eq 30 ]] && kill "$PID" &> /dev/null + sleep 1 + done + echo "Unable to kill server [$PID]"; + exit 1; + fi + else + echo Server not running or PID file not found. + fi + rm -f "$PID_FILE" +} + +start() { + + if [ -r "$PID_FILE" ] ; then + PID=$(cat "$PID_FILE") + ps -p "$PID" &> /dev/null + RUNNING=$? + if [ $RUNNING -eq 0 ]; then + echo Server already running with PID $(cat "$PID_FILE"). + exit 1 + fi + fi + + if [ -z "$RUNAS" ]; then + JAVA_HOME="$JAVA_HOME" JAVA_OPTIONS="$JAVA_OPTIONS" $GREMLIN_CMD "$GREMLIN_YAML" >> "$LOG_FILE" 2>&1 & + PID=$! + disown $PID + echo $PID > "$PID_FILE" + else + su -c "JAVA_HOME=\"$JAVA_HOME\" JAVA_OPTIONS=\"$JAVA_OPTIONS\" $GREMLIN_CMD \"$GREMLIN_YAML\" >> \"$LOG_FILE\" 2>&1 & echo \$! " "$RUNAS" > "$PID_FILE" + chown "$RUNAS" "$PID_FILE" + fi + +} + +case "$1" in + status) + status + ;; + restart) + stop + start + ;; + start) + start + ;; + stop) + stop + ;; + *) + echo "Usage: $0 {start|stop|restart|status}"; exit 1; + ;; +esac diff --git a/gremlin-server/src/main/bin/gremlin-server.service b/gremlin-server/src/main/bin/gremlin-server.service new file mode 100644 index 00000000000..21037d7e764 --- /dev/null +++ b/gremlin-server/src/main/bin/gremlin-server.service @@ -0,0 +1,18 @@ + +[Unit] +Description=Apache Tinkerpop Gremlin server daemon +Documentation=http://tinkerpop.apache.org/ +After=network.target + +[Service] +WorkingDirectory=/opt/apache-tinkerpop-gremlin-server +EnvironmentFile=/opt/apache-tinkerpop-gremlin-server/bin/gremlin-server.conf +ExecStart=/opt/apache-tinkerpop-gremlin-server/bin/gremlin-server.sh +KillMode=process +Restart=no +RestartSec=60s +User=gremlin +Group=gremlin + +[Install] +WantedBy=multi-user.target From 417a791af619a105c5e3d93466949b4acb44f7a6 Mon Sep 17 00:00:00 2001 From: Robert Dale Date: Tue, 27 Sep 2016 20:52:58 -0400 Subject: [PATCH 2/8] added license to make rat happy --- .../src/main/bin/gremlin-server.conf | 18 ++++++++++++++++++ .../src/main/bin/gremlin-server.service | 18 ++++++++++++++++++ 2 files changed, 36 insertions(+) diff --git a/gremlin-server/src/main/bin/gremlin-server.conf b/gremlin-server/src/main/bin/gremlin-server.conf index e38f23931c4..22f33854ec6 100644 --- a/gremlin-server/src/main/bin/gremlin-server.conf +++ b/gremlin-server/src/main/bin/gremlin-server.conf @@ -1,3 +1,21 @@ +# +# 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. +# # initd: debug the initd script #DEBUG=1 diff --git a/gremlin-server/src/main/bin/gremlin-server.service b/gremlin-server/src/main/bin/gremlin-server.service index 21037d7e764..2cec63f03b8 100644 --- a/gremlin-server/src/main/bin/gremlin-server.service +++ b/gremlin-server/src/main/bin/gremlin-server.service @@ -1,3 +1,21 @@ +# +# 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. +# [Unit] Description=Apache Tinkerpop Gremlin server daemon From e4a94ad6615967a026ccddf7abd3b70d726b860a Mon Sep 17 00:00:00 2001 From: Robert Dale Date: Fri, 30 Sep 2016 08:39:39 -0400 Subject: [PATCH 3/8] gremlin-server.sh is also init script. updated docs. --- .../reference/gremlin-applications.asciidoc | 114 +++++++- docs/src/reference/gremlin-variants.asciidoc | 4 +- .../reference/implementations-neo4j.asciidoc | 2 +- .../gremlin-language-variants/index.asciidoc | 2 +- docs/src/upgrade/release-3.3.x.asciidoc | 50 +--- .../src/main/bin/gremlin-server.initd | 173 ----------- .../src/main/bin/gremlin-server.service | 36 --- gremlin-server/src/main/bin/gremlin-server.sh | 275 ++++++++++++++++-- 8 files changed, 354 insertions(+), 302 deletions(-) delete mode 100755 gremlin-server/src/main/bin/gremlin-server.initd delete mode 100644 gremlin-server/src/main/bin/gremlin-server.service diff --git a/docs/src/reference/gremlin-applications.asciidoc b/docs/src/reference/gremlin-applications.asciidoc index 5a0e3974a5e..29d12b9dc25 100644 --- a/docs/src/reference/gremlin-applications.asciidoc +++ b/docs/src/reference/gremlin-applications.asciidoc @@ -680,7 +680,7 @@ which will boost performance and reduce resources required on the server. Configuration ^^^^^^^^^^^^^ -The following table describes the various configuration options for the Gremlin Driver: +The following table describes the various YAML configuration options for the Gremlin Driver: [width="100%",cols="3,10,^2",options="header"] |========================================================= @@ -959,29 +959,58 @@ can be cached for faster evaluation on the next submission. Configuring ~~~~~~~~~~~ -As mentioned earlier, Gremlin Server is configured though a YAML file. By default, Gremlin Server will look for a -file called `conf/gremlin-server.yaml` to configure itself on startup. To override this default, supply the file -to use to `bin/gremlin-server.sh` as in: - -[source,text] ----- -bin/gremlin-server.sh conf/gremlin-server-min.yaml ----- - -The `gremlin-server.sh` file also serves a second purpose. It can be used to "install" dependencies to the Gremlin +The `gremlin-server.sh` file serves multiple purposes. It can be used to "install" dependencies to the Gremlin Server path. For example, to be able to configure and use other `Graph` implementations, the dependencies must be -made available to Gremlin Server. To do this, use the `-i` switch and supply the Maven coordinates for the dependency +made available to Gremlin Server. To do this, use the `install` switch and supply the Maven coordinates for the dependency to "install". For example, to use Neo4j in Gremlin Server: [source,text] ---- -bin/gremlin-server.sh -i org.apache.tinkerpop neo4j-gremlin x.y.z +bin/gremlin-server.sh install org.apache.tinkerpop neo4j-gremlin x.y.z ---- This command will "grab" the appropriate dependencies and copy them to the `ext` directory of Gremlin Server, which will then allow them to be "used" the next time the server is started. To uninstall dependencies, simply delete them from the `ext` directory. +`bin/gremlin-server.sh` has several other options. + +[width="100%",cols="3,10",options="header"] +|========================================================= +|Parameter|Description +|start|Start the server in the background. +|stop|Shutdown the server. +|restart|Shutdown a running server then start it again. +|status|Check if the server is running. +|console|Start the server in the foreground. Use ^C to kill it. +|install | Install dependencies into the server. "-i" exists for backwards compatibility but is deprecated. +|| Start the server in the foreground using the provided YAML config file. +|========================================================= + +The `bin/gremlin-server.sh` script can be customized with environment variables in `bin/gremlin-server.conf`. + +[width="100%",cols="3,10",options="header"] +|========================================================= +|Variable |Description +|DEBUG| Enable debugging of the startup script +|GREMLIN_HOME| The Gremlin Server install directory. Use this if the script has trouble finding itself. +|GREMLIN_YAML| The default server YAML file (conf/gremlin-server.yaml) +|LOG_DIR| Location of gremlin.log where stdout/stderr are captured (logs/) +|PID_DIR| Location of gremlin.pid +|RUNAS| User to run the server as +|JAVA_HOME| Java install location. Will use $JAVA_HOME/bin/java +|JAVA_OPTIONS| Options passed to the JVM +|========================================================= + +As mentioned earlier, Gremlin Server is configured though a YAML file. By default, Gremlin Server will look for a +file called `conf/gremlin-server.yaml` to configure itself on startup. To override this default, set GREMLIN_YAML in `bin/gemlin-server.conf` or supply the file +to use to `bin/gremlin-server.sh` as in: + +[source,text] +---- +bin/gremlin-server.sh conf/gremlin-server-min.yaml +---- + The following table describes the various configuration options that Gremlin Server expects: [width="100%",cols="3,10,^2",options="header"] @@ -1482,6 +1511,63 @@ and standard deviation evaluation times, as well as the 75th, 95th, 98th, 99th a mean, and standard deviation evaluation times, as well as the 75th, 95th, 98th, 99th and 99.9th percentile evaluation times. +As A Service +^^^^^^^^^^^^ + +Gremlin server can be configured to run as a service. + +Init.d (SysV) ++++++++++++++ + +Link `bin/gremlin-server.sh` to `init.d` +Be sure to set RUNAS to the service user in `bin/gremlin-server.conf` + +[source,bash] +---- +# Install +ln -s /path/to/apache-tinkerpop-gremlin-server-x.y.z/bin/gremlin-server.sh /etc/init.d/gremlin-server + +# Systems with chkconfig/service. E.g. Fedora, Red Hat +chkconfig --add gremlin-server + +# Start +service gremlin-server start + +# Or call directly +/etc/init.d/gremlin-server restart + +---- + +Systemd ++++++++ + +To install, copy the this service template to /etc/systemd/system/gremlin.service +and update the paths `/path/to/apache-tinkerpop-gremlin-server` with the actual install path of gremlin server. + +[source,bash] +---- +[Unit] +Description=Apache Tinkerpop Gremlin server daemon +Documentation=http://tinkerpop.apache.org/ +After=network.target + +[Service] +Type=forking +ExecStart=/path/to/apache-tinkerpop-gremlin-server/bin/gremlin-server.sh start +ExecStop=/path/to/apache-tinkerpop-gremlin-server/bin/gremlin-server.sh stop +PIDFile=/path/to/apache-tinkerpop-gremlin-server/run/gremlin.pid +User=gremlin + +[Install] +WantedBy=multi-user.target +---- + + +Enable the service with `systemctl enable gremlin-server` + +Start the service with `systemctl start gremlin-server` + + Best Practices ~~~~~~~~~~~~~~ @@ -1492,7 +1578,7 @@ Tuning image:gremlin-handdrawn.png[width=120,float=right] Tuning Gremlin Server for a particular environment may require some simple trial-and-error, but the following represent some basic guidelines that might be useful: -* Gremlin Server defaults to a very modest maximum heap size. Consider increasing this value for non-trivial uses. Maximum heap size (`-Xmx`) is defined with the `JAVA_OPTIONS` setting in `gremlin-server.sh`. +* Gremlin Server defaults to a very modest maximum heap size. Consider increasing this value for non-trivial uses. Maximum heap size (`-Xmx`) is defined with the `JAVA_OPTIONS` setting in `gremlin-server.conf`. * When configuring the size of `threadPoolWorker` start with the default of `1` and increment by one as needed to a maximum of `2*number of cores`. * The "right" size of the `gremlinPool` setting is somewhat dependent on the type of scripts that will be processed by Gremlin Server. As requests arrive to Gremlin Server they are decoded and queued to be processed by threads in diff --git a/docs/src/reference/gremlin-variants.asciidoc b/docs/src/reference/gremlin-variants.asciidoc index 853b0878922..1fc2559e385 100644 --- a/docs/src/reference/gremlin-variants.asciidoc +++ b/docs/src/reference/gremlin-variants.asciidoc @@ -125,7 +125,7 @@ IMPORTANT: Gremlin-Python is compatible with GraphSON 2.0 only, so this serializ [source,bash] ---- -$ bin/gremlin-server.sh -i org.apache.tinkerpop gremlin-python x.y.z +$ bin/gremlin-server.sh install org.apache.tinkerpop gremlin-python x.y.z $ bin/gremlin-server.sh conf/gremlin-server-modern-py.yaml [INFO] GremlinServer - \,,,/ @@ -161,7 +161,7 @@ $ bin/gremlin-server.sh conf/gremlin-server-modern-py.yaml ---- -NOTE: The command to use `-i` need only be executed once to gather `gremlin-python` dependencies into Gremlin Servers' +NOTE: The command to use `install` need only be executed once to gather `gremlin-python` dependencies into Gremlin Servers' path. Future starts of Gremlin Server will not require that command. Within the CPython console, an empty `Graph` is created and a traversal source is spawned with `RemoteStrategy`. diff --git a/docs/src/reference/implementations-neo4j.asciidoc b/docs/src/reference/implementations-neo4j.asciidoc index 902295f164a..42ab2bf6021 100644 --- a/docs/src/reference/implementations-neo4j.asciidoc +++ b/docs/src/reference/implementations-neo4j.asciidoc @@ -58,7 +58,7 @@ gremlin> graph = Neo4jGraph.open('/tmp/neo4j') TIP: To host Neo4j in <>, the dependencies must first be "installed" or otherwise copied to the Gremlin Server path. The automated method for doing this would be to execute -`bin/gremlin-server.sh -i org.apache.tinkerpop neo4j-gremlin x.y.z`. +`bin/gremlin-server.sh install org.apache.tinkerpop neo4j-gremlin x.y.z`. Indices ~~~~~~~ diff --git a/docs/src/tutorials/gremlin-language-variants/index.asciidoc b/docs/src/tutorials/gremlin-language-variants/index.asciidoc index 533aa04e2c9..65fb58fdf7d 100644 --- a/docs/src/tutorials/gremlin-language-variants/index.asciidoc +++ b/docs/src/tutorials/gremlin-language-variants/index.asciidoc @@ -519,7 +519,7 @@ for serialization to a `RemoteConnection` such as GremlinServer. [source,bash] ---- -$ bin/gremlin-server.sh -i org.apache.tinkerpop gremlin-python x.y.z +$ bin/gremlin-server.sh install org.apache.tinkerpop gremlin-python x.y.z $ bin/gremlin-server.sh conf/gremlin-server-modern-py.yaml [INFO] GremlinServer - \,,,/ diff --git a/docs/src/upgrade/release-3.3.x.asciidoc b/docs/src/upgrade/release-3.3.x.asciidoc index 6bcc8e6a57b..6935eed0798 100644 --- a/docs/src/upgrade/release-3.3.x.asciidoc +++ b/docs/src/upgrade/release-3.3.x.asciidoc @@ -113,53 +113,11 @@ Those graph providers who relied on these tests should simply remove them from t See: link:https://issues.apache.org/jira/browse/TINKERPOP-1235[TINKERPOP-1235] -SysV and Systemd Init Scripts -^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - -This replaces gremlin-server.sh - -*SysV* - -Certain parameters can be configured via bin/gremlin-server.conf - -[source,bash] ----- -# Install -ln -s /path/to/apache-tinkerpop-gremlin-server-x.y.z/bin/gremlin-server.initd /etc/init.d/gremlin-server - -# Systems with chkconfig/service. E.g. Fedora, Red Hat -chkconfig --add gremlin-server - -# Start -service gremlin-server start - -# Or call directly -/etc/init.d/gremlin-server restart - -# Can even be used without installing -./bin/gremlin-server.initd restart ----- - -*systemd* - -JAVA_HOME and JAVA_OPTIONS can be configured via bin/gremlin-server.conf - -[source,bash] ----- -# Install -cp /path/to/apache-tinkerpop-gremlin-server-x.y.z/bin/gremlin-server.service /etc/systemd/system/ - -# Configure systemd template -# Update WorkingDirectory, EnvironmentFile, ExecStart installation path locations -# Check User, Group -edit /etc/systemd/system/gremlin-server.service - -# Enable -systemctl enable gremlin-server +Gremlin-server.sh and Init Scripts +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -# Start -systemctl start gremlin-server +`gremlin-server.sh` is now also an init script and can no longer be started without parameters. To start it in the foreground, please use the `console` parameter. Also, it will still start in the foreground when provided a yaml configuration file. ----- +How to install as a service has been added to the reference docs. See: link:https://issues.apache.org/jira/browse/TINKERPOP-980[TINKERPOP-980] diff --git a/gremlin-server/src/main/bin/gremlin-server.initd b/gremlin-server/src/main/bin/gremlin-server.initd deleted file mode 100755 index 1049806444a..00000000000 --- a/gremlin-server/src/main/bin/gremlin-server.initd +++ /dev/null @@ -1,173 +0,0 @@ -#!/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. -# - -### BEGIN INIT INFO -# Provides: gremlin-server -# Required-Start: $remote_fs $syslog $network -# Required-Stop: $remote_fs $syslog $network -# Default-Start: 2 3 4 5 -# Default-Stop: 0 1 6 -# Short-Description: Gremlin Server -# Description: Apache Tinkerpop Gremlin Server -# chkconfig: 2345 98 01 -### END INIT INFO - -[[ -n "$DEBUG" ]] && set -x - -SOURCE="$0" -while [ -h "$SOURCE" ]; do - cd -P "$( dirname "$SOURCE" )" || exit 1 - DIR="$(pwd)" - SOURCE="$(readlink "$SOURCE")" - [[ $SOURCE != /* ]] && SOURCE="$DIR/$SOURCE" -done -cd -P "$( dirname "$SOURCE" )" || exit 1 -GREMLIN_BIN="$(pwd)" - -GREMLIN_CONF=$GREMLIN_BIN/gremlin-server.conf - -[[ -r $GREMLIN_CONF ]] && source $GREMLIN_CONF -[[ -n "$DEBUG" ]] && set -x - -if [ -z "$GREMLIN_HOME" ]; then - cd .. - GREMLIN_HOME="$(pwd)" -fi - -GREMLIN_CMD=$GREMLIN_HOME/bin/gremlin-server.sh - -if [ -z "$LOG_DIR" ] ; then - LOG_DIR="$GREMLIN_HOME/logs" -fi - -if [ ! -d "$LOG_DIR" ]; then - echo LOG_DIR $LOG_DIR does not exist - exit 1 -fi - -if [ -z "$LOG_FILE" ]; then - LOG_FILE="$LOG_DIR/gremlin.log" -fi - -if [ -z "$PID_DIR" ] ; then - PID_DIR="$GREMLIN_HOME/run" -fi - -if [ ! -d "$PID_DIR" ]; then - echo PID_DIR $PID_DIR does not exist - exit 1 -fi - -if [ -z "$PID_FILE" ]; then - PID_FILE=$PID_DIR/gremlin.pid -fi - -if [ -z "$GREMLIN_YAML" ]; then - GREMLIN_YAML=$GREMLIN_HOME/conf/gremlin-server.yaml -fi - -if [ ! -r "$GREMLIN_YAML" ]; then - # try relative to home - GREMLIN_YAML="$GREMLIN_HOME/$GREMLIN_YAML" - if [ ! -r "$GREMLIN_YAML" ]; then - echo WARNING: $GREMLIN_YAML is unreadable - fi -fi - -status() { - if [ -r "$PID_FILE" ] ; then - PID=$(cat "$PID_FILE") - ps -p "$PID" &> /dev/null - RUNNING=$? - if [ $RUNNING -gt 0 ]; then - echo Server not running - else - echo Server running with PID $(cat "$PID_FILE") - fi - else - echo Server not running or PID file not found. - fi -} - -stop() { - if [ -r "$PID_FILE" ] ; then - PID=$(cat "$PID_FILE") - ps -p "$PID" &> /dev/null - RUNNING=$? - if [ $RUNNING -gt 0 ]; then - echo Server not running - else - kill "$PID" &> /dev/null || { echo "Unable to kill server [$PID]"; exit 1; } - for i in $(seq 1 60); do - ps -p "$PID" &> /dev/null || { echo "Server stopped [$PID]"; rm -f "$PID_FILE"; return 0; } - [[ $i -eq 30 ]] && kill "$PID" &> /dev/null - sleep 1 - done - echo "Unable to kill server [$PID]"; - exit 1; - fi - else - echo Server not running or PID file not found. - fi - rm -f "$PID_FILE" -} - -start() { - - if [ -r "$PID_FILE" ] ; then - PID=$(cat "$PID_FILE") - ps -p "$PID" &> /dev/null - RUNNING=$? - if [ $RUNNING -eq 0 ]; then - echo Server already running with PID $(cat "$PID_FILE"). - exit 1 - fi - fi - - if [ -z "$RUNAS" ]; then - JAVA_HOME="$JAVA_HOME" JAVA_OPTIONS="$JAVA_OPTIONS" $GREMLIN_CMD "$GREMLIN_YAML" >> "$LOG_FILE" 2>&1 & - PID=$! - disown $PID - echo $PID > "$PID_FILE" - else - su -c "JAVA_HOME=\"$JAVA_HOME\" JAVA_OPTIONS=\"$JAVA_OPTIONS\" $GREMLIN_CMD \"$GREMLIN_YAML\" >> \"$LOG_FILE\" 2>&1 & echo \$! " "$RUNAS" > "$PID_FILE" - chown "$RUNAS" "$PID_FILE" - fi - -} - -case "$1" in - status) - status - ;; - restart) - stop - start - ;; - start) - start - ;; - stop) - stop - ;; - *) - echo "Usage: $0 {start|stop|restart|status}"; exit 1; - ;; -esac diff --git a/gremlin-server/src/main/bin/gremlin-server.service b/gremlin-server/src/main/bin/gremlin-server.service deleted file mode 100644 index 2cec63f03b8..00000000000 --- a/gremlin-server/src/main/bin/gremlin-server.service +++ /dev/null @@ -1,36 +0,0 @@ -# -# 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. -# - -[Unit] -Description=Apache Tinkerpop Gremlin server daemon -Documentation=http://tinkerpop.apache.org/ -After=network.target - -[Service] -WorkingDirectory=/opt/apache-tinkerpop-gremlin-server -EnvironmentFile=/opt/apache-tinkerpop-gremlin-server/bin/gremlin-server.conf -ExecStart=/opt/apache-tinkerpop-gremlin-server/bin/gremlin-server.sh -KillMode=process -Restart=no -RestartSec=60s -User=gremlin -Group=gremlin - -[Install] -WantedBy=multi-user.target diff --git a/gremlin-server/src/main/bin/gremlin-server.sh b/gremlin-server/src/main/bin/gremlin-server.sh index fcede2bfe84..2dc3ae27eef 100755 --- a/gremlin-server/src/main/bin/gremlin-server.sh +++ b/gremlin-server/src/main/bin/gremlin-server.sh @@ -1,6 +1,5 @@ #!/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 @@ -18,45 +17,263 @@ # specific language governing permissions and limitations # under the License. # -case `uname` in - CYGWIN*) - CP="`dirname $0`"/../conf/ - CP="$CP":$( echo `dirname $0`/../lib/*.jar . | sed 's/ /;/g') - ;; - *) - CP="`dirname $0`"/../conf/ - CP="$CP":$( echo `dirname $0`/../lib/*.jar . | sed 's/ /:/g') -esac -#echo $CP -SOURCE="${BASH_SOURCE[0]}" -while [ -h "$SOURCE" ]; do - DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )" +### BEGIN INIT INFO +# Provides: gremlin-server +# Required-Start: $remote_fs $syslog $network +# Required-Stop: $remote_fs $syslog $network +# Default-Start: 2 3 4 5 +# Default-Stop: 0 1 6 +# Short-Description: Gremlin Server +# Description: Apache Tinkerpop Gremlin Server +# chkconfig: 2345 98 01 +### END INIT INFO + +[[ -n "$DEBUG" ]] && set -x + +SOURCE="$0" +while [[ -h "$SOURCE" ]]; do + cd -P "$( dirname "$SOURCE" )" || exit 1 + DIR="$(pwd)" SOURCE="$(readlink "$SOURCE")" [[ $SOURCE != /* ]] && SOURCE="$DIR/$SOURCE" done -DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )" -CP=$CP:$( find -L "$DIR"/../ext -mindepth 1 -maxdepth 1 -type d | \ - sort | sed 's/$/\/plugin\/*/' | tr '\n' ':' ) +cd -P "$( dirname "$SOURCE" )" || exit 1 +GREMLIN_BIN="$(pwd)" + +GREMLIN_CONF=$GREMLIN_BIN/gremlin-server.conf + +[[ -r $GREMLIN_CONF ]] && source $GREMLIN_CONF +[[ -n "$DEBUG" ]] && set -x -export CLASSPATH="${CLASSPATH:-}:$CP" +if [[ -z "$GREMLIN_HOME" ]]; then + cd .. + GREMLIN_HOME="$(pwd)" +fi + +if [[ -z "$LOG_DIR" ]] ; then + LOG_DIR="$GREMLIN_HOME/logs" +fi + +if [[ -z "$LOG_FILE" ]]; then + LOG_FILE="$LOG_DIR/gremlin.log" +fi + +if [[ -z "$PID_DIR" ]] ; then + PID_DIR="$GREMLIN_HOME/run" +fi + +if [[ -z "$PID_FILE" ]]; then + PID_FILE=$PID_DIR/gremlin.pid +fi + +if [[ -z "$GREMLIN_YAML" ]]; then + GREMLIN_YAML=$GREMLIN_HOME/conf/gremlin-server.yaml +fi + +if [[ ! -r "$GREMLIN_YAML" ]]; then + # try relative to home + GREMLIN_YAML="$GREMLIN_HOME/$GREMLIN_YAML" + if [[ ! -r "$GREMLIN_YAML" ]]; then + echo WARNING: $GREMLIN_YAML is unreadable + fi +fi + +# absolute file path requires 'file:' +LOG4J_CONF="file:$GREMLIN_HOME/conf/log4j-server.properties" # Find Java -if [ "$JAVA_HOME" = "" ] ; then - JAVA="java -server" +if [[ "$JAVA_HOME" = "" ]] ; then + JAVA="java" else - JAVA="$JAVA_HOME/bin/java -server" + JAVA="$JAVA_HOME/bin/java" fi # Set Java options -if [ "$JAVA_OPTIONS" = "" ] ; then +if [[ "$JAVA_OPTIONS" = "" ]] ; then JAVA_OPTIONS="-Xms32m -Xmx512m" fi -# Execute the application and return its exit code -if [ "$1" = "-i" ]; then - shift - exec $JAVA -Dlog4j.configuration=conf/log4j-server.properties $JAVA_OPTIONS -cp $CP:$CLASSPATH org.apache.tinkerpop.gremlin.server.util.GremlinServerInstall "$@" -else - exec $JAVA -Dlog4j.configuration=conf/log4j-server.properties $JAVA_OPTIONS -cp $CP:$CLASSPATH org.apache.tinkerpop.gremlin.server.GremlinServer "$@" -fi \ No newline at end of file +# Build Java CLASSPATH +CP="$GREMLIN_HOME/conf/" +CP="$CP":$( echo $GREMLIN_HOME/lib/*.jar . | sed 's/ /:/g') +CP="$CP":$( find -L "$GREMLIN_HOME"/ext -mindepth 1 -maxdepth 1 -type d | \ + sort | sed 's/$/\/plugin\/*/' | tr '\n' ':' ) + +CLASSPATH="${CLASSPATH:-}:$CP" + +GREMLIN_SERVER_CMD=org.apache.tinkerpop.gremlin.server.GremlinServer +GREMLIN_INSTALL_CMD=org.apache.tinkerpop.gremlin.server.util.GremlinServerInstall + + +isRunning() { + if [[ -r "$PID_FILE" ]] ; then + PID=$(cat "$PID_FILE") + ps -p "$PID" &> /dev/null + return $? + else + return 1 + fi +} + +status() { + isRunning + RUNNING=$? + if [[ $RUNNING -gt 0 ]]; then + echo Server not running + else + echo Server running with PID $(cat "$PID_FILE") + fi +} + +stop() { + isRunning + RUNNING=$? + if [[ $RUNNING -gt 0 ]]; then + echo Server not running + rm -f "$PID_FILE" + else + kill "$PID" &> /dev/null || { echo "Unable to kill server [$PID]"; exit 1; } + for i in $(seq 1 60); do + ps -p "$PID" &> /dev/null || { echo "Server stopped [$PID]"; rm -f "$PID_FILE"; return 0; } + [[ $i -eq 30 ]] && kill "$PID" &> /dev/null + sleep 1 + done + echo "Unable to kill server [$PID]"; + exit 1; + fi +} + +start() { + isRunning + RUNNING=$? + if [[ $RUNNING -eq 0 ]]; then + echo Server already running with PID $(cat "$PID_FILE"). + exit 1 + fi + + if [[ -z "$RUNAS" ]]; then + + mkdir -p "$LOG_DIR" &>/dev/null + if [[ ! -d "$LOG_DIR" ]]; then + echo ERROR: LOG_DIR $LOG_DIR does not exist and could not be created. + exit 1 + fi + + mkdir -p "$PID_DIR" &>/dev/null + if [[ ! -d "$PID_DIR" ]]; then + echo ERROR: PID_DIR $PID_DIR does not exist and could not be created. + exit 1 + fi + + $JAVA -Dlog4j.configuration=$LOG4J_CONF $JAVA_OPTIONS -cp $CP:$CLASSPATH $GREMLIN_SERVER_CMD "$GREMLIN_YAML" >> "$LOG_FILE" 2>&1 & + PID=$! + disown $PID + echo $PID > "$PID_FILE" + else + + su -c "mkdir -p $LOG_DIR &>/dev/null" "$RUNAS" + if [[ ! -d "$LOG_DIR" ]]; then + echo ERROR: LOG_DIR $LOG_DIR does not exist and could not be created. + exit 1 + fi + + su -c "mkdir -p $PID_DIR &>/dev/null" "$RUNAS" + if [[ ! -d "$PID_DIR" ]]; then + echo ERROR: PID_DIR $PID_DIR does not exist and could not be created. + exit 1 + fi + + su -c "$JAVA -Dlog4j.configuration=$LOG4J_CONF $JAVA_OPTIONS -cp $CP:$CLASSPATH $GREMLIN_SERVER_CMD \"$GREMLIN_YAML\" >> \"$LOG_FILE\" 2>&1 & echo \$! " "$RUNAS" > "$PID_FILE" + chown "$RUNAS" "$PID_FILE" + fi + + isRunning + RUNNING=$? + if [[ $RUNNING -eq 0 ]]; then + echo Server started $(cat "$PID_FILE"). + exit 0 + else + echo Server failed + exit 1 + fi + +} + +startForeground() { + isRunning + RUNNING=$? + if [[ $RUNNING -eq 0 ]]; then + echo Server already running with PID $(cat "$PID_FILE"). + exit 1 + fi + + if [[ -z "$RUNAS" ]]; then + $JAVA -Dlog4j.configuration=$LOG4J_CONF $JAVA_OPTIONS -cp $CP:$CLASSPATH $GREMLIN_SERVER_CMD "$GREMLIN_YAML" + exit 0 + else + echo Starting in foreground not supported with RUNAS + exit 1 + fi + +} + +install() { + + isRunning + RUNNING=$? + if [[ $RUNNING -eq 0 ]]; then + echo Server must be stopped before installing. + exit 1 + fi + + echo Installing dependency $@ + + DEPS="$@" + if [[ -z "$RUNAS" ]]; then + $JAVA -Dlog4j.configuration=$LOG4J_CONF $JAVA_OPTIONS -cp $CP:$CLASSPATH $GREMLIN_INSTALL_CMD $DEPS + else + su -c "$JAVA -Dlog4j.configuration=$LOG4J_CONF $JAVA_OPTIONS -cp $CP:$CLASSPATH $GREMLIN_INSTALL_CMD $DEPS " "$RUNAS" + fi + +} + +case "$1" in + status) + status + ;; + restart) + stop + start + ;; + start) + start + ;; + stop) + stop + ;; + -i) + shift + install "$@" + ;; + install) + shift + install "$@" + ;; + console) + startForeground + ;; + *) + if [[ -n "$1" ]] ; then + if [[ -r "$1" ]]; then + GREMLIN_YAML="$1" + startForeground + elif [[ -r "$GREMLIN_HOME/$1" ]] ; then + GREMLIN_YAML="$GREMLIN_HOME/$1" + startForeground + fi + echo Configuration file not found. + fi + echo "Usage: $0 {start|stop|restart|status|console|install |}"; exit 1; + ;; +esac From 47de5342967ec541a997371d47c6a6097d9c75de Mon Sep 17 00:00:00 2001 From: Robert Dale Date: Fri, 30 Sep 2016 09:39:59 -0400 Subject: [PATCH 4/8] Corrected systemd template, user will be handled by gremlin-server.sh. Updated correct section. --- docs/src/reference/gremlin-applications.asciidoc | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/docs/src/reference/gremlin-applications.asciidoc b/docs/src/reference/gremlin-applications.asciidoc index 29d12b9dc25..eea044afbc9 100644 --- a/docs/src/reference/gremlin-applications.asciidoc +++ b/docs/src/reference/gremlin-applications.asciidoc @@ -680,7 +680,7 @@ which will boost performance and reduce resources required on the server. Configuration ^^^^^^^^^^^^^ -The following table describes the various YAML configuration options for the Gremlin Driver: +The following table describes the various configuration options for the Gremlin Driver: [width="100%",cols="3,10,^2",options="header"] |========================================================= @@ -1011,7 +1011,7 @@ to use to `bin/gremlin-server.sh` as in: bin/gremlin-server.sh conf/gremlin-server-min.yaml ---- -The following table describes the various configuration options that Gremlin Server expects: +The following table describes the various YAML configuration options that Gremlin Server expects: [width="100%",cols="3,10,^2",options="header"] |========================================================= @@ -1556,7 +1556,6 @@ Type=forking ExecStart=/path/to/apache-tinkerpop-gremlin-server/bin/gremlin-server.sh start ExecStop=/path/to/apache-tinkerpop-gremlin-server/bin/gremlin-server.sh stop PIDFile=/path/to/apache-tinkerpop-gremlin-server/run/gremlin.pid -User=gremlin [Install] WantedBy=multi-user.target From 40b35ca40b2ba7552a3a8cd56ac60366b59d88e2 Mon Sep 17 00:00:00 2001 From: Robert Dale Date: Fri, 30 Sep 2016 11:11:29 -0400 Subject: [PATCH 5/8] added links to docs from upgrade note; added warning about -i --- docs/src/upgrade/release-3.3.x.asciidoc | 4 ++-- gremlin-server/src/main/bin/gremlin-server.sh | 1 + 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/docs/src/upgrade/release-3.3.x.asciidoc b/docs/src/upgrade/release-3.3.x.asciidoc index 6935eed0798..9743d51f8e5 100644 --- a/docs/src/upgrade/release-3.3.x.asciidoc +++ b/docs/src/upgrade/release-3.3.x.asciidoc @@ -118,6 +118,6 @@ Gremlin-server.sh and Init Scripts `gremlin-server.sh` is now also an init script and can no longer be started without parameters. To start it in the foreground, please use the `console` parameter. Also, it will still start in the foreground when provided a yaml configuration file. -How to install as a service has been added to the reference docs. +How to install as a service has been added to the link:http://tinkerpop.apache.org/docs/3.2.3/reference/#_as_a_service[Reference Documentation - As A Service]. -See: link:https://issues.apache.org/jira/browse/TINKERPOP-980[TINKERPOP-980] +See: link:https://issues.apache.org/jira/browse/TINKERPOP-980[TINKERPOP-980], link:http://tinkerpop.apache.org/docs/3.2.3/reference/#_configuring_2[Reference Documentation - Server Configuration]. diff --git a/gremlin-server/src/main/bin/gremlin-server.sh b/gremlin-server/src/main/bin/gremlin-server.sh index 2dc3ae27eef..fec465c02e5 100755 --- a/gremlin-server/src/main/bin/gremlin-server.sh +++ b/gremlin-server/src/main/bin/gremlin-server.sh @@ -254,6 +254,7 @@ case "$1" in ;; -i) shift + echo "Redirecting to 'install $@' (-i will be removed in a future release)" install "$@" ;; install) From f5132ea7738c320635b771facde904fd90709c1d Mon Sep 17 00:00:00 2001 From: Robert Dale Date: Thu, 27 Oct 2016 12:08:47 -0400 Subject: [PATCH 6/8] updated usage for windows gremlin-server.bat --- docs/src/reference/gremlin-applications.asciidoc | 2 ++ docs/src/upgrade/release-3.3.x.asciidoc | 9 ++++++++- gremlin-server/src/main/bin/gremlin-server.bat | 10 ++++++++-- 3 files changed, 18 insertions(+), 3 deletions(-) diff --git a/docs/src/reference/gremlin-applications.asciidoc b/docs/src/reference/gremlin-applications.asciidoc index eea044afbc9..ea8ef2ab20c 100644 --- a/docs/src/reference/gremlin-applications.asciidoc +++ b/docs/src/reference/gremlin-applications.asciidoc @@ -1011,6 +1011,8 @@ to use to `bin/gremlin-server.sh` as in: bin/gremlin-server.sh conf/gremlin-server-min.yaml ---- +WARNING: On Windows, gremlin-server.bat will always start in the foreground. When no parameter is provided, it will start with the default `conf/gremlin-server.yaml` file. + The following table describes the various YAML configuration options that Gremlin Server expects: [width="100%",cols="3,10,^2",options="header"] diff --git a/docs/src/upgrade/release-3.3.x.asciidoc b/docs/src/upgrade/release-3.3.x.asciidoc index 9743d51f8e5..e59070b858f 100644 --- a/docs/src/upgrade/release-3.3.x.asciidoc +++ b/docs/src/upgrade/release-3.3.x.asciidoc @@ -116,8 +116,15 @@ See: link:https://issues.apache.org/jira/browse/TINKERPOP-1235[TINKERPOP-1235] Gremlin-server.sh and Init Scripts ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -`gremlin-server.sh` is now also an init script and can no longer be started without parameters. To start it in the foreground, please use the `console` parameter. Also, it will still start in the foreground when provided a yaml configuration file. +`gremlin-server.sh` is now also an init script and can no longer be started without parameters. To start it in the foreground with defaults like previous usage, please use the `console` parameter. Also, `gremlin-server.sh` will continue to start in the foreground when provided a yaml configuration file. How to install as a service has been added to the link:http://tinkerpop.apache.org/docs/3.2.3/reference/#_as_a_service[Reference Documentation - As A Service]. +The switch name has changed for installing dependencies. `-i` has been deprecated and replaced by `install`. + See: link:https://issues.apache.org/jira/browse/TINKERPOP-980[TINKERPOP-980], link:http://tinkerpop.apache.org/docs/3.2.3/reference/#_configuring_2[Reference Documentation - Server Configuration]. + +Gremlin-server.bat +^^^^^^^^^^^^^^^^^^ + +The switch name has changed for installing dependencies. `-i` has been deprecated and replaced by `install`. diff --git a/gremlin-server/src/main/bin/gremlin-server.bat b/gremlin-server/src/main/bin/gremlin-server.bat index d6405fca03c..8ceab26d238 100644 --- a/gremlin-server/src/main/bin/gremlin-server.bat +++ b/gremlin-server/src/main/bin/gremlin-server.bat @@ -36,13 +36,19 @@ cd .. set JAVA_OPTIONS=-Xms32m -Xmx512m if "%1" == "" goto server -if "%1" == "-i" goto install +if "%1" == "-i" goto dashi +if "%1" == "install" goto install :server :: Launch the application java -Dlog4j.configuration=conf/log4j-server.properties %JAVA_OPTIONS% %JAVA_ARGS% -cp %LIBDIR%/*;%EXTDIR%; org.apache.tinkerpop.gremlin.server.GremlinServer %* +:dashi + +echo NOTE: -i is deprecated. Please update your scripts. Using 'install' command... +goto install + :install set RESTVAR= @@ -55,4 +61,4 @@ goto loop1 :after_loop -java -Dlog4j.configuration=conf/log4j-server.properties %JAVA_OPTIONS% %JAVA_ARGS% -cp %LIBDIR%/*;%EXTDIR%; org.apache.tinkerpop.gremlin.server.util.GremlinServerInstall %RESTVAR% \ No newline at end of file +java -Dlog4j.configuration=conf/log4j-server.properties %JAVA_OPTIONS% %JAVA_ARGS% -cp %LIBDIR%/*;%EXTDIR%; org.apache.tinkerpop.gremlin.server.util.GremlinServerInstall %RESTVAR% From a8954393dd7d2fc1b78fed2c83856745a65ddd63 Mon Sep 17 00:00:00 2001 From: Robert Dale Date: Thu, 17 Nov 2016 03:58:26 -0500 Subject: [PATCH 7/8] updated per @dkuppitz review --- docs/src/reference/gremlin-applications.asciidoc | 6 +++--- docs/src/upgrade/release-3.3.x.asciidoc | 4 ++-- gremlin-server/src/main/bin/gremlin-server.conf | 4 ++-- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/docs/src/reference/gremlin-applications.asciidoc b/docs/src/reference/gremlin-applications.asciidoc index ea8ef2ab20c..7d14e46b0ef 100644 --- a/docs/src/reference/gremlin-applications.asciidoc +++ b/docs/src/reference/gremlin-applications.asciidoc @@ -1543,13 +1543,13 @@ service gremlin-server start Systemd +++++++ -To install, copy the this service template to /etc/systemd/system/gremlin.service -and update the paths `/path/to/apache-tinkerpop-gremlin-server` with the actual install path of gremlin server. +To install, copy the service template below to /etc/systemd/system/gremlin.service +and update the paths `/path/to/apache-tinkerpop-gremlin-server` with the actual install path of Gremlin Server. [source,bash] ---- [Unit] -Description=Apache Tinkerpop Gremlin server daemon +Description=Apache TinkerPop Gremlin Server daemon Documentation=http://tinkerpop.apache.org/ After=network.target diff --git a/docs/src/upgrade/release-3.3.x.asciidoc b/docs/src/upgrade/release-3.3.x.asciidoc index e59070b858f..9810d5f1b9e 100644 --- a/docs/src/upgrade/release-3.3.x.asciidoc +++ b/docs/src/upgrade/release-3.3.x.asciidoc @@ -118,11 +118,11 @@ Gremlin-server.sh and Init Scripts `gremlin-server.sh` is now also an init script and can no longer be started without parameters. To start it in the foreground with defaults like previous usage, please use the `console` parameter. Also, `gremlin-server.sh` will continue to start in the foreground when provided a yaml configuration file. -How to install as a service has been added to the link:http://tinkerpop.apache.org/docs/3.2.3/reference/#_as_a_service[Reference Documentation - As A Service]. +How to install as a service has been added to the link:http://tinkerpop.apache.org/docs/3.3.0/reference/#_as_a_service[Reference Documentation - As A Service]. The switch name has changed for installing dependencies. `-i` has been deprecated and replaced by `install`. -See: link:https://issues.apache.org/jira/browse/TINKERPOP-980[TINKERPOP-980], link:http://tinkerpop.apache.org/docs/3.2.3/reference/#_configuring_2[Reference Documentation - Server Configuration]. +See: link:https://issues.apache.org/jira/browse/TINKERPOP-980[TINKERPOP-980], link:http://tinkerpop.apache.org/docs/x.y.z/reference/#_configuring_2[Reference Documentation - Server Configuration]. Gremlin-server.bat ^^^^^^^^^^^^^^^^^^ diff --git a/gremlin-server/src/main/bin/gremlin-server.conf b/gremlin-server/src/main/bin/gremlin-server.conf index 22f33854ec6..336b94381bb 100644 --- a/gremlin-server/src/main/bin/gremlin-server.conf +++ b/gremlin-server/src/main/bin/gremlin-server.conf @@ -20,10 +20,10 @@ # initd: debug the initd script #DEBUG=1 -# initd: gremlin server install location +# initd: Gremlin Server install location #GREMLIN_HOME= -# initd: Yaml file passed to gremlin server. Path can be absolute or relative to GREMLIN_HOME e.g. conf/gremlin-server.yaml +# initd: Yaml file passed to Gremlin Server. Path can be absolute or relative to GREMLIN_HOME e.g. conf/gremlin-server.yaml #GREMLIN_YAML= # initd: console log location From 7e907ce550766edb0c25ab5106b6b91a23d45d79 Mon Sep 17 00:00:00 2001 From: Robert Dale Date: Thu, 17 Nov 2016 04:26:51 -0500 Subject: [PATCH 8/8] fixed url version --- docs/src/upgrade/release-3.3.x.asciidoc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/src/upgrade/release-3.3.x.asciidoc b/docs/src/upgrade/release-3.3.x.asciidoc index 9810d5f1b9e..c0213d8d90b 100644 --- a/docs/src/upgrade/release-3.3.x.asciidoc +++ b/docs/src/upgrade/release-3.3.x.asciidoc @@ -122,7 +122,7 @@ How to install as a service has been added to the link:http://tinkerpop.apache.o The switch name has changed for installing dependencies. `-i` has been deprecated and replaced by `install`. -See: link:https://issues.apache.org/jira/browse/TINKERPOP-980[TINKERPOP-980], link:http://tinkerpop.apache.org/docs/x.y.z/reference/#_configuring_2[Reference Documentation - Server Configuration]. +See: link:https://issues.apache.org/jira/browse/TINKERPOP-980[TINKERPOP-980], link:http://tinkerpop.apache.org/docs/3.3.0/reference/#_configuring_2[Reference Documentation - Server Configuration]. Gremlin-server.bat ^^^^^^^^^^^^^^^^^^