diff options
| author | Mark Asselstine <mark.asselstine@windriver.com> | 2018-09-18 16:27:27 -0400 |
|---|---|---|
| committer | Bruce Ashfield <bruce.ashfield@windriver.com> | 2018-09-25 17:40:49 -0400 |
| commit | daaecc315c96f6757a20ca5979c7889c0df02ec9 (patch) | |
| tree | 69fc4ddff707d3469b365d7b83e32f57efbe1640 | |
| parent | 492de1f32fc0053b692e3173ea6d3d19052f7c97 (diff) | |
| download | meta-cloud-services-daaecc315c96f6757a20ca5979c7889c0df02ec9.tar.gz | |
consul: consule-migrate: move from meta-overc
After several requests to make the consul recipe available outside of
meta-overc and the OverC framework we are moving the consul recipes
here. These are a copy from meta-overc (HEAD 6afe8d2c12ac).
NOTE that not all the DEPENDS have been copied as we will follow this
commit with work to make use of SRC_URIs for dependencies. See the
associated commit(s) which will follow this one.
Signed-off-by: Mark Asselstine <mark.asselstine@windriver.com>
Signed-off-by: Bruce Ashfield <bruce.ashfield@windriver.com>
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 0000000..4cc53b2 --- /dev/null +++ b/recipes-connectivity/consul/consul-migrate_git.bb | |||
| @@ -0,0 +1,26 @@ | |||
| 1 | SUMMARY = "Provides data migration for Consul server nodes" | ||
| 2 | HOMEPAGE = "https://github.com/hashicorp/consul-migrate" | ||
| 3 | LICENSE = "MPL-2.0" | ||
| 4 | LIC_FILES_CHKSUM = "file://LICENSE;md5=b278a92d2c1509760384428817710378" | ||
| 5 | |||
| 6 | DEPENDS += "raft raft-boltdb raft-mdb" | ||
| 7 | |||
| 8 | PKG_NAME = "github.com/hashicorp/consul-migrate" | ||
| 9 | SRC_URI = "git://${PKG_NAME}.git" | ||
| 10 | SRCREV = "678fb10cdeae25ab309e99e655148f0bf65f9710" | ||
| 11 | |||
| 12 | inherit golang | ||
| 13 | |||
| 14 | SYSROOT_PREPROCESS_FUNCS += "consul_migrate_sysroot_preprocess" | ||
| 15 | |||
| 16 | export GOROOT="${STAGING_DIR_NATIVE}/${nonarch_libdir}/${HOST_SYS}/go" | ||
| 17 | |||
| 18 | consul_migrate_sysroot_preprocess () { | ||
| 19 | install -d ${SYSROOT_DESTDIR}${prefix}/local/go/src/${PKG_NAME} | ||
| 20 | cp -a ${D}${prefix}/local/go/src/${PKG_NAME} ${SYSROOT_DESTDIR}${prefix}/local/go/src/$(dirname ${PKG_NAME}) | ||
| 21 | install -d ${SYSROOT_DESTDIR}${prefix}/bin | ||
| 22 | cp -a ${D}${prefix}/bin/* ${SYSROOT_DESTDIR}${prefix}/bin/ | ||
| 23 | } | ||
| 24 | |||
| 25 | CLEANBROKEN = "1" | ||
| 26 | 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 0000000..bcfb5aa --- /dev/null +++ b/recipes-connectivity/consul/consul_git.bb | |||
| @@ -0,0 +1,67 @@ | |||
| 1 | DESCRIPTION = "A tool for discovering and configuring services in your infrastructure" | ||
| 2 | HOMEPAGE = "https://www.consul.io/" | ||
| 3 | LICENSE = "MPL-2.0" | ||
| 4 | LIC_FILES_CHKSUM = "file://LICENSE;md5=b278a92d2c1509760384428817710378" | ||
| 5 | |||
| 6 | DEPENDS += "circbuf \ | ||
| 7 | consul-migrate \ | ||
| 8 | go-checkpoint \ | ||
| 9 | go-msgpack \ | ||
| 10 | go-metrics \ | ||
| 11 | go-bindata \ | ||
| 12 | go-sys \ | ||
| 13 | go-syslog \ | ||
| 14 | dockerclient \ | ||
| 15 | logutils \ | ||
| 16 | memberlist \ | ||
| 17 | raft \ | ||
| 18 | raft-boltdb \ | ||
| 19 | scada-client \ | ||
| 20 | serf-go \ | ||
| 21 | yamux \ | ||
| 22 | muxado \ | ||
| 23 | dns \ | ||
| 24 | cli \ | ||
| 25 | mapstructure \ | ||
| 26 | copystructure \ | ||
| 27 | reflectwalk \ | ||
| 28 | columnize \ | ||
| 29 | go-radix \ | ||
| 30 | golang-lru \ | ||
| 31 | hashicorp-hil \ | ||
| 32 | hashicorp-hcl \ | ||
| 33 | hashicorp-go-cleanhttp \ | ||
| 34 | hashicorp-go-memdb \ | ||
| 35 | hashicorp-go-reap \ | ||
| 36 | hashicorp-go-uuid \ | ||
| 37 | net-rpc-msgpackrpc \ | ||
| 38 | " | ||
| 39 | |||
| 40 | PKG_NAME = "github.com/hashicorp/consul" | ||
| 41 | SRC_URI = "git://${PKG_NAME}.git \ | ||
| 42 | file://consul.service \ | ||
| 43 | file://0001-prepared_query-make-compatible-with-go1.5.patch \ | ||
| 44 | " | ||
| 45 | SRCREV = "f97afda8e15046b41d951bf3b4220372c45df7ab" | ||
| 46 | |||
| 47 | CCACHE = "" | ||
| 48 | |||
| 49 | inherit systemd golang | ||
| 50 | |||
| 51 | INSANE_SKIP_${PN} += "ldflags" | ||
| 52 | |||
| 53 | SYSTEMD_SERVICE_${PN} = "consul.service" | ||
| 54 | SYSTEMD_AUTO_ENABLE_${PN} = "enable" | ||
| 55 | |||
| 56 | export GOROOT="${STAGING_DIR_NATIVE}/${nonarch_libdir}/${HOST_SYS}/go" | ||
| 57 | |||
| 58 | #Stops go from installing and testing the package | ||
| 59 | do_configure(){ | ||
| 60 | } | ||
| 61 | |||
| 62 | do_install_append() { | ||
| 63 | install -d ${D}/${systemd_unitdir}/system | ||
| 64 | cp ${WORKDIR}/consul.service ${D}/${systemd_unitdir}/system | ||
| 65 | } | ||
| 66 | |||
| 67 | 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 0000000..a66e1dc --- /dev/null +++ b/recipes-connectivity/consul/files/0001-prepared_query-make-compatible-with-go1.5.patch | |||
| @@ -0,0 +1,31 @@ | |||
| 1 | From fb11d9e31788c912f94faf8b188278d54dc9a8f1 Mon Sep 17 00:00:00 2001 | ||
| 2 | From: Bruce Ashfield <bruce.ashfield@windriver.com> | ||
| 3 | Date: Wed, 20 Apr 2016 16:34:50 -0400 | ||
| 4 | Subject: [PATCH] prepared_query: make compatible with go1.5 | ||
| 5 | |||
| 6 | The copying of a regex is only in go 1.6. We can take the chance of | ||
| 7 | lock contention, so we drop the copy and use the regex directly. | ||
| 8 | |||
| 9 | Signed-off-by: Bruce Ashfield <bruce.ashfield@windriver.com> | ||
| 10 | --- | ||
| 11 | consul/prepared_query/template.go | 4 ++-- | ||
| 12 | 1 file changed, 2 insertions(+), 2 deletions(-) | ||
| 13 | |||
| 14 | diff --git a/consul/prepared_query/template.go b/consul/prepared_query/template.go | ||
| 15 | index 984f0bcf9cc6..1c61910c1526 100644 | ||
| 16 | --- a/consul/prepared_query/template.go | ||
| 17 | +++ b/consul/prepared_query/template.go | ||
| 18 | @@ -116,8 +116,8 @@ func (ct *CompiledTemplate) Render(name string) (*structs.PreparedQuery, error) | ||
| 19 | // from multiple goroutines. | ||
| 20 | var matches []string | ||
| 21 | if ct.re != nil { | ||
| 22 | - re := ct.re.Copy() | ||
| 23 | - matches = re.FindStringSubmatch(name) | ||
| 24 | + // re := ct.re.Copy() | ||
| 25 | + matches = ct.re.FindStringSubmatch(name) | ||
| 26 | } | ||
| 27 | |||
| 28 | // Create a safe match function that can't fail at run time. It will | ||
| 29 | -- | ||
| 30 | 2.4.0.53.g8440f74 | ||
| 31 | |||
diff --git a/recipes-connectivity/consul/files/consul.service b/recipes-connectivity/consul/files/consul.service new file mode 100644 index 0000000..c9494e3 --- /dev/null +++ b/recipes-connectivity/consul/files/consul.service | |||
| @@ -0,0 +1,12 @@ | |||
| 1 | [Unit] | ||
| 2 | Description=Launch Consul Cluster | ||
| 3 | |||
| 4 | [Service] | ||
| 5 | Restart=on-failure | ||
| 6 | RestartSec=45 | ||
| 7 | ExecStartPre=/bin/sh -c 'echo -ne \'{"data_dir":\"/var/consul","server":true,"bootstrap_expect":1,\' > /tmp/consul.conf' | ||
| 8 | ExecStartPre=/bin/sh -c 'echo -ne \'"bind_addr":"\'$(ifconfig br0 | awk \'/inet addr/{print substr($2,6)}\')\'"}\' >> /tmp/consul.conf' | ||
| 9 | ExecStart=/usr/bin/consul agent -config-file=/tmp/consul.conf | ||
| 10 | |||
| 11 | [Install] | ||
| 12 | WantedBy=multi-user.target | ||
