1
0
Fork 0

systemd integration for the .deb's; setting environment variables for the libc allocator

This commit is contained in:
Wilfried Goesgens 2017-06-06 17:35:17 +02:00
parent ec6452733e
commit f487d7095f
6 changed files with 77 additions and 33 deletions

View File

@ -24,7 +24,7 @@ parts:
apps:
arangod:
command: arangod \
command: GLIBCXX_FORCE_NEW=1 arangod \
--configuration=none \
--server.endpoint=tcp://0.0.0.0:@SNAP_PORT@ \
--javascript.startup-directory=${SNAP}/@CMAKE_INSTALL_DATAROOTDIR_ARANGO@/js \

View File

@ -5,9 +5,10 @@ ARANGODB="/usr/sbin/arangod"
# source debconf library
. /usr/share/debconf/confmodule
set +x
db_get @CPACK_PACKAGE_NAME@/storage_engine
STORAGE_ENGINE=$RET
export GLIBCXX_FORCE_NEW=1
sed -i /etc/arangodb3/arangod.conf -e "s;storage-engine = auto;storage-engine = $STORAGE_ENGINE;"
if [ "$1" = "configure" -a -z "$2" ]; then
@ -15,7 +16,7 @@ if [ "$1" = "configure" -a -z "$2" ]; then
# Escape backslashes and quotes
if [ -n "$RET" ]; then
ARANGODB_DEFAULT_ROOT_PASSWORD=`echo $RET|sed -e 's;\\\\;\\\\\\\\;g' -e 's;";\\\\";g'` \
ARANGODB_DEFAULT_ROOT_PASSWORD=`echo "${RET}"|sed -e 's;\\\\;\\\\\\\\;g' -e 's;";\\\\";g'` \
/usr/sbin/arango-init-database \
--server.rest-server false --server.statistics false --foxx.queues false \
--uid arangodb --gid arangodb || true
@ -59,12 +60,31 @@ fi
db_stop
# Automatically added by dh_installinit
if [ -x "/etc/init.d/arangodb3" ]; then
if test "@CPACK_SYSTEMD_FOUND@" -eq 1 ; then
# This will only remove masks created by d-s-h on package removal.
deb-systemd-helper unmask arangodb3.service >/dev/null || true
# was-enabled defaults to true, so new installations run enable.
if deb-systemd-helper --quiet was-enabled arangodb3.service; then
# Enables the unit on first installation, creates new
# symlinks on upgrades if the unit file has changed.
deb-systemd-helper enable arangodb3.service >/dev/null || true
else
# Update the statefile to add new symlinks (if any), which need to be
# cleaned up on purge. Also remove old symlinks.
deb-systemd-helper update-state arangodb3.service >/dev/null || true
fi
# Automatically added by dh_systemd_start
if [ -d /run/systemd/system ]; then
systemctl --system daemon-reload >/dev/null || true
deb-systemd-invoke start arangodb3.service >/dev/null || true
fi
# End automatically added section
else
# Automatically added by dh_installinit
if [ -x "/etc/init.d/arangodb3" ]; then
update-rc.d arangodb3 defaults >/dev/null
invoke-rc.d arangodb3 start || exit $?
fi
# End automatically added section
fi
# End automatically added section
exit 0

View File

@ -7,12 +7,27 @@ if [ "$1" = "purge" ] ; then
fi
# In case this system is running systemd, we make systemd reload the unit files
# to pick up changes.
if [ -d /run/systemd/system ] ; then
systemctl --system daemon-reload >/dev/null || true
fi
# End automatically added section
# Automatically added by dh_systemd_enable
if [ "$1" = "remove" ]; then
if [ -x "/usr/bin/deb-systemd-helper" ]; then
deb-systemd-helper mask arangodb3.service >/dev/null
fi
fi
if [ "$1" = "purge" ]; then
if [ -x "/usr/bin/deb-systemd-helper" ]; then
deb-systemd-helper purge arangodb3.service >/dev/null
deb-systemd-helper unmask arangodb3.service >/dev/null
fi
fi
# End automatically added section
# Automatically added by dh_installdebconf
if [ "$1" = purge ] && [ -e /usr/share/debconf/confmodule ]; then
. /usr/share/debconf/confmodule
@ -20,7 +35,6 @@ if [ "$1" = purge ] && [ -e /usr/share/debconf/confmodule ]; then
fi
# End automatically added section
rm -rf /usr/share/arangodb3/js.old
if [ purge = "$1" ]; then

View File

@ -7,3 +7,9 @@ if [ -x "/etc/init.d/arangodb3" ]; then
fi
# End automatically added section
set -e
# Automatically added by dh_systemd_start
if [ -d /run/systemd/system ] && [ "$1" = remove ]; then
deb-systemd-invoke stop arangodb3.service >/dev/null
fi
# End automatically added section

View File

@ -20,6 +20,7 @@ After=sysinit.target sockets.target timers.target paths.target slices.target net
Type=forking
LimitNOFILE=131072
PIDFile=/var/run/arangodb3/arangod.pid
Environment=GLIBCXX_FORCE_NEW=1
ExecStartPre=/usr/bin/install -g arangodb -o arangodb -d /var/tmp/arangodb3
ExecStartPre=/usr/bin/install -g arangodb -o arangodb -d /var/run/arangodb3
ExecStartPre=@CHOWN_EXECUTABLE@ -R arangodb:arangodb /var/log/arangodb3

View File

@ -18,6 +18,8 @@ set(CPACK_DEBIAN_PACKAGE_HOMEPAGE ${ARANGODB_URL_INFO_ABOUT})
set(CPACK_COMPONENTS_ALL debian-extras)
set(CPACK_GENERATOR "DEB")
set(CPACK_SYSTEMD_FOUND "${SYSTEMD_FOUND}")
# substitute the package name so debconf works:
configure_file (
"${PROJECT_SOURCE_DIR}/Installation/debian/templates.in"
@ -65,11 +67,12 @@ set(DH_CONFFILES_NAME "${PROJECT_BINARY_DIR}/conffiles")
FILE(WRITE ${DH_CONFFILES_NAME} "${conffiles_list}")
list(APPEND CPACK_DEBIAN_PACKAGE_CONTROL_EXTRA "${DH_CONFFILES_NAME}")
if (SYSTEMD_FOUND)
# deploy the Init script:
install(
FILES ${PROJECT_BINARY_DIR}/arangodb3.service
PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE
PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ
DESTINATION ${SYSTEMD_UNIT_DIR}/
RENAME ${SERVICE_NAME}.service
COMPONENT debian-extras