diff options
author | Vlad Glagolev | 2021-07-02 03:56:28 +0000 |
---|---|---|
committer | Vlad Glagolev | 2021-07-02 03:56:28 +0000 |
commit | f3542806204174eefa9818a8e251481f0a52f20e (patch) | |
tree | 8975ecd722e0ac00242b629f4e8ebda4f594495a /bin-net | |
parent | 5f4c13861b04e83d391137b5de202b687adcb273 (diff) |
consul-bin: new spell, service discovery and configuration tool
Diffstat (limited to 'bin-net')
-rwxr-xr-x | bin-net/consul-bin/BUILD | 1 | ||||
-rwxr-xr-x | bin-net/consul-bin/DEPENDS | 1 | ||||
-rwxr-xr-x | bin-net/consul-bin/DETAILS | 24 | ||||
-rwxr-xr-x | bin-net/consul-bin/FINAL | 4 | ||||
-rw-r--r-- | bin-net/consul-bin/HISTORY | 3 | ||||
-rwxr-xr-x | bin-net/consul-bin/INSTALL | 19 | ||||
-rwxr-xr-x | bin-net/consul-bin/PRE_BUILD | 4 | ||||
-rw-r--r-- | bin-net/consul-bin/files/config.json | 6 | ||||
-rwxr-xr-x | bin-net/consul-bin/init.d/consul | 35 | ||||
-rw-r--r-- | bin-net/consul-bin/init.d/consul.conf | 3 |
10 files changed, 100 insertions, 0 deletions
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 <stealth@sourcemage.org> + * 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="" |