summaryrefslogtreecommitdiffstats
path: root/vespabase
diff options
context:
space:
mode:
Diffstat (limited to 'vespabase')
-rw-r--r--vespabase/CMakeLists.txt9
-rw-r--r--vespabase/README3
-rw-r--r--vespabase/conf/default-env.txt.in4
-rw-r--r--vespabase/desc.vespa_base1
-rw-r--r--vespabase/desc.vespa_base_dev7
-rwxr-xr-xvespabase/src/common-env.sh45
-rwxr-xr-xvespabase/src/rhel-prestart.sh79
-rwxr-xr-xvespabase/src/start-cbinaries.sh20
-rwxr-xr-xvespabase/src/start-tool.sh16
-rwxr-xr-xvespabase/src/start-vespa-base.sh16
-rwxr-xr-xvespabase/src/stop-vespa-base.sh16
-rw-r--r--vespabase/src/vespa-configserver.service.in1
-rwxr-xr-xvespabase/src/vespa-start-configserver.sh16
-rwxr-xr-xvespabase/src/vespa-start-services.sh16
-rwxr-xr-xvespabase/src/vespa-stop-configserver.sh16
-rwxr-xr-xvespabase/src/vespa-stop-services.sh16
-rw-r--r--vespabase/src/vespa.service.in1
-rw-r--r--vespabase/vespa-base.spec50
18 files changed, 282 insertions, 50 deletions
diff --git a/vespabase/CMakeLists.txt b/vespabase/CMakeLists.txt
index ea007b130f9..c3e5690d505 100644
--- a/vespabase/CMakeLists.txt
+++ b/vespabase/CMakeLists.txt
@@ -2,16 +2,16 @@
vespa_install_script(src/start-cbinaries.sh vespa-get-config bin)
vespa_install_script(src/start-cbinaries.sh vespa-verify-ranksetup bin)
vespa_install_script(src/start-cbinaries.sh vespa-config-status bin)
+vespa_install_script(src/start-cbinaries.sh vespa-configproxy-cmd bin)
vespa_install_script(src/start-cbinaries.sh vespa-doclocator bin)
vespa_install_script(src/start-cbinaries.sh vespa-model-inspect bin)
vespa_install_script(src/start-cbinaries.sh vespa-proton-cmd bin)
-vespa_install_script(src/start-cbinaries.sh vespa-query-profile-dump-tool bin)
+vespa_install_script(src/start-cbinaries.sh vespa-rpc-invoke bin)
+vespa_install_script(src/start-cbinaries.sh vespa-sentinel-cmd bin)
vespa_install_script(src/start-cbinaries.sh vespa-route bin)
vespa_install_script(src/start-cbinaries.sh vespa-transactionlog-inspect bin)
vespa_install_script(src/start-cbinaries.sh vespa-vds-disktool bin)
vespa_install_script(src/start-cbinaries.sh vespa-distributord sbin)
-vespa_install_script(src/start-cbinaries.sh vespa-dispatch sbin)
-vespa_install_script(src/start-cbinaries.sh vespa-filedistributor sbin)
vespa_install_script(src/start-cbinaries.sh vespa-proton sbin)
vespa_install_script(src/start-cbinaries.sh vespa-storaged sbin)
@@ -35,3 +35,6 @@ install(FILES src/Defaults.pm DESTINATION lib/perl5/site_perl/Yahoo/Vespa)
configure_file(conf/default-env.txt.in conf/default-env.txt @ONLY)
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/conf/default-env.txt DESTINATION conf/vespa)
+vespa_install_empty_tmp_dir(logs/vespa)
+vespa_install_empty_tmp_dir(tmp/vespa)
+install(DIRECTORY DESTINATION var/db/vespa)
diff --git a/vespabase/README b/vespabase/README
index c74c1ce385f..da27a4144ff 100644
--- a/vespabase/README
+++ b/vespabase/README
@@ -1,2 +1 @@
-This CVS module will hold some vespa-base related stuff,
-such as monitoring and startup scripts.
+This module holds some vespa-base related stuff, such as startup scripts.
diff --git a/vespabase/conf/default-env.txt.in b/vespabase/conf/default-env.txt.in
index 38a4d0cded5..374bbd020dd 100644
--- a/vespabase/conf/default-env.txt.in
+++ b/vespabase/conf/default-env.txt.in
@@ -1,4 +1,4 @@
# Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
fallback VESPA_HOME @CMAKE_INSTALL_PREFIX@
-override VESPA_USER vespa
-override cloudconfig_server__disable_filedistributor true
+override VESPA_USER @VESPA_USER@
+override VESPA_UNPRIVILEGED @VESPA_UNPRIVILEGED@
diff --git a/vespabase/desc.vespa_base b/vespabase/desc.vespa_base
index 977ce987121..965fdaffdbb 100644
--- a/vespabase/desc.vespa_base
+++ b/vespabase/desc.vespa_base
@@ -6,7 +6,6 @@ common runtime Vespa components.
Runtime libraries for c++ and java:
* vespa_gcc3 vespa_gcc_runtime: C++ runtime
- * vespa_boost: Boost shared libraries for runtime use
* libiconv: Iconv shared library.
General utilities:
diff --git a/vespabase/desc.vespa_base_dev b/vespabase/desc.vespa_base_dev
index 908a76e50f3..1f05be94257 100644
--- a/vespabase/desc.vespa_base_dev
+++ b/vespabase/desc.vespa_base_dev
@@ -31,10 +31,5 @@ Generic libraries:
Development tools and 3rd party libraries:
- * vespa_gcc3 and vespa_gcc3_compiler: GCC 3 compiler and adapted
- LinuxThreads library. This is the compiler to use for developing
- Vespa components using these developer libraries.
- * vespa_boost and vespa_boost_dev: Boost libraries and headers,
+ * vespa_boost_dev: Boost headers,
prepared for use with the Vespa compiler.
- * vespa_cppunit_dev: Headers and libraries prepared with the
- Vespa compiler.
diff --git a/vespabase/src/common-env.sh b/vespabase/src/common-env.sh
index 4b43465c75c..793fa6782f6 100755
--- a/vespabase/src/common-env.sh
+++ b/vespabase/src/common-env.sh
@@ -23,7 +23,7 @@ consider_fallback () {
: $1 already has value $oldvariablevalue
elif [ -z "${2}" ]; then
: proposed value "${2}" is empty
- elif [ `expr match "$2" ".*'"` != 0 ]; then
+ elif [ `expr "$2" : ".*'"` != 0 ]; then
: proposed value "${2}" contains a single-quote
else
eval "${1}='${2}'"
@@ -107,27 +107,49 @@ populate_environment () {
fi
}
+prepend_path () {
+ case ":$PATH:" in
+ *:"$1":*) ;;
+ *) PATH="$1:$PATH" ;;
+ esac
+}
+
+add_valgrind_suppressions_file() {
+ if [ -f "$1" ]
+ then
+ VESPA_VALGRIND_SUPPREESSIONS_OPT="$VESPA_VALGRIND_SUPPREESSIONS_OPT --suppressions=$1"
+ fi
+}
+
populate_environment
-PATH=$VESPA_HOME/bin64:$VESPA_HOME/bin:/usr/local/bin:/usr/X11R6/bin:/sbin:/bin:/usr/sbin:/usr/bin
export LD_LIBRARY_PATH=$VESPA_HOME/lib64
export MALLOC_ARENA_MAX=1
export GLIBC_TUNABLES=glibc.elision.enable=1
export RHEL_GLIBC_TUNABLES=glibc.elision.enable=1
+# Maven is needed for tester applications
+prepend_path "$VESPA_HOME/local/maven/bin"
+prepend_path "$VESPA_HOME/bin64"
+prepend_path "$VESPA_HOME/bin"
+
# how to find the "java" program?
# should be available in $VESPA_HOME/bin or JAVA_HOME
if [ "$JAVA_HOME" ] && [ -f "${JAVA_HOME}/bin/java" ]; then
- PATH="${PATH}:${JAVA_HOME}/bin"
+ prepend_path "${JAVA_HOME}/bin"
fi
+VESPA_VALGRIND_SUPPREESSIONS_OPT=""
+add_valgrind_suppressions_file ${VESPA_HOME}/etc/vespa/valgrind-suppressions.txt
+add_valgrind_suppressions_file ${VESPA_HOME}/etc/vespa/suppressions.txt
+
consider_fallback VESPA_VALGRIND_OPT "--num-callers=32 \
--run-libc-freeres=yes \
--track-origins=yes \
--freelist-vol=1000000000 \
--leak-check=full \
--show-reachable=yes \
---suppressions=${VESPA_HOME}/etc/vespa/suppressions.txt"
+${VESPA_VALGRIND_SUPPREESSIONS_OPT}"
consider_fallback VESPA_USE_HUGEPAGES_LIST $(get_var "hugepages_list")
consider_fallback VESPA_USE_HUGEPAGES_LIST "all"
@@ -147,6 +169,10 @@ consider_fallback VESPA_USE_NO_VESPAMALLOC $(get_var "no_vespamalloc_list")
fixlimits () {
+ # Cannot bump limits when not root (for testing)
+ if [ "${VESPA_UNPRIVILEGED}" = yes ]; then
+ return 0
+ fi
# number of open files:
if varhasvalue file_descriptor_limit; then
ulimit -n ${file_descriptor_limit} || exit 1
@@ -216,7 +242,14 @@ drop_caches () {
no_transparent_hugepages () {
# Should probably also be done on host.
- dn=/sys/kernel/mm/redhat_transparent_hugepage
+ if grep -q "release 6" /etc/redhat-release; then
+ dn=/sys/kernel/mm/redhat_transparent_hugepage
+ khugepaged_defrag=yes
+ else
+ dn=/sys/kernel/mm/transparent_hugepage
+ khugepaged_defrag=1
+ fi
+
if [ -w $dn/enabled ]; then
echo always > $dn/enabled
fi
@@ -224,7 +257,7 @@ no_transparent_hugepages () {
echo never > $dn/defrag
fi
if [ -w $dn/khugepaged/defrag ]; then
- echo yes > $dn/khugepaged/defrag
+ echo $khugepaged_defrag > $dn/khugepaged/defrag
fi
}
diff --git a/vespabase/src/rhel-prestart.sh b/vespabase/src/rhel-prestart.sh
index fa7b9a1fe49..d84122898a3 100755
--- a/vespabase/src/rhel-prestart.sh
+++ b/vespabase/src/rhel-prestart.sh
@@ -8,6 +8,10 @@ findpath () {
myname=${0}
mypath=${myname%/*}
myname=${myname##*/}
+ empty_if_start_slash=${mypath%%/*}
+ if [ "${empty_if_start_slash}" ]; then
+ mypath=$(pwd)/${mypath}
+ fi
if [ "$mypath" ] && [ -d "$mypath" ]; then
return
fi
@@ -54,7 +58,19 @@ findroot () {
exit 1
}
+findhost () {
+ if [ "${VESPA_HOSTNAME}" = "" ]; then
+ VESPA_HOSTNAME=$(vespa-detect-hostname || hostname -f || hostname || echo "localhost") || exit 1
+ fi
+ validate="${VESPA_HOME}/bin/vespa-validate-hostname"
+ if [ -f "$validate" ]; then
+ "$validate" "${VESPA_HOSTNAME}" || exit 1
+ fi
+ export VESPA_HOSTNAME
+}
+
findroot
+findhost
# END environment bootstrap section
@@ -71,39 +87,46 @@ fixdir () {
exit 1
fi
mkdir -p "$4"
- chown $1 "$4"
- chgrp $2 "$4"
+ if [ "${VESPA_UNPRIVILEGED}" != yes ]; then
+ chown $1 "$4"
+ chgrp $2 "$4"
+ fi
chmod $3 "$4"
}
# BEGIN directory fixups
-fixdir root wheel 1777 logs
-fixdir root wheel 1777 tmp
-fixdir root wheel 1777 var/run
-fixdir ${VESPA_USER} wheel 1777 var/crash
-fixdir ${VESPA_USER} wheel 1777 logs/vespa
-fixdir ${VESPA_USER} wheel 1777 tmp/vespa
-fixdir ${VESPA_USER} wheel 755 var
-fixdir ${VESPA_USER} wheel 755 libexec/vespa/plugins/qrs
-fixdir ${VESPA_USER} wheel 755 logs/vespa/configserver
-fixdir ${VESPA_USER} wheel 755 logs/vespa/qrs
-fixdir ${VESPA_USER} wheel 755 logs/vespa/search
-fixdir ${VESPA_USER} wheel 755 var/db/vespa
-fixdir ${VESPA_USER} wheel 755 var/db/vespa/tmp
-fixdir ${VESPA_USER} wheel 755 var/db/vespa/config_server
-fixdir ${VESPA_USER} wheel 755 var/db/vespa/config_server/serverdb
-fixdir ${VESPA_USER} wheel 755 var/db/vespa/config_server/serverdb/tenants
-fixdir ${VESPA_USER} wheel 755 var/db/vespa/index
-fixdir ${VESPA_USER} wheel 755 var/db/vespa/logcontrol
-fixdir ${VESPA_USER} wheel 755 var/db/vespa/search
-fixdir ${VESPA_USER} wheel 755 var/jdisc_core
-fixdir ${VESPA_USER} wheel 755 var/vespa/bundlecache
-fixdir ${VESPA_USER} wheel 755 var/vespa/bundlecache/configserver
-fixdir ${VESPA_USER} wheel 755 var/vespa/cache/config/
-
-chown -hR ${VESPA_USER} logs/vespa
-chown -hR ${VESPA_USER} var/db/vespa
+fixdir root root 1777 logs
+fixdir root root 1777 tmp
+fixdir root root 1777 var/run
+fixdir ${VESPA_USER} root 1777 var/crash
+fixdir ${VESPA_USER} root 1777 logs/vespa
+fixdir ${VESPA_USER} root 1777 tmp/vespa
+fixdir root root 755 var
+fixdir ${VESPA_USER} root 755 libexec/vespa/plugins/qrs
+fixdir ${VESPA_USER} root 755 logs/vespa/configserver
+fixdir ${VESPA_USER} root 755 logs/vespa/qrs
+fixdir ${VESPA_USER} root 755 logs/vespa/search
+fixdir ${VESPA_USER} root 755 var/db/vespa
+fixdir ${VESPA_USER} root 755 var/db/vespa/tmp
+fixdir ${VESPA_USER} root 755 var/db/vespa/config_server
+fixdir ${VESPA_USER} root 755 var/db/vespa/config_server/serverdb
+fixdir ${VESPA_USER} root 755 var/db/vespa/config_server/serverdb/tenants
+fixdir ${VESPA_USER} root 755 var/db/vespa/filedistribution
+fixdir ${VESPA_USER} root 755 var/db/vespa/index
+fixdir ${VESPA_USER} root 755 var/db/vespa/logcontrol
+fixdir ${VESPA_USER} root 755 var/db/vespa/search
+fixdir ${VESPA_USER} root 755 var/jdisc_container
+fixdir ${VESPA_USER} root 755 var/vespa
+fixdir ${VESPA_USER} root 755 var/vespa/application
+fixdir ${VESPA_USER} root 755 var/vespa/bundlecache
+fixdir ${VESPA_USER} root 755 var/vespa/bundlecache/configserver
+fixdir ${VESPA_USER} root 755 var/vespa/cache/config/
+
+if [ "${VESPA_UNPRIVILEGED}" != yes ]; then
+ chown -hR ${VESPA_USER} logs/vespa
+ chown -hR ${VESPA_USER} var/db/vespa
+fi
# END directory fixups
diff --git a/vespabase/src/start-cbinaries.sh b/vespabase/src/start-cbinaries.sh
index 341bce0e192..f17829aa081 100755
--- a/vespabase/src/start-cbinaries.sh
+++ b/vespabase/src/start-cbinaries.sh
@@ -1,4 +1,4 @@
-#!/bin/sh
+#!/bin/bash
# Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
# BEGIN environment bootstrap section
@@ -8,6 +8,10 @@ findpath () {
myname=${0}
mypath=${myname%/*}
myname=${myname##*/}
+ empty_if_start_slash=${mypath%%/*}
+ if [ "${empty_if_start_slash}" ]; then
+ mypath=$(pwd)/${mypath}
+ fi
if [ "$mypath" ] && [ -d "$mypath" ]; then
return
fi
@@ -54,7 +58,19 @@ findroot () {
exit 1
}
+findhost () {
+ if [ "${VESPA_HOSTNAME}" = "" ]; then
+ VESPA_HOSTNAME=$(vespa-detect-hostname || hostname -f || hostname || echo "localhost") || exit 1
+ fi
+ validate="${VESPA_HOME}/bin/vespa-validate-hostname"
+ if [ -f "$validate" ]; then
+ "$validate" "${VESPA_HOSTNAME}" || exit 1
+ fi
+ export VESPA_HOSTNAME
+}
+
findroot
+findhost
# END environment bootstrap section
@@ -80,7 +96,7 @@ check_bname_in_value () {
configure_valgrind () {
no_valgrind=true
- if which valgrind >/dev/null; then
+ if which valgrind >/dev/null 2>&1; then
if check_bname_in_value $VESPA_USE_VALGRIND; then
no_valgrind=false
valgrind_log=$VESPA_HOME/tmp/valgrind.$bname.log.$$
diff --git a/vespabase/src/start-tool.sh b/vespabase/src/start-tool.sh
index 4a2ddbb61cf..b3811939ad7 100755
--- a/vespabase/src/start-tool.sh
+++ b/vespabase/src/start-tool.sh
@@ -8,6 +8,10 @@ findpath () {
myname=${0}
mypath=${myname%/*}
myname=${myname##*/}
+ empty_if_start_slash=${mypath%%/*}
+ if [ "${empty_if_start_slash}" ]; then
+ mypath=$(pwd)/${mypath}
+ fi
if [ "$mypath" ] && [ -d "$mypath" ]; then
return
fi
@@ -54,7 +58,19 @@ findroot () {
exit 1
}
+findhost () {
+ if [ "${VESPA_HOSTNAME}" = "" ]; then
+ VESPA_HOSTNAME=$(vespa-detect-hostname || hostname -f || hostname || echo "localhost") || exit 1
+ fi
+ validate="${VESPA_HOME}/bin/vespa-validate-hostname"
+ if [ -f "$validate" ]; then
+ "$validate" "${VESPA_HOSTNAME}" || exit 1
+ fi
+ export VESPA_HOSTNAME
+}
+
findroot
+findhost
# END environment bootstrap section
diff --git a/vespabase/src/start-vespa-base.sh b/vespabase/src/start-vespa-base.sh
index 096c63f9969..fdda5f85198 100755
--- a/vespabase/src/start-vespa-base.sh
+++ b/vespabase/src/start-vespa-base.sh
@@ -8,6 +8,10 @@ findpath () {
myname=${0}
mypath=${myname%/*}
myname=${myname##*/}
+ empty_if_start_slash=${mypath%%/*}
+ if [ "${empty_if_start_slash}" ]; then
+ mypath=$(pwd)/${mypath}
+ fi
if [ "$mypath" ] && [ -d "$mypath" ]; then
return
fi
@@ -54,7 +58,19 @@ findroot () {
exit 1
}
+findhost () {
+ if [ "${VESPA_HOSTNAME}" = "" ]; then
+ VESPA_HOSTNAME=$(vespa-detect-hostname || hostname -f || hostname || echo "localhost") || exit 1
+ fi
+ validate="${VESPA_HOME}/bin/vespa-validate-hostname"
+ if [ -f "$validate" ]; then
+ "$validate" "${VESPA_HOSTNAME}" || exit 1
+ fi
+ export VESPA_HOSTNAME
+}
+
findroot
+findhost
# END environment bootstrap section
diff --git a/vespabase/src/stop-vespa-base.sh b/vespabase/src/stop-vespa-base.sh
index dde1cb880b0..f30faad65ee 100755
--- a/vespabase/src/stop-vespa-base.sh
+++ b/vespabase/src/stop-vespa-base.sh
@@ -8,6 +8,10 @@ findpath () {
myname=${0}
mypath=${myname%/*}
myname=${myname##*/}
+ empty_if_start_slash=${mypath%%/*}
+ if [ "${empty_if_start_slash}" ]; then
+ mypath=$(pwd)/${mypath}
+ fi
if [ "$mypath" ] && [ -d "$mypath" ]; then
return
fi
@@ -54,7 +58,19 @@ findroot () {
exit 1
}
+findhost () {
+ if [ "${VESPA_HOSTNAME}" = "" ]; then
+ VESPA_HOSTNAME=$(vespa-detect-hostname || hostname -f || hostname || echo "localhost") || exit 1
+ fi
+ validate="${VESPA_HOME}/bin/vespa-validate-hostname"
+ if [ -f "$validate" ]; then
+ "$validate" "${VESPA_HOSTNAME}" || exit 1
+ fi
+ export VESPA_HOSTNAME
+}
+
findroot
+findhost
# END environment bootstrap section
diff --git a/vespabase/src/vespa-configserver.service.in b/vespabase/src/vespa-configserver.service.in
index b5bf28c1d73..7ee170bbdca 100644
--- a/vespabase/src/vespa-configserver.service.in
+++ b/vespabase/src/vespa-configserver.service.in
@@ -1,6 +1,7 @@
# Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
[Unit]
Description=Vertical Search Platform Config Server
+After=network.target
[Service]
Type=forking
diff --git a/vespabase/src/vespa-start-configserver.sh b/vespabase/src/vespa-start-configserver.sh
index 38a4249982e..d6f401ad5d0 100755
--- a/vespabase/src/vespa-start-configserver.sh
+++ b/vespabase/src/vespa-start-configserver.sh
@@ -8,6 +8,10 @@ findpath () {
myname=${0}
mypath=${myname%/*}
myname=${myname##*/}
+ empty_if_start_slash=${mypath%%/*}
+ if [ "${empty_if_start_slash}" ]; then
+ mypath=$(pwd)/${mypath}
+ fi
if [ "$mypath" ] && [ -d "$mypath" ]; then
return
fi
@@ -54,7 +58,19 @@ findroot () {
exit 1
}
+findhost () {
+ if [ "${VESPA_HOSTNAME}" = "" ]; then
+ VESPA_HOSTNAME=$(vespa-detect-hostname || hostname -f || hostname || echo "localhost") || exit 1
+ fi
+ validate="${VESPA_HOME}/bin/vespa-validate-hostname"
+ if [ -f "$validate" ]; then
+ "$validate" "${VESPA_HOSTNAME}" || exit 1
+ fi
+ export VESPA_HOSTNAME
+}
+
findroot
+findhost
# END environment bootstrap section
diff --git a/vespabase/src/vespa-start-services.sh b/vespabase/src/vespa-start-services.sh
index fbc110dbdee..42a98511258 100755
--- a/vespabase/src/vespa-start-services.sh
+++ b/vespabase/src/vespa-start-services.sh
@@ -8,6 +8,10 @@ findpath () {
myname=${0}
mypath=${myname%/*}
myname=${myname##*/}
+ empty_if_start_slash=${mypath%%/*}
+ if [ "${empty_if_start_slash}" ]; then
+ mypath=$(pwd)/${mypath}
+ fi
if [ "$mypath" ] && [ -d "$mypath" ]; then
return
fi
@@ -54,7 +58,19 @@ findroot () {
exit 1
}
+findhost () {
+ if [ "${VESPA_HOSTNAME}" = "" ]; then
+ VESPA_HOSTNAME=$(vespa-detect-hostname || hostname -f || hostname || echo "localhost") || exit 1
+ fi
+ validate="${VESPA_HOME}/bin/vespa-validate-hostname"
+ if [ -f "$validate" ]; then
+ "$validate" "${VESPA_HOSTNAME}" || exit 1
+ fi
+ export VESPA_HOSTNAME
+}
+
findroot
+findhost
# END environment bootstrap section
diff --git a/vespabase/src/vespa-stop-configserver.sh b/vespabase/src/vespa-stop-configserver.sh
index 33532744ae3..116c1f14617 100755
--- a/vespabase/src/vespa-stop-configserver.sh
+++ b/vespabase/src/vespa-stop-configserver.sh
@@ -8,6 +8,10 @@ findpath () {
myname=${0}
mypath=${myname%/*}
myname=${myname##*/}
+ empty_if_start_slash=${mypath%%/*}
+ if [ "${empty_if_start_slash}" ]; then
+ mypath=$(pwd)/${mypath}
+ fi
if [ "$mypath" ] && [ -d "$mypath" ]; then
return
fi
@@ -54,7 +58,19 @@ findroot () {
exit 1
}
+findhost () {
+ if [ "${VESPA_HOSTNAME}" = "" ]; then
+ VESPA_HOSTNAME=$(vespa-detect-hostname || hostname -f || hostname || echo "localhost") || exit 1
+ fi
+ validate="${VESPA_HOME}/bin/vespa-validate-hostname"
+ if [ -f "$validate" ]; then
+ "$validate" "${VESPA_HOSTNAME}" || exit 1
+ fi
+ export VESPA_HOSTNAME
+}
+
findroot
+findhost
# END environment bootstrap section
diff --git a/vespabase/src/vespa-stop-services.sh b/vespabase/src/vespa-stop-services.sh
index 8d519a5fa9e..441717c2a71 100755
--- a/vespabase/src/vespa-stop-services.sh
+++ b/vespabase/src/vespa-stop-services.sh
@@ -8,6 +8,10 @@ findpath () {
myname=${0}
mypath=${myname%/*}
myname=${myname##*/}
+ empty_if_start_slash=${mypath%%/*}
+ if [ "${empty_if_start_slash}" ]; then
+ mypath=$(pwd)/${mypath}
+ fi
if [ "$mypath" ] && [ -d "$mypath" ]; then
return
fi
@@ -54,7 +58,19 @@ findroot () {
exit 1
}
+findhost () {
+ if [ "${VESPA_HOSTNAME}" = "" ]; then
+ VESPA_HOSTNAME=$(vespa-detect-hostname || hostname -f || hostname || echo "localhost") || exit 1
+ fi
+ validate="${VESPA_HOME}/bin/vespa-validate-hostname"
+ if [ -f "$validate" ]; then
+ "$validate" "${VESPA_HOSTNAME}" || exit 1
+ fi
+ export VESPA_HOSTNAME
+}
+
findroot
+findhost
# END environment bootstrap section
diff --git a/vespabase/src/vespa.service.in b/vespabase/src/vespa.service.in
index dec88ecb7cc..3c32f2c2cab 100644
--- a/vespabase/src/vespa.service.in
+++ b/vespabase/src/vespa.service.in
@@ -1,6 +1,7 @@
# Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
[Unit]
Description=Vertical Search Platform
+After=network.target
[Service]
Type=forking
diff --git a/vespabase/vespa-base.spec b/vespabase/vespa-base.spec
new file mode 100644
index 00000000000..e385d0b7367
--- /dev/null
+++ b/vespabase/vespa-base.spec
@@ -0,0 +1,50 @@
+# Copyright 2018 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
+
+# Force special prefix for Vespa
+%define _prefix /opt/vespa
+
+Name: vespa-base
+Version: %version
+Release: 1%{?dist}
+BuildArch: x86_64
+Summary: Vespa common files
+Group: Applications/Databases
+License: Commercial
+URL: http://vespa.ai
+
+Requires: bash
+
+Conflicts: vespa
+
+%description
+Common files for Vespa RPMs
+
+%install
+lev_dir=%?buildroot%_prefix/libexec/vespa
+mkdir -p "$lev_dir"
+cp vespabase/src/common-env.sh "${lev_dir}"
+chmod 444 "${lev_dir}/common-env.sh"
+
+%clean
+rm -rf %buildroot
+
+%pre
+getent group vespa >/dev/null || groupadd -r vespa
+getent passwd vespa >/dev/null || \
+ useradd -r -g vespa -d %{_prefix} -s /sbin/nologin \
+ -c "Create owner of all Vespa data files" vespa
+echo "pathmunge %{_prefix}/bin" > /etc/profile.d/vespa.sh
+echo "export VESPA_HOME=%{_prefix}" >> /etc/profile.d/vespa.sh
+chmod +x /etc/profile.d/vespa.sh
+exit 0
+
+%postun
+if [ $1 -eq 0 ]; then # this is an uninstallation
+ rm -f /etc/profile.d/vespa.sh
+ ! getent passwd vespa >/dev/null || userdel vespa
+ ! getent group vespa >/dev/null || groupdel vespa
+fi
+
+%files
+%defattr(-,vespa,vespa,-)
+%_prefix/*