From f3542806204174eefa9818a8e251481f0a52f20e Mon Sep 17 00:00:00 2001 From: Vlad Glagolev Date: Fri, 2 Jul 2021 03:56:28 +0000 Subject: consul-bin: new spell, service discovery and configuration tool --- ChangeLog | 4 ++++ accounts | 1 + bin-net/consul-bin/BUILD | 1 + bin-net/consul-bin/DEPENDS | 1 + bin-net/consul-bin/DETAILS | 24 ++++++++++++++++++++++++ bin-net/consul-bin/FINAL | 4 ++++ bin-net/consul-bin/HISTORY | 3 +++ bin-net/consul-bin/INSTALL | 19 +++++++++++++++++++ bin-net/consul-bin/PRE_BUILD | 4 ++++ bin-net/consul-bin/files/config.json | 6 ++++++ bin-net/consul-bin/init.d/consul | 35 +++++++++++++++++++++++++++++++++++ bin-net/consul-bin/init.d/consul.conf | 3 +++ groups | 1 + 13 files changed, 106 insertions(+) create mode 100755 bin-net/consul-bin/BUILD create mode 100755 bin-net/consul-bin/DEPENDS create mode 100755 bin-net/consul-bin/DETAILS create mode 100755 bin-net/consul-bin/FINAL create mode 100644 bin-net/consul-bin/HISTORY create mode 100755 bin-net/consul-bin/INSTALL create mode 100755 bin-net/consul-bin/PRE_BUILD create mode 100644 bin-net/consul-bin/files/config.json create mode 100755 bin-net/consul-bin/init.d/consul create mode 100644 bin-net/consul-bin/init.d/consul.conf diff --git a/ChangeLog b/ChangeLog index 1075883..72b5e87 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2021-07-01 Vlad Glagolev + * bin-net/consul-bin: new spell, service discovery and configuration tool + * accounts, groups: added account data for consul-bin spell + 2021-06-04 Treeve Jelbert * bin-devel/nodejs-bin: Nodejs diff --git a/accounts b/accounts index 7ecd255..89f8164 100755 --- a/accounts +++ b/accounts @@ -5,3 +5,4 @@ tomcat55:37:35 tomcat6:38:35 ontopia:39:36 tomcat7:40:35 +consul:217:217 diff --git a/bin-net/consul-bin/BUILD b/bin-net/consul-bin/BUILD new file mode 100755 index 0000000..a694510 --- /dev/null +++ b/bin-net/consul-bin/BUILD @@ -0,0 +1 @@ +create_account consul diff --git a/bin-net/consul-bin/DEPENDS b/bin-net/consul-bin/DEPENDS new file mode 100755 index 0000000..f7c362b --- /dev/null +++ b/bin-net/consul-bin/DEPENDS @@ -0,0 +1 @@ +depends unzip diff --git a/bin-net/consul-bin/DETAILS b/bin-net/consul-bin/DETAILS new file mode 100755 index 0000000..671950d --- /dev/null +++ b/bin-net/consul-bin/DETAILS @@ -0,0 +1,24 @@ + SPELL=consul-bin + SPELLX=${SPELL/-bin/} + VERSION=1.10.0 +if [[ "${SMGL_COMPAT_ARCHS[1]}" == "x86_64" || "${SMGL_COMPAT_ARCHS[1]}" == "em64t" ]]; then + ARCH=amd64 + SOURCE_HASH=sha256:7cd2e67ce2779c74ce18d880ccdfdc00a655eb71a6a7a956e6d3b71e7937ca0f:UPSTREAM_HASH +else + ARCH=386 + SOURCE_HASH=sha256:c3276f6b87035691d7dee13e18c5e8e4aa2c9fa506a5182eaa1fb9dde547e3aa:UPSTREAM_HASH +fi + SOURCE=${SPELLX}_${VERSION}_linux_${ARCH}.zip + SOURCE_URL[0]=https://releases.hashicorp.com/${SPELLX}/${VERSION}/${SOURCE} +SOURCE_DIRECTORY="${BUILD_DIRECTORY}/${SPELL}-${VERSION}" + GATHER_DOCS=off + WEB_SITE=https://www.consul.io/ + ENTERED=20210701 + LICENSE[0]=MPL + SHORT="service discovery and configuration tool" +cat << EOF +This is a binary version of Consul. + +Consul is a tool for service discovery and configuration. Consul is distributed, +highly available, and extremely scalable. +EOF diff --git a/bin-net/consul-bin/FINAL b/bin-net/consul-bin/FINAL new file mode 100755 index 0000000..1571059 --- /dev/null +++ b/bin-net/consul-bin/FINAL @@ -0,0 +1,4 @@ +# binaries require /lib64 +if [ ! -d "${INSTALL_ROOT}/lib64" ]; then + ln -vsf "${TRACK_ROOT}/lib" "${INSTALL_ROOT}/lib64" +fi diff --git a/bin-net/consul-bin/HISTORY b/bin-net/consul-bin/HISTORY new file mode 100644 index 0000000..1e4af64 --- /dev/null +++ b/bin-net/consul-bin/HISTORY @@ -0,0 +1,3 @@ +2021-07-01 Vlad Glagolev + * DETAILS, DEPENDS, {PRE_,}BUILD, INSTALL, init.d, files: created + spell, version 1.10.0 diff --git a/bin-net/consul-bin/INSTALL b/bin-net/consul-bin/INSTALL new file mode 100755 index 0000000..7bd8444 --- /dev/null +++ b/bin-net/consul-bin/INSTALL @@ -0,0 +1,19 @@ +# /usr/bin is handled by smgl-fhs +install -vm 755 consul "${INSTALL_ROOT}/usr/bin" && + +local config_dir="${INSTALL_ROOT}/etc/${SPELLX}.d" && +local data_dir="${INSTALL_ROOT}/var/lib/${SPELLX}" && + +if [ ! -d "${config_dir}" ]; then + install -vm 750 -o root -g consul -d "${config_dir}" +fi && + +if [ ! -d "${data_dir}" ]; then + install -vm 750 -o consul -g consul -d "${data_dir}" +fi && + +install_config_file "${SPELL_DIRECTORY}/files/config.json" \ + "${config_dir}/config.json" && + +chown root:consul "${config_dir}/config.json" && +chmod 0640 "${config_dir}/config.json" diff --git a/bin-net/consul-bin/PRE_BUILD b/bin-net/consul-bin/PRE_BUILD new file mode 100755 index 0000000..5416781 --- /dev/null +++ b/bin-net/consul-bin/PRE_BUILD @@ -0,0 +1,4 @@ +mk_source_dir "${SOURCE_DIRECTORY}" && +cd "${SOURCE_DIRECTORY}" && + +unpack_file '' diff --git a/bin-net/consul-bin/files/config.json b/bin-net/consul-bin/files/config.json new file mode 100644 index 0000000..bf12894 --- /dev/null +++ b/bin-net/consul-bin/files/config.json @@ -0,0 +1,6 @@ +{ + "server": false, + "ui": false, + "enable_syslog": true, + "data_dir": "/var/lib/consul" +} diff --git a/bin-net/consul-bin/init.d/consul b/bin-net/consul-bin/init.d/consul new file mode 100755 index 0000000..859e9f6 --- /dev/null +++ b/bin-net/consul-bin/init.d/consul @@ -0,0 +1,35 @@ +#!/bin/bash + +. /etc/sysconfig/consul + +PROGRAM=/usr/bin/consul +PIDFILE=/var/run/consul/consul.pid +ARGS="agent -config-dir=/etc/consul.d -pid-file=$PIDFILE $CONSUL_ARGS" +RUNLEVEL=3 +NEEDS="+network" + +start() { + echo "Starting $NAME..." + + TIMEOUT=3 + PIDFILE_DIR=$(dirname $PIDFILE) + + [ -d $PIDFILE_DIR ] || mkdir $PIDFILE_DIR && chown consul:consul $PIDFILE_DIR + + su consul -s /bin/sh -c "$PROGRAM $ARGS &> /dev/null" & + ppid=$! + + sleep $TIMEOUT && pgrep -P $ppid > /dev/null || wait $ppid + + evaluate_retval +} + +stop() { + echo "Stopping $NAME..." + + kill -INT $(cat ${PIDFILE} 2> /dev/null) &> /dev/null + + evaluate_retval +} + +. /etc/init.d/smgl_init diff --git a/bin-net/consul-bin/init.d/consul.conf b/bin-net/consul-bin/init.d/consul.conf new file mode 100644 index 0000000..ff7139e --- /dev/null +++ b/bin-net/consul-bin/init.d/consul.conf @@ -0,0 +1,3 @@ +# For the arguments and description see ``consul agent --help'' + +CONSUL_ARGS="" diff --git a/groups b/groups index c2fe0e3..5a03a38 100755 --- a/groups +++ b/groups @@ -2,3 +2,4 @@ tomcat:35: ontopia:36: +consul:217: -- cgit v1.2.3