Skip to content

Commit

Permalink
Removes the systemd configurations of its own (#12)
Browse files Browse the repository at this point in the history
  • Loading branch information
Hirotaka Wakabayashi authored Feb 9, 2021
1 parent 1e32146 commit cff94b2
Show file tree
Hide file tree
Showing 17 changed files with 82 additions and 124 deletions.
2 changes: 1 addition & 1 deletion devcluster/api/local_api.json
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@
"allowcredauth": true,

"k2hdkc": {
"config": "/etc/k2hdkc/slave.ini",
"config": "/etc/antpickax/slave.ini",
"port": 8031
}
}
Expand Down
2 changes: 1 addition & 1 deletion devcluster/api/r3apijson.js
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ class R3apiJson {
},

k2hdkc: { // Slave configuration to K2HDKC cluster
config: '/etc/k2hdkc/slave.ini', // Configuration file path for k2hdkc(chmpx) slave
config: '/etc/antpickax/slave.ini', // Configuration file path for k2hdkc(chmpx) slave
port: '8031' // Control port number for k2hdkc(chmpx) slave
},

Expand Down
4 changes: 2 additions & 2 deletions devcluster/api/setup_api.sh
Original file line number Diff line number Diff line change
Expand Up @@ -229,10 +229,10 @@ fi
logger -t ${TAG} -p user.info "7. Installs the configured chmpx slave config file"

# Installs the configured chmpx slave config file in INI format to ${chmpx_conf_file}
install_chmpx_ini ${SRCDIR}/../chmpx/slave.ini ${chmpx_conf_file}
install_chmpx_conf ${SRCDIR}/../chmpx/slave.ini ${chmpx_conf_file}
RET=$?
if test "${RET}" -ne 0; then
logger -t ${TAG} -p user.err "install_chmpx_ini should return zero, not ${RET}"
logger -t ${TAG} -p user.err "install_chmpx_conf should return zero, not ${RET}"
exit 1
fi

Expand Down
2 changes: 1 addition & 1 deletion devcluster/api/setup_api_centos.ini
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ npm_global_dir=/home/k2hr3/.npm-global
#[package]
package_script_base_url=https://packagecloud.io/install/repositories/antpickax/stable
package_install_pkgs="nodejs k2htpdtor libfullock k2hash chmpx k2hdkc"
package_install_dev_pkgs="devtoolset-7 libfullock-devel k2hash-devel chmpx-devel k2hdkc-devel"
package_install_dev_pkgs="libfullock-devel k2hash-devel chmpx-devel k2hdkc-devel"
nodesource_url=https://rpm.nodesource.com/setup_10.x

#
Expand Down
4 changes: 2 additions & 2 deletions devcluster/api/setup_api_default.ini
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

#[chmpx]
chmpx_msg_max=1024
chmpx_conf_file=/etc/k2hdkc/slave.ini
chmpx_conf_file=/etc/antpickax/slave.ini
chmpx_systemd_unit_file=/etc/systemd/system/chmpx-slave.service
chmpx_server_name=localhost
k2hdkc_data_dir=/var/k2hdkc/data
Expand All @@ -42,7 +42,7 @@ k2hr3_api_k2hr3admin_tenant=demo
k2hr3_api_k2hr3admin_delhostrole=delhostrole
k2hr3_api_confirmtenant=false
k2hr3_api_allowcredauth=true
k2hr3_api_k2hdkc_config="/etc/k2hdkc/slave.ini"
k2hr3_api_k2hdkc_config="/etc/antpickax/slave.ini"
k2hr3_api_k2hdkc_port=8031

# [node]
Expand Down
2 changes: 1 addition & 1 deletion devcluster/api/setup_api_node_module.sh
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ fi
#

# Check if a compiler exists in PATH
if test "${OS_NAME}" = "centos"; then
if test "${OS_NAME}" = "centos" -a "${OS_VERSION}" != "8"; then
# checkif devtoolset-? in package_install_dev_pkgs
for devtoolset in devtoolset-7 devtoolset-6 devtoolset-4; do
if test -f "/opt/rh/${devtoolset}/enable"; then
Expand Down
46 changes: 46 additions & 0 deletions devcluster/chmpx/override.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
#
# K2HDKC DBaaS Utilities - Override configuration for K2HDKC DBaaS
#
# Copyright 2021 Yahoo! Japan Corporation.
#
# K2HDKC DBaaS is a DataBase as a Service provided by Yahoo! JAPAN
# which is built K2HR3 as a backend and provides services in
# cooperation with OpenStack.
# The Override configuration for K2HDKC DBaaS serves to connect the
# components that make up the K2HDKC DBaaS. K2HDKC, K2HR3, CHMPX,
# and K2HASH are components provided as AntPickax.
#
# For the full copyright and license information, please view
# the license file that was distributed with this source code.
#
# AUTHOR: Takeshi Nakatani
# CREATE: Fri Jan 22 2021
# REVISION:
#

# [NOTE]
# Replace the chmpx configuration file/CHMPX_INI_CONF_FILE and the
# k2hdkc configuration file/K2HDKC_INI_CONF_FILE.
# CHMPX_INI_CONF_FILE and K2HD KC_INI_CONF_FILE must be set to refer
# to the file/OUTPUT_FILE that outputs the resource obtained by
# k2hr3-get-resource-helper.
# Therefore, CHMPX_INI_CONF_FILE and K2HDKC_INI_CONF_FILE are replaced
# by this file.

k2hr3-get-resource-helper.conf:OUTPUT_FILE = k2hdkc.ini
chmpx-service-helper.conf:CHMPX_INI_CONF_FILE = k2hdkc.ini
chmpx-service-helper.conf:SUBPROCESS_USER = k2hr3
k2hdkc-service-helper.conf:K2HDKC_INI_CONF_FILE = k2hdkc.ini
k2hdkc-service-helper.conf:SUBPROCESS_USER = k2hr3
k2hdkc-service-helper.conf:WAIT_DEPENDPROC_PIDFILE = /var/run/antpickax/chmpx.pid
k2hdkc-service-helper.conf:WAIT_SEC_AFTER_DEPENDPROC_UP = 30

#
# Local variables:
# tab-width: 4
# c-basic-offset: 4
# End:
# vim600: noexpandtab sw=4 ts=4 fdm=marker
# vim<600: noexpandtab sw=4 ts=4
#

4 changes: 2 additions & 2 deletions devcluster/chmpx/setup_chmpx_functions
Original file line number Diff line number Diff line change
Expand Up @@ -103,11 +103,11 @@ configure_chmpx_slave_ini() {
# 0 on success
# 1 on failure
#
install_chmpx_ini() {
install_chmpx_conf() {
_src_chmpx_conf_file=${1:?"src_chmpx_conf_file must be nonzero"}
_dst_chmpx_conf_file=${2:?"dst_chmpx_conf_file must be nonzero"}

logger -t ${TAG} -p user.debug "install_chmpx_ini _src_chmpx_conf_file=${_src_chmpx_conf_file} _dst_chmpx_conf_file=${_dst_chmpx_conf_file}"
logger -t ${TAG} -p user.debug "install_chmpx_conf _src_chmpx_conf_file=${_src_chmpx_conf_file} _dst_chmpx_conf_file=${_dst_chmpx_conf_file}"
# A dry run returns 0
if test -n "${DRYRUN-}"; then
return 0
Expand Down
3 changes: 1 addition & 2 deletions devcluster/cluster_functions
Original file line number Diff line number Diff line change
Expand Up @@ -223,8 +223,7 @@ setup_package_repository() {

if test "${OS_NAME}" = "centos"; then
if test "${OS_VERSION}" = "8"; then
logger -t ${TAG} -p user.debug "sudo dnf install -y centos-releae-scl"
sudo dnf install -q -y centos-release-scl
logger -t ${TAG} -p user.debug "no centos-releae-scl found"
elif test "${OS_VERSION}" = "7"; then
logger -t ${TAG} -p user.debug "sudo yum install -y centos-releae-scl"
sudo yum install -q -y centos-release-scl
Expand Down
22 changes: 16 additions & 6 deletions devcluster/dkc/setup_dkc.sh
Original file line number Diff line number Diff line change
Expand Up @@ -163,8 +163,8 @@ logger -t ${TAG} -p user.info "5. Installs OS dependent packages"

# Some distros pre-install dkc required packages. In this case, users define
# empty ${package_install_pkg} value in their initial configuration file.
if test -n "${k2hdkc_pkgs-}"; then
setup_install_os_packages "${k2hdkc_pkgs-}"
if test -n "${package_install_pkgs-}"; then
setup_install_os_packages "${package_install_pkgs-}"
RET=$?
if test "${RET}" -ne 0; then
logger -t ${TAG} -p user.err "setup_install_os_packages should return zero, not ${RET}"
Expand Down Expand Up @@ -198,16 +198,26 @@ fi

########
# 7. Installs the configured chmpx config file
# k2hr3_dkc uses a configuration file(for instance /etc/k2hdkc/server.ini) for chmpx.
# k2hr3_dkc uses configuration files(for instance /etc/antpickax/k2hdkc.ini and /etc/antpickax/override.conf) for chmpx.
#
logger -t ${TAG} -p user.info "7. Installs the configured chmpx config file"
logger -t ${TAG} -p user.info "7. Installs the configured chmpx config files"

# Installs the configured chmpx config file in INI format to ${chmpx_conf_file}
if test -f "${SRCDIR}/../chmpx/server.ini"; then
install_chmpx_ini ${SRCDIR}/../chmpx/server.ini ${chmpx_conf_file}
install_chmpx_conf ${SRCDIR}/../chmpx/server.ini ${chmpx_conf_file}
RET=$?
if test "${RET}" -ne 0; then
logger -t ${TAG} -p user.err "install_chmpx_ini should return zero, not ${RET}"
logger -t ${TAG} -p user.err "install_chmpx_conf should return zero, not ${RET}"
exit 1
fi
fi

# Installs the override.conf to ${chmpx_override_conf_file}
if test -f "${SRCDIR}/../chmpx/override.conf"; then
install_chmpx_conf ${SRCDIR}/../chmpx/override.conf ${chmpx_override_conf_file}
RET=$?
if test "${RET}" -ne 0; then
logger -t ${TAG} -p user.err "install_chmpx_conf should return zero, not ${RET}"
exit 1
fi
fi
Expand Down
3 changes: 1 addition & 2 deletions devcluster/dkc/setup_dkc_centos.ini
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,10 @@
#[chmpx]
chmpx_msg_max=1024
chmpx_server_name=localhost
k2hdkc_pkgs=""

#[package]
package_script_base_url=https://packagecloud.io/install/repositories/antpickax/stable
package_dnf_repo=PowerTools
package_dnf_repo=powertools

#
# VIM modelines
Expand Down
3 changes: 2 additions & 1 deletion devcluster/dkc/setup_dkc_default.ini
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,12 @@
#

#[chmpx]
chmpx_conf_file=/etc/k2hdkc/server.ini
chmpx_conf_file=/etc/antpickax/k2hdkc.ini
chmpx_msg_max=1024
chmpx_server_name=localhost
chmpx_systemd_unit_file=/etc/systemd/system/chmpx.service
chmpx_loglevel=dump
chmpx_override_conf_file=/etc/antpickax/override.conf

#[k2hdkc]
k2hdkc_data_dir="/var/lib/k2hdkc"
Expand Down
2 changes: 1 addition & 1 deletion devcluster/service_manager/chmpx-slave.service
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ Type=simple
User=k2hr3
PermissionsStartOnly=true
ExecStartPre=/sbin/sysctl fs.mqueue.msg_max=1024
ExecStart=/usr/bin/chmpx -conf /etc/k2hdkc/slave.ini -d msg
ExecStart=/usr/bin/chmpx -conf /etc/antpickax/slave.ini -d dump
Restart=always
PIDFile=/var/run/chmpx.pid

Expand Down
16 changes: 0 additions & 16 deletions devcluster/service_manager/chmpx.service

This file was deleted.

19 changes: 0 additions & 19 deletions devcluster/service_manager/k2hdkc.service

This file was deleted.

2 changes: 1 addition & 1 deletion devcluster/service_manager/k2hr3-api.service
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ Type=simple
WorkingDirectory=/home/k2hr3
Environment=HOME=/home/k2hr3
Environment=NODE_CONFIG_DIR=/home/k2hr3/k2hr3-api/config
Environment=NODE_DEBUG=LOGLEVEL_DBG
Environment=NODE_DEBUG=LOGLEVEL_DEBUG
Environment=NODE_ENV=development
ExecStart=/usr/bin/node /home/k2hr3/k2hr3-api/bin/www
Restart=always
Expand Down
70 changes: 4 additions & 66 deletions devcluster/service_manager/plugin/default.sh
Original file line number Diff line number Diff line change
Expand Up @@ -44,39 +44,10 @@ function setup_service_manager {
logger -t ${TAG} -p user.info "default.sh setup_service_manager"

########
# 8. Configures the chmpx's service manager default configuration
# We recommend chmpx process works as a service by systemd.
#
logger -t ${TAG} -p user.info "8. Configures the chmpx's service manager default configuration"

# Determines the service management file which file format depends on a service manager of the target OS
if test "${SERVICE_MANAGER}" = "systemd"; then
service_manager_file=${SRCDIR}/../service_manager/chmpx.service
else
logger -t ${TAG} -p user.err "SERVICE_MANAGER must be either systemd, not ${SERVICE_MANAGER}"
exit 1
fi
# Configures the chmpx's service manager default configuration
is_k2hdkc=0
configure_chmpx_service_manager_file ${SERVICE_MANAGER} ${service_manager_file} ${k2hr3_dkc_runuser} ${chmpx_conf_file} ${chmpx_msg_max} ${is_k2hdkc} ${chmpx_loglevel}
RET=$?
if test "${RET}" -ne 0; then
logger -t ${TAG} -p user.err "configure_chmpx_service_manager_file should return zero, not ${RET}"
exit 1
fi

########
# 9. Installs the chmpx service manager configuration and enables it
# 9. Enables the chmpx service manager
# systemd controls chmpx.
#
logger -t ${TAG} -p user.info "9. Installs the chmpx service manager configuration and enables it"

install_service_manager_conf ${SERVICE_MANAGER} chmpx
RET=$?
if test "${RET}" -ne 0; then
logger -t ${TAG} -p user.err "install_service_manager_conf should return zero, not ${RET}"
exit 1
fi
logger -t ${TAG} -p user.info "9. Enables the chmpx service manager configuration"

enable_service_manager ${SERVICE_MANAGER} chmpx
RET=$?
Expand All @@ -86,39 +57,11 @@ function setup_service_manager {
fi

########
# 10. Configures the k2hdkc's service manager default configuration
# We recommend k2hdkc processes work as a service by systemd.
#
logger -t ${TAG} -p user.info "10. Configures the k2hdkc's service manager default configuration"

# Determines the service management file which file format depends on a service manager of the target OS
if test "${SERVICE_MANAGER}" = "systemd"; then
service_manager_file=${SRCDIR}/../service_manager/k2hdkc.service
else
logger -t ${TAG} -p user.err "SERVICE_MANAGER must be either systemd, not ${SERVICE_MANAGER}"
exit 1
fi
# Configures the k2hdkc's service manager default configuration
is_k2hdkc=1
configure_chmpx_service_manager_file ${SERVICE_MANAGER} ${service_manager_file} ${k2hr3_dkc_runuser} ${chmpx_conf_file} ${chmpx_msg_max} ${is_k2hdkc} ${k2hdkc_loglevel}
RET=$?
if test "${RET}" -ne 0; then
logger -t ${TAG} -p user.err "configure_chmpx_service_manager_file should return zero, not ${RET}"
exit 1
fi

########
# 11. Installs the k2hdkc service manager configuration and enables it
# 11. Enables Installs the k2hdkc service manager configuration
# systemd controls k2hdkc
#
logger -t ${TAG} -p user.info "11. Installs the k2hdkc service manager configuration and enables it"
logger -t ${TAG} -p user.info "11. Enables the k2hdkc service manager configuration"

install_service_manager_conf ${SERVICE_MANAGER} k2hdkc
RET=$?
if test "${RET}" -ne 0; then
logger -t ${TAG} -p user.err "install_service_manager_conf should return zero, not ${RET}"
exit 1
fi
enable_service_manager ${SERVICE_MANAGER} k2hdkc
RET=$?
if test "${RET}" -ne 0; then
Expand Down Expand Up @@ -150,8 +93,3 @@ function setup_service_manager {
return 0
}

#
# VIM modelines
#
# vim:set ts=4 fenc=utf-8:
#

0 comments on commit cff94b2

Please sign in to comment.