aboutsummaryrefslogtreecommitdiff
path: root/network/etcd
diff options
context:
space:
mode:
authorThibaut Notteboom <thibaut.notteboom@gmail.com>2018-07-23 22:12:25 +0100
committerWilly Sudiarto Raharjo <willysr@slackbuilds.org>2018-07-28 08:51:47 +0700
commit819088b4aaf1d84bfde15597aaff6870505534af (patch)
tree25d3fba75203c033574a7e56490457a2006d073e /network/etcd
parenta89d29f0f8bd2f8d7c12a3a77146a00f0f677f3d (diff)
network/etcd: Added (key value store for shared configuration).
Signed-off-by: David Spencer <idlemoor@slackbuilds.org>
Diffstat (limited to 'network/etcd')
-rw-r--r--network/etcd/README16
-rw-r--r--network/etcd/README.SBo16
-rw-r--r--network/etcd/doinst.sh27
-rw-r--r--network/etcd/etcd.SlackBuild106
-rw-r--r--network/etcd/etcd.info10
-rw-r--r--network/etcd/etcd.logrotate7
-rw-r--r--network/etcd/rc.etcd37
-rw-r--r--network/etcd/slack-desc19
8 files changed, 238 insertions, 0 deletions
diff --git a/network/etcd/README b/network/etcd/README
new file mode 100644
index 0000000000000..17acd9492d9dc
--- /dev/null
+++ b/network/etcd/README
@@ -0,0 +1,16 @@
+Etcd is a distributed reliable key-value store for the most critical
+data of a distributed system, with a focus on being:
+ Simple: well-defined, user-facing API (gRPC)
+ Secure: automatic TLS with optional client cert authentication
+ Fast: benchmarked 10,000 writes/sec
+ Reliable: properly distributed using Raft
+
+Groupname and Username
+
+You must have the 'etcd' group and user to run this script,
+for example:
+
+ groupadd -g 355 etcd
+ useradd -d /var/lib/etcd -s /bin/sh -u 355 -g etcd etcd
+
+For some basic setup instructions, check the included 'README.SBo'.
diff --git a/network/etcd/README.SBo b/network/etcd/README.SBo
new file mode 100644
index 0000000000000..0f12c4c51e48c
--- /dev/null
+++ b/network/etcd/README.SBo
@@ -0,0 +1,16 @@
+README.SBo
+==========
+
+To start etcd automatically at system startup, add the following to
+your /etc/rc.d/rc.local:
+
+ if [ -x /etc/rc.d/rc.etcd ]; then
+ /etc/rc.d/rc.etcd start
+ fi
+
+To stop etcd automatically at system shutdown, add the following to
+your /etc/rc.d/rc.local_shutdown:
+
+ if [ -x /etc/rc.d/rc.etcd ]; then
+ /etc/rc.d/rc.etcd stop
+ fi
diff --git a/network/etcd/doinst.sh b/network/etcd/doinst.sh
new file mode 100644
index 0000000000000..45b0c62dd7a8b
--- /dev/null
+++ b/network/etcd/doinst.sh
@@ -0,0 +1,27 @@
+config() {
+ NEW="$1"
+ OLD="$(dirname $NEW)/$(basename $NEW .new)"
+ # If there's no config file by that name, mv it over:
+ if [ ! -r $OLD ]; then
+ mv $NEW $OLD
+ elif [ "$(cat $OLD | md5sum)" = "$(cat $NEW | md5sum)" ]; then
+ # toss the redundant copy
+ rm $NEW
+ fi
+ # Otherwise, we leave the .new copy for the admin to consider...
+}
+
+preserve_perms() {
+ NEW="$1"
+ OLD="$(dirname $NEW)/$(basename $NEW .new)"
+ if [ -e $OLD ]; then
+ cp -a $OLD ${NEW}.incoming
+ cat $NEW > ${NEW}.incoming
+ mv ${NEW}.incoming $NEW
+ fi
+ config $NEW
+}
+
+preserve_perms etc/rc.d/rc.etcd.new
+config etc/etcd/etcd.conf.yml.new
+config etc/logrotate.d/etcd.new
diff --git a/network/etcd/etcd.SlackBuild b/network/etcd/etcd.SlackBuild
new file mode 100644
index 0000000000000..c7dcfdedbf495
--- /dev/null
+++ b/network/etcd/etcd.SlackBuild
@@ -0,0 +1,106 @@
+#!/bin/sh
+
+# Slackware build script for etcd
+
+# Copyright 2018 Thibaut Notteboom, Paris, FRANCE
+# All rights reserved.
+#
+# Redistribution and use of this script, with or without modification, is
+# permitted provided that the following conditions are met:
+#
+# 1. Redistributions of this script must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+#
+# THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR IMPLIED
+# WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+# MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
+# EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+PRGNAM=etcd
+VERSION=${VERSION:-3.3.8}
+BUILD=${BUILD:-1}
+TAG=${TAG:-_SBo}
+
+if [ -z "$ARCH" ]; then
+ case "$( uname -m )" in
+ i?86) ARCH=i586 ;;
+ arm*) ARCH=arm ;;
+ *) ARCH=$( uname -m ) ;;
+ esac
+fi
+
+CWD=$(pwd)
+TMP=${TMP:-/tmp/SBo}
+PKG=$TMP/package-$PRGNAM
+OUTPUT=${OUTPUT:-/tmp}
+
+if [ "$ARCH" = "i586" ]; then
+ SLKCFLAGS="-O2 -march=i586 -mtune=i686"
+ LIBDIRSUFFIX=""
+elif [ "$ARCH" = "i686" ]; then
+ SLKCFLAGS="-O2 -march=i686 -mtune=i686"
+ LIBDIRSUFFIX=""
+elif [ "$ARCH" = "x86_64" ]; then
+ SLKCFLAGS="-O2 -fPIC"
+ LIBDIRSUFFIX="64"
+else
+ SLKCFLAGS="-O2"
+ LIBDIRSUFFIX=""
+fi
+
+set -e
+
+if [ "$(grep ^etcd /etc/passwd)" = "" -o "$(grep ^etcd /etc/group)" = "" ] ; then
+ printf "\nYou must have a etcd user and group.\n\nExample:\n"
+ printf "\t# groupadd -g 355 etcd\n"
+ printf "\t# useradd -d /var/lib/etcd -s /bin/sh -u 355 -g etcd etcd\n\n"
+ exit 1
+fi
+
+rm -rf $PKG
+mkdir -p $TMP $PKG $OUTPUT
+cd $TMP
+rm -rf $PRGNAM-$VERSION
+tar xvf $CWD/$PRGNAM-$VERSION.tar.gz
+cd $PRGNAM-$VERSION
+chown -R root:root .
+find -L . \
+ \( -perm 777 -o -perm 775 -o -perm 750 -o -perm 711 -o -perm 555 \
+ -o -perm 511 \) -exec chmod 755 {} \; -o \
+ \( -perm 666 -o -perm 664 -o -perm 640 -o -perm 600 -o -perm 444 \
+ -o -perm 440 -o -perm 400 \) -exec chmod 644 {} \;
+
+./build
+
+install -Dm755 bin/etcd $PKG/usr/bin/etcd
+install -Dm755 bin/etcdctl $PKG/usr/bin/etcdctl
+
+install -Dm644 etcd.conf.yml.sample $PKG/etc/etcd/etcd.conf.yml.new
+install -Dm644 $CWD/rc.etcd $PKG/etc/rc.d/rc.etcd.new
+install -Dm644 $CWD/etcd.logrotate $PKG/etc/logrotate.d/etcd.new
+
+install -o etcd -g etcd -d $PKG/var/lib/etcd
+install -o etcd -g etcd -d $PKG/var/log/etcd
+
+find $PKG -print0 | xargs -0 file | grep -e "executable" -e "shared object" | grep ELF \
+ | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null || true
+
+mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION
+cp -a \
+ LICENSE Documentation/* \
+ $PKG/usr/doc/$PRGNAM-$VERSION
+cat $CWD/$PRGNAM.SlackBuild > $PKG/usr/doc/$PRGNAM-$VERSION/$PRGNAM.SlackBuild
+cat $CWD/README.SBo > $PKG/usr/doc/$PRGNAM-$VERSION/README.SBo
+
+mkdir -p $PKG/install
+cat $CWD/slack-desc > $PKG/install/slack-desc
+cat $CWD/doinst.sh > $PKG/install/doinst.sh
+
+cd $PKG
+/sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.${PKGTYPE:-tgz}
diff --git a/network/etcd/etcd.info b/network/etcd/etcd.info
new file mode 100644
index 0000000000000..a0e1a2698fb8f
--- /dev/null
+++ b/network/etcd/etcd.info
@@ -0,0 +1,10 @@
+PRGNAM="etcd"
+VERSION="3.3.8"
+HOMEPAGE="https://github.com/coreos/etcd"
+DOWNLOAD="https://github.com/coreos/etcd/archive/v3.3.8/etcd-3.3.8.tar.gz"
+MD5SUM="f300d08cbb6ebe6572eee9191127547a"
+DOWNLOAD_x86_64=""
+MD5SUM_x86_64=""
+REQUIRES="google-go-lang"
+MAINTAINER="Thibaut Notteboom"
+EMAIL="thibaut.notteboom@gmail.com"
diff --git a/network/etcd/etcd.logrotate b/network/etcd/etcd.logrotate
new file mode 100644
index 0000000000000..225b3a9e2d948
--- /dev/null
+++ b/network/etcd/etcd.logrotate
@@ -0,0 +1,7 @@
+/var/log/etcd/etcd.log {
+ copytruncate
+ daily
+ rotate 7
+ compress
+ missingok
+}
diff --git a/network/etcd/rc.etcd b/network/etcd/rc.etcd
new file mode 100644
index 0000000000000..abd95ede0205f
--- /dev/null
+++ b/network/etcd/rc.etcd
@@ -0,0 +1,37 @@
+#!/bin/sh
+
+ETCD_USER=etcd
+ETCD_BIN=/usr/bin/etcd
+ETCD_LOG_FILE=/var/log/etcd/etcd.log
+ETCD_CONFIG_FILE=/etc/etcd/etcd.conf.yml
+
+etcd_start() {
+ echo "Starting the etcd service: $ETCD_BIN"
+ su - $ETCD_USER -c "$ETCD_BIN --config-file $ETCD_CONFIG_FILE >> $ETCD_LOG_FILE 2>&1 &"
+}
+
+etcd_stop() {
+ echo "Stoping the etcd service: $ETCD_BIN"
+ killall etcd
+}
+
+etcd_restart() {
+ etcd_stop
+ sleep 1
+ etcd_start
+}
+
+case "$1" in
+ 'start')
+ etcd_start
+ ;;
+ 'stop')
+ etcd_stop
+ ;;
+ 'restart')
+ etcd_restart
+ ;;
+ *)
+ echo "Usage: $0 start|stop|restart"
+ ;;
+esac
diff --git a/network/etcd/slack-desc b/network/etcd/slack-desc
new file mode 100644
index 0000000000000..d069a38a0e6b3
--- /dev/null
+++ b/network/etcd/slack-desc
@@ -0,0 +1,19 @@
+# HOW TO EDIT THIS FILE:
+# The "handy ruler" below makes it easier to edit a package description.
+# Line up the first '|' above the ':' following the base package name, and
+# the '|' on the right side marks the last column you can put a character in.
+# You must make exactly 11 lines for the formatting to be correct. It's also
+# customary to leave one space after the ':' except on otherwise blank lines.
+
+ |-----handy-ruler------------------------------------------------------|
+etcd: etcd (key value store for shared configuration and service discovery)
+etcd:
+etcd: Etcd is a distributed reliable key-value store for the most critical
+etcd: data of a distributed system, with a focus on being:
+etcd: Simple: well-defined, user-facing API (gRPC)
+etcd: Secure: automatic TLS with optional client cert authentication
+etcd: Fast: benchmarked 10,000 writes/sec
+etcd: Reliable: properly distributed using Raft
+etcd:
+etcd:
+etcd: