diff options
| author | ojayanth <ojayanth@in.ibm.com> | 2023-05-12 05:02:37 -0500 |
|---|---|---|
| committer | Khem Raj <raj.khem@gmail.com> | 2023-05-12 10:27:35 -0700 |
| commit | 9400a94fc11a1b174513620d4964349422a135a7 (patch) | |
| tree | bdd9630666009f4eff7fa0a2d6d9091e5233af18 | |
| parent | d5b57d8505fa1f556d987f3ec119124ab7e0eb81 (diff) | |
| download | meta-openembedded-9400a94fc11a1b174513620d4964349422a135a7.tar.gz | |
etcd: systemd unit support to start existing etcd node
Added etcd service and configuration file support to start etcd service
with existing cluster configuration.
Change-Id: Ia52bbf20fd1951aa76184da54af94231d2324888
Signed-off-by: ojayanth <ojayanth@in.ibm.com>
Signed-off-by: Khem Raj <raj.khem@gmail.com>
| -rw-r--r-- | meta-oe/recipes-extended/etcd/etcd/etcd-existing.conf | 37 | ||||
| -rw-r--r-- | meta-oe/recipes-extended/etcd/etcd/etcd.service | 15 | ||||
| -rw-r--r-- | meta-oe/recipes-extended/etcd/etcd_3.5.7.bb | 13 |
3 files changed, 64 insertions, 1 deletions
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 @@ | |||
| 1 | # This is the configuration file to start the etcd server with | ||
| 2 | # existing cluster configuration in the data directory. | ||
| 3 | |||
| 4 | # Initial cluster state ('new' or 'existing'). | ||
| 5 | ETCD_INITIAL_CLUSTER_STATE='existing' | ||
| 6 | |||
| 7 | # Path to the data directory. | ||
| 8 | ETCD_DATA_DIR='/var/lib/etcd' | ||
| 9 | |||
| 10 | # Time (in milliseconds) of a heartbeat interval. | ||
| 11 | ETCD_HEARTBEAT_INTERVAL=100 | ||
| 12 | |||
| 13 | # Time (in milliseconds) for an election to timeout. | ||
| 14 | ETCD_ELECTION_TIMEOUT=1000 | ||
| 15 | |||
| 16 | # List of comma separated URLs to listen on for peer traffic. | ||
| 17 | ETCD_LISTEN_PEER_URLS=http://localhost:2380 | ||
| 18 | |||
| 19 | # List of comma separated URLs to listen on for client traffic. | ||
| 20 | ETCD_LISTEN_CLIENT_URLS=http://localhost:2379 | ||
| 21 | |||
| 22 | # List of this member's peer URLs to advertise to the rest of the cluster. | ||
| 23 | # The URLs needed to be a comma-separated list. | ||
| 24 | ETCD_INITIAL_ADVERTISE_PEER_URLS=http://localhost:2380 | ||
| 25 | |||
| 26 | # List of this member's client URLs to advertise to the public. | ||
| 27 | # The URLs needed to be a comma-separated list. | ||
| 28 | ETCD_ADVERTISE_CLIENT_URLS=http://localhost:2379 | ||
| 29 | |||
| 30 | # Enable info-level logging for etcd. | ||
| 31 | ETCD_LOG_LEVEL='info' | ||
| 32 | |||
| 33 | # Specify 'stdout' or 'stderr' to skip journald logging even when running under systemd. | ||
| 34 | ETCD_LOG_OUTPUTS='default' | ||
| 35 | |||
| 36 | # etcd is not officially supported on arm64 | ||
| 37 | 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 @@ | |||
| 1 | [Unit] | ||
| 2 | Description=etcd key-value store | ||
| 3 | Documentation=https://github.com/etcd-io/etcd | ||
| 4 | After=network-online.target local-fs.target remote-fs.target time-sync.target | ||
| 5 | Wants=network-online.target local-fs.target remote-fs.target time-sync.target | ||
| 6 | ConditionPathExists=/var/lib/etcd/member | ||
| 7 | |||
| 8 | [Service] | ||
| 9 | Type=notify | ||
| 10 | EnvironmentFile=/etc/etcd.d/etcd-existing.conf | ||
| 11 | ExecStart=/usr/bin/etcd | ||
| 12 | Restart=always | ||
| 13 | |||
| 14 | [Install] | ||
| 15 | 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 = " \ | |||
| 8 | git://github.com/etcd-io/etcd;branch=release-3.5;protocol=https \ | 8 | git://github.com/etcd-io/etcd;branch=release-3.5;protocol=https \ |
| 9 | file://0001-xxhash-bump-to-v2.1.2.patch;patchdir=src/${GO_IMPORT} \ | 9 | file://0001-xxhash-bump-to-v2.1.2.patch;patchdir=src/${GO_IMPORT} \ |
| 10 | file://0001-test_lib.sh-remove-gobin-requirement-during-build.patch;patchdir=src/${GO_IMPORT} \ | 10 | file://0001-test_lib.sh-remove-gobin-requirement-during-build.patch;patchdir=src/${GO_IMPORT} \ |
| 11 | file://etcd.service \ | ||
| 12 | file://etcd-existing.conf \ | ||
| 11 | " | 13 | " |
| 12 | 14 | ||
| 13 | SRCREV = "215b53cf3b48ee761f4c40908b3874b2e5e95e9f" | 15 | SRCREV = "215b53cf3b48ee761f4c40908b3874b2e5e95e9f" |
| @@ -22,7 +24,7 @@ RDEPENDS:${PN}-dev = " \ | |||
| 22 | 24 | ||
| 23 | export GO111MODULE="on" | 25 | export GO111MODULE="on" |
| 24 | 26 | ||
| 25 | inherit go | 27 | inherit go systemd pkgconfig |
| 26 | 28 | ||
| 27 | # Go based binaries do not handle being stripped | 29 | # Go based binaries do not handle being stripped |
| 28 | INHIBIT_PACKAGE_STRIP = "1" | 30 | INHIBIT_PACKAGE_STRIP = "1" |
| @@ -49,10 +51,19 @@ go_do_compile:prepend() { | |||
| 49 | chmod u+w -R ${WORKDIR}/build/pkg/mod | 51 | chmod u+w -R ${WORKDIR}/build/pkg/mod |
| 50 | } | 52 | } |
| 51 | 53 | ||
| 54 | REQUIRED_DISTRO_FEATURES = "systemd" | ||
| 55 | SYSTEMD_PACKAGES = "${PN}" | ||
| 56 | SYSTEMD_SERVICE:${PN}:append = " etcd.service" | ||
| 57 | |||
| 52 | do_install:append() { | 58 | do_install:append() { |
| 53 | install -d ${D}${bindir}/ | 59 | install -d ${D}${bindir}/ |
| 54 | install -m 0755 ${D}/usr/lib/go/src/go.etcd.io/etcd/v3/bin/etcd ${D}${bindir} | 60 | install -m 0755 ${D}/usr/lib/go/src/go.etcd.io/etcd/v3/bin/etcd ${D}${bindir} |
| 55 | install -m 0755 ${D}/usr/lib/go/src/go.etcd.io/etcd/v3/bin/etcdctl ${D}${bindir} | 61 | install -m 0755 ${D}/usr/lib/go/src/go.etcd.io/etcd/v3/bin/etcdctl ${D}${bindir} |
| 56 | install -m 0755 ${D}/usr/lib/go/src/go.etcd.io/etcd/v3/bin/etcdutl ${D}${bindir} | 62 | install -m 0755 ${D}/usr/lib/go/src/go.etcd.io/etcd/v3/bin/etcdutl ${D}${bindir} |
| 63 | install -m 0644 ${WORKDIR}/etcd-existing.conf -D -t ${D}${sysconfdir}/etcd.d | ||
| 64 | install -d ${D}${systemd_system_unitdir} | ||
| 65 | install -m 0644 ${WORKDIR}/etcd.service ${D}${systemd_system_unitdir}/ | ||
| 57 | } | 66 | } |
| 58 | 67 | ||
| 68 | FILES:${PN}:append = " ${sysconfdir}/etcd.d/etcd-existing.conf" | ||
| 69 | |||
