aboutsummaryrefslogtreecommitdiffstats
path: root/recipes-connectivity/consul
diff options
context:
space:
mode:
Diffstat (limited to 'recipes-connectivity/consul')
-rw-r--r--recipes-connectivity/consul/consul-migrate_git.bb26
-rw-r--r--recipes-connectivity/consul/consul_git.bb67
-rw-r--r--recipes-connectivity/consul/files/0001-prepared_query-make-compatible-with-go1.5.patch31
-rw-r--r--recipes-connectivity/consul/files/consul.service12
4 files changed, 136 insertions, 0 deletions
diff --git a/recipes-connectivity/consul/consul-migrate_git.bb b/recipes-connectivity/consul/consul-migrate_git.bb
new file mode 100644
index 00000000..4cc53b20
--- /dev/null
+++ b/recipes-connectivity/consul/consul-migrate_git.bb
@@ -0,0 +1,26 @@
+SUMMARY = "Provides data migration for Consul server nodes"
+HOMEPAGE = "https://github.com/hashicorp/consul-migrate"
+LICENSE = "MPL-2.0"
+LIC_FILES_CHKSUM = "file://LICENSE;md5=b278a92d2c1509760384428817710378"
+
+DEPENDS += "raft raft-boltdb raft-mdb"
+
+PKG_NAME = "github.com/hashicorp/consul-migrate"
+SRC_URI = "git://${PKG_NAME}.git"
+SRCREV = "678fb10cdeae25ab309e99e655148f0bf65f9710"
+
+inherit golang
+
+SYSROOT_PREPROCESS_FUNCS += "consul_migrate_sysroot_preprocess"
+
+export GOROOT="${STAGING_DIR_NATIVE}/${nonarch_libdir}/${HOST_SYS}/go"
+
+consul_migrate_sysroot_preprocess () {
+ install -d ${SYSROOT_DESTDIR}${prefix}/local/go/src/${PKG_NAME}
+ cp -a ${D}${prefix}/local/go/src/${PKG_NAME} ${SYSROOT_DESTDIR}${prefix}/local/go/src/$(dirname ${PKG_NAME})
+ install -d ${SYSROOT_DESTDIR}${prefix}/bin
+ cp -a ${D}${prefix}/bin/* ${SYSROOT_DESTDIR}${prefix}/bin/
+}
+
+CLEANBROKEN = "1"
+INSANE_SKIP_${PN} = "ldflags"
diff --git a/recipes-connectivity/consul/consul_git.bb b/recipes-connectivity/consul/consul_git.bb
new file mode 100644
index 00000000..bcfb5aa3
--- /dev/null
+++ b/recipes-connectivity/consul/consul_git.bb
@@ -0,0 +1,67 @@
+DESCRIPTION = "A tool for discovering and configuring services in your infrastructure"
+HOMEPAGE = "https://www.consul.io/"
+LICENSE = "MPL-2.0"
+LIC_FILES_CHKSUM = "file://LICENSE;md5=b278a92d2c1509760384428817710378"
+
+DEPENDS += "circbuf \
+ consul-migrate \
+ go-checkpoint \
+ go-msgpack \
+ go-metrics \
+ go-bindata \
+ go-sys \
+ go-syslog \
+ dockerclient \
+ logutils \
+ memberlist \
+ raft \
+ raft-boltdb \
+ scada-client \
+ serf-go \
+ yamux \
+ muxado \
+ dns \
+ cli \
+ mapstructure \
+ copystructure \
+ reflectwalk \
+ columnize \
+ go-radix \
+ golang-lru \
+ hashicorp-hil \
+ hashicorp-hcl \
+ hashicorp-go-cleanhttp \
+ hashicorp-go-memdb \
+ hashicorp-go-reap \
+ hashicorp-go-uuid \
+ net-rpc-msgpackrpc \
+ "
+
+PKG_NAME = "github.com/hashicorp/consul"
+SRC_URI = "git://${PKG_NAME}.git \
+ file://consul.service \
+ file://0001-prepared_query-make-compatible-with-go1.5.patch \
+ "
+SRCREV = "f97afda8e15046b41d951bf3b4220372c45df7ab"
+
+CCACHE = ""
+
+inherit systemd golang
+
+INSANE_SKIP_${PN} += "ldflags"
+
+SYSTEMD_SERVICE_${PN} = "consul.service"
+SYSTEMD_AUTO_ENABLE_${PN} = "enable"
+
+export GOROOT="${STAGING_DIR_NATIVE}/${nonarch_libdir}/${HOST_SYS}/go"
+
+#Stops go from installing and testing the package
+do_configure(){
+}
+
+do_install_append() {
+ install -d ${D}/${systemd_unitdir}/system
+ cp ${WORKDIR}/consul.service ${D}/${systemd_unitdir}/system
+}
+
+FILES_${PN} += "${systemd_unitdir}/system"
diff --git a/recipes-connectivity/consul/files/0001-prepared_query-make-compatible-with-go1.5.patch b/recipes-connectivity/consul/files/0001-prepared_query-make-compatible-with-go1.5.patch
new file mode 100644
index 00000000..a66e1dca
--- /dev/null
+++ b/recipes-connectivity/consul/files/0001-prepared_query-make-compatible-with-go1.5.patch
@@ -0,0 +1,31 @@
+From fb11d9e31788c912f94faf8b188278d54dc9a8f1 Mon Sep 17 00:00:00 2001
+From: Bruce Ashfield <bruce.ashfield@windriver.com>
+Date: Wed, 20 Apr 2016 16:34:50 -0400
+Subject: [PATCH] prepared_query: make compatible with go1.5
+
+The copying of a regex is only in go 1.6. We can take the chance of
+lock contention, so we drop the copy and use the regex directly.
+
+Signed-off-by: Bruce Ashfield <bruce.ashfield@windriver.com>
+---
+ consul/prepared_query/template.go | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/consul/prepared_query/template.go b/consul/prepared_query/template.go
+index 984f0bcf9cc6..1c61910c1526 100644
+--- a/consul/prepared_query/template.go
++++ b/consul/prepared_query/template.go
+@@ -116,8 +116,8 @@ func (ct *CompiledTemplate) Render(name string) (*structs.PreparedQuery, error)
+ // from multiple goroutines.
+ var matches []string
+ if ct.re != nil {
+- re := ct.re.Copy()
+- matches = re.FindStringSubmatch(name)
++ // re := ct.re.Copy()
++ matches = ct.re.FindStringSubmatch(name)
+ }
+
+ // Create a safe match function that can't fail at run time. It will
+--
+2.4.0.53.g8440f74
+
diff --git a/recipes-connectivity/consul/files/consul.service b/recipes-connectivity/consul/files/consul.service
new file mode 100644
index 00000000..c9494e31
--- /dev/null
+++ b/recipes-connectivity/consul/files/consul.service
@@ -0,0 +1,12 @@
+[Unit]
+Description=Launch Consul Cluster
+
+[Service]
+Restart=on-failure
+RestartSec=45
+ExecStartPre=/bin/sh -c 'echo -ne \'{"data_dir":\"/var/consul","server":true,"bootstrap_expect":1,\' > /tmp/consul.conf'
+ExecStartPre=/bin/sh -c 'echo -ne \'"bind_addr":"\'$(ifconfig br0 | awk \'/inet addr/{print substr($2,6)}\')\'"}\' >> /tmp/consul.conf'
+ExecStart=/usr/bin/consul agent -config-file=/tmp/consul.conf
+
+[Install]
+WantedBy=multi-user.target