From 1190f03e67b31fe3540d60a20ac1d74db0836fe4 Mon Sep 17 00:00:00 2001 From: Dmitry Simonenko <pmwkaa@gmail.com> Date: Sat, 28 Apr 2012 15:06:22 +0400 Subject: [PATCH] rpm-adapt: centos rpm instance deployment setup fixes --- extra/tarantool_box | 9 ++++---- extra/tarantool_expand.sh | 10 ++++----- extra/tarantool_multi.sh | 7 +++--- test/CMakeLists.txt | 29 +++++++++++++------------ test/share/tarantool_rpm.cfg | 42 ++++++++++++++++++++++++++++++++++++ 5 files changed, 71 insertions(+), 26 deletions(-) create mode 100644 test/share/tarantool_rpm.cfg diff --git a/extra/tarantool_box b/extra/tarantool_box index a96491d5e5..ec8dd3a9d0 100755 --- a/extra/tarantool_box +++ b/extra/tarantool_box @@ -10,8 +10,9 @@ RETVAL=0 INST="$(basename $0)" -export PIDFILE="/var/${INST}/pid" -export WRAP_PIDFILE="/var/${INST}/wrapper.pid" +ENV=`echo ${INST} | sed -e 's/tarantool_box/tarantool/'` +export PIDFILE="/var/${ENV}/box.pid" +export WRAP_PIDFILE="/var/${ENV}/wrapper.pid" export OPTIONS="" # This script is normally invoked via a symlink. @@ -30,7 +31,7 @@ fi start() { echo -n $"Starting ${INST}: " - /usr/local/bin/${INST}.sh ${OPTIONS} >> /var/${INST}/logs/init.log 2>&1 + /usr/local/bin/${INST}.sh ${OPTIONS} >> /var/${ENV}/logs/init.log 2>&1 RETVAL=${?} if [ ${RETVAL} -eq 0 ] then @@ -76,7 +77,7 @@ case "$1" in restart ;; *) - echo $"Usage: $0 {start|stop}" + echo $"Usage: $0 {start|stop|restart}" RETVAL=1 esac diff --git a/extra/tarantool_expand.sh b/extra/tarantool_expand.sh index 255f8e146e..e14b0540eb 100755 --- a/extra/tarantool_expand.sh +++ b/extra/tarantool_expand.sh @@ -91,9 +91,9 @@ rollback() { try() { cmd="$*" - [ $act_debug -gt 0 ] && log $cmd + [ $act_debug -gt 0 ] && log "$cmd" if [ $act_dry -eq 0 ]; then - eval $cmd + eval "$cmd" if [ $? -gt 0 ]; then rollback fi @@ -116,9 +116,9 @@ deploy_instance() { # setting up configuration file try "cp \"${prefix}/etc/tarantool.cfg\" $config" - try "echo \"work_dir = \"$workdir\"\" >> $config" - try "echo \"username = \"tarantool\"\" >> $config" - try "echo \"logger = \"cat - \>\> logs/tarantool.log\"\" >> $config" + try 'echo work_dir = \"$workdir\" >> $config' + try 'echo username = \"tarantool\" >> $config' + try 'echo logger = \"cat - \>\> logs/tarantool.log\" >> $config' # setting up wrapper try "ln -s \"${prefix}/bin/tarantool_multi.sh\" \"${prefix}/bin/tarantool_box$id.sh\"" diff --git a/extra/tarantool_multi.sh b/extra/tarantool_multi.sh index e394842735..b2212e1729 100755 --- a/extra/tarantool_multi.sh +++ b/extra/tarantool_multi.sh @@ -5,9 +5,10 @@ export PATH=$PATH:/usr/local/bin NAME="tarantool_box" BINARY="/usr/local/bin/${NAME}" INST=$(basename $0 .sh) -CONF="/usr/local/etc/${INST}.cfg" -LOGDIR="/var/${INST}/logs" -WRAP_PIDFILE="/var/${INST}/wrapper.pid" +ENV=`echo ${INST} | sed -e 's/tarantool_box/tarantool/'` +CONF="/usr/local/etc/${ENV}.cfg" +LOGDIR="/var/${ENV}/logs" +WRAP_PIDFILE="/var/${ENV}/wrapper.pid" exec <&- diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 1e0016d3ba..ad52105be4 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -8,20 +8,21 @@ add_subdirectory(box) add_subdirectory(connector_c) if ("${CPACK_GENERATOR}" STREQUAL "RPM") - install (FILES ${CMAKE_SOURCE_DIR}/test/share/tarantool.cfg - DESTINATION etc) - install (FILES ${CMAKE_SOURCE_DIR}/test/box/00000000000000000001.snap - DESTINATION share/tarantool) + install (FILES ${CMAKE_SOURCE_DIR}/test/share/tarantool_rpm.cfg + DESTINATION etc + RENAME "tarantool.cfg") + install (FILES ${CMAKE_SOURCE_DIR}/test/box/00000000000000000001.snap + DESTINATION share/tarantool) else() - if (NOT CPACK_GENERATOR OR "${CPACK_GENERATOR}" STREQUAL "TGZ") - install (FILES ${CMAKE_SOURCE_DIR}/test/share/tarantool_tgz.cfg - DESTINATION "${CMAKE_SYSCONF_DIR}" - RENAME "tarantool.cfg") - else() - install (FILES ${CMAKE_SOURCE_DIR}/test/share/tarantool.cfg - DESTINATION "${CMAKE_SYSCONF_DIR}") - endif() + if (NOT CPACK_GENERATOR OR "${CPACK_GENERATOR}" STREQUAL "TGZ") + install (FILES ${CMAKE_SOURCE_DIR}/test/share/tarantool_tgz.cfg + DESTINATION "${CMAKE_SYSCONF_DIR}" + RENAME "tarantool.cfg") + else() + install (FILES ${CMAKE_SOURCE_DIR}/test/share/tarantool.cfg + DESTINATION "${CMAKE_SYSCONF_DIR}") + endif() - install (FILES ${CMAKE_SOURCE_DIR}/test/box/00000000000000000001.snap - DESTINATION "${CMAKE_LOCALSTATE_DIR}/lib/tarantool") + install (FILES ${CMAKE_SOURCE_DIR}/test/box/00000000000000000001.snap + DESTINATION "${CMAKE_LOCALSTATE_DIR}/lib/tarantool") endif() diff --git a/test/share/tarantool_rpm.cfg b/test/share/tarantool_rpm.cfg new file mode 100644 index 0000000000..16d65fd0d0 --- /dev/null +++ b/test/share/tarantool_rpm.cfg @@ -0,0 +1,42 @@ +# +# Limit of memory used to store tuples to 100MB +# (0.1 GB) +# This effectively limits the memory, used by +# Tarantool. However, index and connection memory +# is stored outside the slab allocator, hence +# the effective memory usage can be higher (sometimes +# twice as high). +slab_alloc_arena = 0.1 + +# +# Store the pid in this file. Relative to +# startup dir. +# (Should not be changed in rpm deployment) +pid_file = "box.pid" + +# +# Read only and read-write port. +primary_port = 33013 + +# +# Read-only port. +secondary_port = 33014 + +# +# The port for administrative commands. +admin_port = 33015 + +# +# Each write ahead log contains this many rows. +# When the limit is reached, Tarantool closes +# the WAL and starts a new one. +rows_per_wal = 50000 + +# +# Define a simple space with 1 HASH-based +# primary key. +space[0].enabled = 1 +space[0].index[0].type = "HASH" +space[0].index[0].unique = 1 +space[0].index[0].key_field[0].fieldno = 0 +space[0].index[0].key_field[0].type = "NUM" -- GitLab