summaryrefslogtreecommitdiffstats
path: root/standalone-container
diff options
context:
space:
mode:
authorHåkon Hallingstad <hakon@oath.com>2018-01-22 15:44:14 +0100
committerHåkon Hallingstad <hakon@oath.com>2018-01-22 15:44:14 +0100
commitfa9b1942bf51a3301398be5fdc8f18bf3d9485ff (patch)
tree0fed27e3b5047bc781096fd1834c9678cdad9b2a /standalone-container
parentb54f86da25e5183fc45d1d5f1620eb6394d7aca0 (diff)
Redefine task and its context
After discussions with bratseth, we'll not organize tasks in a tree structure, and instead have tasks mostly 1:1 with components. Tasks are put in chains, and may have ordering constraints between them that the chain resolves. The FileSystem API has been removed and instead use the raw java NIO FileSystem, and use Jimfs to mock FileSystem in tests. NodeAdminStateUpdater has been made an interface, since the HTTP request handler needs to delegate to it when getting requests. Much of the public HTTP API will get internalized with standalone NodeAdmin.
Diffstat (limited to 'standalone-container')
-rwxr-xr-xstandalone-container/src/main/sh/standalone-container.sh21
1 files changed, 16 insertions, 5 deletions
diff --git a/standalone-container/src/main/sh/standalone-container.sh b/standalone-container/src/main/sh/standalone-container.sh
index dd0693f6f85..02c71beaac5 100755
--- a/standalone-container/src/main/sh/standalone-container.sh
+++ b/standalone-container/src/main/sh/standalone-container.sh
@@ -67,6 +67,7 @@ Manage Vespa standalone jdisc container service.
Options:
-u USER Run as USER. Overrides any VESPA_USER environment variable.
-s SERVICE The service name.
+ -- ARGS... Pass the rest of the arguments (ARGS) to the Java invocation
EOF
exit 1
@@ -89,16 +90,19 @@ FixDataDirectory() {
StartCommand() {
local service="$1"
shift
-
- if (( $# > 0 )); then
- Fail "Too many arguments"
- fi
+ local -a jvm_arguments=("$@")
local service_regex='^[0-9a-zA-Z_-]+$'
if ! [[ "$service" =~ $service_regex ]]; then
Fail "Service must match regex '$service_regex'"
fi
+ local pidfile="$VESPA_HOME/var/run/$service.pid"
+ if test -r "$pidfile"; then
+ echo "$service is already running as PID $(< "$pidfile") according to $pidfile"
+ return
+ fi
+
# common setup
export VESPA_SERVICE_NAME="$service"
@@ -135,6 +139,7 @@ StartCommand() {
FixDataDirectory "$bundlecachedir"
java \
+ "${jvm_arguments[@]}" \
-Xms128m -Xmx2048m \
-XX:+PreserveFramePointer \
-XX:+HeapDumpOnOutOfMemoryError \
@@ -267,6 +272,7 @@ Main() {
local service="standalone/container"
local user="$VESPA_USER"
+ local -a jvm_arguments=()
while (( $# > 0 )); do
case "$1" in
@@ -279,6 +285,11 @@ Main() {
user="$2"
shift 2
;;
+ --)
+ shift
+ jvm_arguments=("$@")
+ break
+ ;;
*) break ;;
esac
done
@@ -300,7 +311,7 @@ Main() {
case "$command" in
help) Usage ;;
- start) StartCommand "$service" "$@" ;;
+ start) StartCommand "$service" "${jvm_arguments[@]}" ;;
stop) StopCommand "$user" "$service" "$@" ;;
*) Fail "Unknown command '$command'" ;;
esac