diff --git a/meta-oe/recipes-extended/etcd/etcd/etcd-existing.conf b/meta-oe/recipes-extended/etcd/etcd/etcd-existing.conf new file mode 100644 index 0000000000..fc32cc8084 --- /dev/null +++ b/meta-oe/recipes-extended/etcd/etcd/etcd-existing.conf @@ -0,0 +1,37 @@ +# This is the configuration file to start the etcd server with +# existing cluster configuration in the data directory. + +# Initial cluster state ('new' or 'existing'). +ETCD_INITIAL_CLUSTER_STATE='existing' + +# Path to the data directory. +ETCD_DATA_DIR='/var/lib/etcd' + +# Time (in milliseconds) of a heartbeat interval. +ETCD_HEARTBEAT_INTERVAL=100 + +# Time (in milliseconds) for an election to timeout. +ETCD_ELECTION_TIMEOUT=1000 + +# List of comma separated URLs to listen on for peer traffic. +ETCD_LISTEN_PEER_URLS=http://localhost:2380 + +# List of comma separated URLs to listen on for client traffic. +ETCD_LISTEN_CLIENT_URLS=http://localhost:2379 + +# List of this member's peer URLs to advertise to the rest of the cluster. +# The URLs needed to be a comma-separated list. +ETCD_INITIAL_ADVERTISE_PEER_URLS=http://localhost:2380 + +# List of this member's client URLs to advertise to the public. +# The URLs needed to be a comma-separated list. +ETCD_ADVERTISE_CLIENT_URLS=http://localhost:2379 + +# Enable info-level logging for etcd. +ETCD_LOG_LEVEL='info' + +# Specify 'stdout' or 'stderr' to skip journald logging even when running under systemd. +ETCD_LOG_OUTPUTS='default' + +# etcd is not officially supported on arm64 +ETCD_UNSUPPORTED_ARCH='arm' diff --git a/meta-oe/recipes-extended/etcd/etcd/etcd.service b/meta-oe/recipes-extended/etcd/etcd/etcd.service new file mode 100644 index 0000000000..782ef4ef09 --- /dev/null +++ b/meta-oe/recipes-extended/etcd/etcd/etcd.service @@ -0,0 +1,15 @@ +[Unit] +Description=etcd key-value store +Documentation=https://github.com/etcd-io/etcd +After=network-online.target local-fs.target remote-fs.target time-sync.target +Wants=network-online.target local-fs.target remote-fs.target time-sync.target +ConditionPathExists=/var/lib/etcd/member + +[Service] +Type=notify +EnvironmentFile=/etc/etcd.d/etcd-existing.conf +ExecStart=/usr/bin/etcd +Restart=always + +[Install] +WantedBy=multi-user.target diff --git a/meta-oe/recipes-extended/etcd/etcd_3.5.7.bb b/meta-oe/recipes-extended/etcd/etcd_3.5.7.bb index 346b305f2c..c01b03e4af 100644 --- a/meta-oe/recipes-extended/etcd/etcd_3.5.7.bb +++ b/meta-oe/recipes-extended/etcd/etcd_3.5.7.bb @@ -8,6 +8,8 @@ SRC_URI = " \ git://github.com/etcd-io/etcd;branch=release-3.5;protocol=https \ file://0001-xxhash-bump-to-v2.1.2.patch;patchdir=src/${GO_IMPORT} \ file://0001-test_lib.sh-remove-gobin-requirement-during-build.patch;patchdir=src/${GO_IMPORT} \ + file://etcd.service \ + file://etcd-existing.conf \ " SRCREV = "215b53cf3b48ee761f4c40908b3874b2e5e95e9f" @@ -22,7 +24,7 @@ RDEPENDS:${PN}-dev = " \ export GO111MODULE="on" -inherit go +inherit go systemd pkgconfig # Go based binaries do not handle being stripped INHIBIT_PACKAGE_STRIP = "1" @@ -49,10 +51,19 @@ go_do_compile:prepend() { chmod u+w -R ${WORKDIR}/build/pkg/mod } +REQUIRED_DISTRO_FEATURES = "systemd" +SYSTEMD_PACKAGES = "${PN}" +SYSTEMD_SERVICE:${PN}:append = " etcd.service" + do_install:append() { install -d ${D}${bindir}/ install -m 0755 ${D}/usr/lib/go/src/go.etcd.io/etcd/v3/bin/etcd ${D}${bindir} install -m 0755 ${D}/usr/lib/go/src/go.etcd.io/etcd/v3/bin/etcdctl ${D}${bindir} install -m 0755 ${D}/usr/lib/go/src/go.etcd.io/etcd/v3/bin/etcdutl ${D}${bindir} + install -m 0644 ${WORKDIR}/etcd-existing.conf -D -t ${D}${sysconfdir}/etcd.d + install -d ${D}${systemd_system_unitdir} + install -m 0644 ${WORKDIR}/etcd.service ${D}${systemd_system_unitdir}/ } +FILES:${PN}:append = " ${sysconfdir}/etcd.d/etcd-existing.conf" +