Add GreptimeDB Alpine service packaging
All checks were successful
Build Alpine Packages / build-and-publish (push) Successful in 35m5s
All checks were successful
Build Alpine Packages / build-and-publish (push) Successful in 35m5s
This commit is contained in:
61
packaging/alpine/local/greptimedb/greptimedb.initd
Executable file
61
packaging/alpine/local/greptimedb/greptimedb.initd
Executable file
@@ -0,0 +1,61 @@
|
||||
#!/sbin/openrc-run
|
||||
|
||||
service_name="${RC_SVCNAME#greptimedb.}"
|
||||
description="GreptimeDB ${service_name} service"
|
||||
|
||||
command="/usr/bin/greptime"
|
||||
command_user="${GREPTIMEDB_USER:-greptimedb}:${GREPTIMEDB_GROUP:-greptimedb}"
|
||||
command_background="yes"
|
||||
pidfile="/run/greptimedb/${RC_SVCNAME}.pid"
|
||||
output_log="${GREPTIMEDB_LOG:-/var/log/greptimedb/${RC_SVCNAME}.log}"
|
||||
error_log="${GREPTIMEDB_ERRLOG:-/var/log/greptimedb/${RC_SVCNAME}.log}"
|
||||
|
||||
build_command_args() {
|
||||
config_file="${GREPTIMEDB_CONFIG:-/etc/greptimedb/${service_name}.toml}"
|
||||
log_dir="${GREPTIMEDB_LOG_DIR:-/var/log/greptimedb/${service_name}}"
|
||||
data_home="${GREPTIMEDB_DATA_HOME:-/var/lib/greptimedb/${service_name}}"
|
||||
wal_dir="${GREPTIMEDB_WAL_DIR:-/var/lib/greptimedb/${service_name}/wal}"
|
||||
|
||||
command_args="${GREPTIMEDB_GLOBAL_OPTS:-} ${service_name} start -c ${config_file} --log-dir ${log_dir}"
|
||||
|
||||
case "$service_name" in
|
||||
datanode)
|
||||
command_args="$command_args --data-home ${data_home} --wal-dir ${wal_dir}"
|
||||
;;
|
||||
metasrv|standalone)
|
||||
command_args="$command_args --data-home ${data_home}"
|
||||
;;
|
||||
esac
|
||||
|
||||
command_args="$command_args ${GREPTIMEDB_OPTS:-}"
|
||||
}
|
||||
|
||||
build_command_args
|
||||
|
||||
depend() {
|
||||
need net
|
||||
case "$service_name" in
|
||||
datanode|flownode|frontend)
|
||||
after greptimedb.metasrv
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
start_pre() {
|
||||
checkpath -d -m 0755 -o "${GREPTIMEDB_USER:-greptimedb}:${GREPTIMEDB_GROUP:-greptimedb}" \
|
||||
/run/greptimedb \
|
||||
/var/log/greptimedb \
|
||||
/var/lib/greptimedb \
|
||||
"$log_dir"
|
||||
|
||||
case "$service_name" in
|
||||
datanode)
|
||||
checkpath -d -m 0750 -o "${GREPTIMEDB_USER:-greptimedb}:${GREPTIMEDB_GROUP:-greptimedb}" \
|
||||
"$data_home" "$wal_dir"
|
||||
;;
|
||||
metasrv|standalone)
|
||||
checkpath -d -m 0750 -o "${GREPTIMEDB_USER:-greptimedb}:${GREPTIMEDB_GROUP:-greptimedb}" \
|
||||
"$data_home"
|
||||
;;
|
||||
esac
|
||||
}
|
||||
Reference in New Issue
Block a user