diff --git a/bz1350875-disaster-recovery-with-copies.patch b/bz1350875-disaster-recovery-with-copies.patch new file mode 100644 index 0000000..ca64473 --- /dev/null +++ b/bz1350875-disaster-recovery-with-copies.patch @@ -0,0 +1,56 @@ +From 7ad700a716c2122c3b6db6677a6f717919b88926 Mon Sep 17 00:00:00 2001 +From: Jan Chaloupka +Date: Tue, 2 May 2017 09:56:02 +0200 +Subject: [PATCH] bz1350875-disaster-recovery-with-copies: + +--- + etcdctl/ctlv2/command/backup_command.go | 19 +++++++++++++++++-- + 1 file changed, 17 insertions(+), 2 deletions(-) + +diff --git a/etcdctl/ctlv2/command/backup_command.go b/etcdctl/ctlv2/command/backup_command.go +index feda4b1..e77791f 100644 +--- a/etcdctl/ctlv2/command/backup_command.go ++++ b/etcdctl/ctlv2/command/backup_command.go +@@ -18,6 +18,7 @@ import ( + "fmt" + "log" + "path/filepath" ++ "strconv" + "time" + + "github.com/coreos/etcd/etcdserver/etcdserverpb" +@@ -40,6 +41,9 @@ func NewBackupCommand() cli.Command { + cli.StringFlag{Name: "wal-dir", Value: "", Usage: "Path to the etcd wal dir"}, + cli.StringFlag{Name: "backup-dir", Value: "", Usage: "Path to the backup dir"}, + cli.StringFlag{Name: "backup-wal-dir", Value: "", Usage: "Path to the backup wal dir"}, ++ cli.BoolFlag{Name: "keep-cluster-id", Usage: "Do not rewrite the cluster id"}, ++ cli.StringFlag{Name: "node-id", Value: "", Usage: "Use custom node id instead of a random value"}, ++ + }, + Action: handleBackup, + } +@@ -99,8 +103,19 @@ func handleBackup(c *cli.Context) error { + var metadata etcdserverpb.Metadata + pbutil.MustUnmarshal(&metadata, wmetadata) + idgen := idutil.NewGenerator(0, time.Now()) +- metadata.NodeID = idgen.Next() +- metadata.ClusterID = idgen.Next() ++ explicitNodeId := c.String("node-id") ++ if explicitNodeId != "" { ++ metadata.NodeID, err = strconv.ParseUint(explicitNodeId, 16, 64) ++ if err != nil { ++ log.Fatal(err) ++ } ++ } else { ++ metadata.NodeID = idgen.Next() ++ } ++ keepClusterId := c.Bool("keep-cluster-id") ++ if !keepClusterId { ++ metadata.ClusterID = idgen.Next() ++ } + + neww, err := wal.Create(destWAL, pbutil.MustMarshal(&metadata)) + if err != nil { +-- +2.7.4 + diff --git a/etcd-3ac81f3.tar.gz b/etcd-3ac81f3.tar.gz new file mode 100644 index 0000000..ee09279 Binary files /dev/null and b/etcd-3ac81f3.tar.gz differ diff --git a/etcd.conf b/etcd.conf new file mode 100644 index 0000000..e7275d3 --- /dev/null +++ b/etcd.conf @@ -0,0 +1,69 @@ +#[Member] +#ETCD_CORS="" +ETCD_DATA_DIR="/var/lib/etcd/default.etcd" +#ETCD_WAL_DIR="" +#ETCD_LISTEN_PEER_URLS="http://localhost:2380" +ETCD_LISTEN_CLIENT_URLS="http://localhost:2379" +#ETCD_MAX_SNAPSHOTS="5" +#ETCD_MAX_WALS="5" +ETCD_NAME="default" +#ETCD_SNAPSHOT_COUNT="100000" +#ETCD_HEARTBEAT_INTERVAL="100" +#ETCD_ELECTION_TIMEOUT="1000" +#ETCD_QUOTA_BACKEND_BYTES="0" +#ETCD_MAX_REQUEST_BYTES="1572864" +#ETCD_GRPC_KEEPALIVE_MIN_TIME="5s" +#ETCD_GRPC_KEEPALIVE_INTERVAL="2h0m0s" +#ETCD_GRPC_KEEPALIVE_TIMEOUT="20s" +# +#[Clustering] +#ETCD_INITIAL_ADVERTISE_PEER_URLS="http://localhost:2380" +ETCD_ADVERTISE_CLIENT_URLS="http://localhost:2379" +#ETCD_DISCOVERY="" +#ETCD_DISCOVERY_FALLBACK="proxy" +#ETCD_DISCOVERY_PROXY="" +#ETCD_DISCOVERY_SRV="" +#ETCD_INITIAL_CLUSTER="default=http://localhost:2380" +#ETCD_INITIAL_CLUSTER_TOKEN="etcd-cluster" +#ETCD_INITIAL_CLUSTER_STATE="new" +#ETCD_STRICT_RECONFIG_CHECK="true" +#ETCD_ENABLE_V2="true" +# +#[Proxy] +#ETCD_PROXY="off" +#ETCD_PROXY_FAILURE_WAIT="5000" +#ETCD_PROXY_REFRESH_INTERVAL="30000" +#ETCD_PROXY_DIAL_TIMEOUT="1000" +#ETCD_PROXY_WRITE_TIMEOUT="5000" +#ETCD_PROXY_READ_TIMEOUT="0" +# +#[Security] +#ETCD_CERT_FILE="" +#ETCD_KEY_FILE="" +#ETCD_CLIENT_CERT_AUTH="false" +#ETCD_TRUSTED_CA_FILE="" +#ETCD_AUTO_TLS="false" +#ETCD_PEER_CERT_FILE="" +#ETCD_PEER_KEY_FILE="" +#ETCD_PEER_CLIENT_CERT_AUTH="false" +#ETCD_PEER_TRUSTED_CA_FILE="" +#ETCD_PEER_AUTO_TLS="false" +# +#[Logging] +#ETCD_DEBUG="false" +#ETCD_LOG_PACKAGE_LEVELS="" +#ETCD_LOG_OUTPUT="default" +# +#[Unsafe] +#ETCD_FORCE_NEW_CLUSTER="false" +# +#[Version] +#ETCD_VERSION="false" +#ETCD_AUTO_COMPACTION_RETENTION="0" +# +#[Profiling] +#ETCD_ENABLE_PPROF="false" +#ETCD_METRICS="basic" +# +#[Auth] +#ETCD_AUTH_TOKEN="simple" diff --git a/etcd.service b/etcd.service new file mode 100644 index 0000000..afe51ea --- /dev/null +++ b/etcd.service @@ -0,0 +1,18 @@ +[Unit] +Description=Etcd Server +After=network.target +After=network-online.target +Wants=network-online.target + +[Service] +Type=notify +WorkingDirectory=/var/lib/etcd/ +EnvironmentFile=-/etc/etcd/etcd.conf +User=etcd +# set GOMAXPROCS to number of processors +ExecStart=/bin/bash -c "GOMAXPROCS=$(nproc) /usr/bin/etcd --name=\"${ETCD_NAME}\" --data-dir=\"${ETCD_DATA_DIR}\" --listen-client-urls=\"${ETCD_LISTEN_CLIENT_URLS}\"" +Restart=on-failure +LimitNOFILE=65536 + +[Install] +WantedBy=multi-user.target diff --git a/etcd.spec b/etcd.spec new file mode 100644 index 0000000..001e809 --- /dev/null +++ b/etcd.spec @@ -0,0 +1,278 @@ +%global with_debug 1 + +%if 0%{?with_debug} +%global _dwz_low_mem_die_limit 0 +%else +%global debug_package %{nil} +%endif + +%if ! 0%{?gobuild:1} +%define gobuild(o:) go build -buildmode pie -tags=rpm_crashtraceback -ldflags "${LDFLAGS:-} -B 0x$(head -c20 /dev/urandom|od -An -tx1|tr -d ' \\n') -extldflags '-Wl,-z,relro,-z,now'" -a -v -x %{?**}; +%endif + +%global provider github +%global provider_tld com +%global project coreos +%global repo etcd +# https://github.com/coreos/etcd +%global provider_prefix %{provider}.%{provider_tld}/%{project}/%{repo} +%global import_path %{provider_prefix} +%global commit 3ac81f3ae2264b21871128a170c78f8a9b2a3187 +%global shortcommit %(c=%{commit}; echo ${c:0:7}) + +%global system_name etcd +%global man_version 3.2.21 + +Name: etcd +Version: 3.2.21 +Release: 2%{?dist} +Summary: A highly-available key value store for shared configuration +License: ASL 2.0 +URL: https://%{provider_prefix} +Source0: https://%{provider_prefix}/archive/%{commit}/%{repo}-%{shortcommit}.tar.gz +Source1: %{system_name}.service +Source2: %{system_name}.conf +Source3: man-%{man_version}.tar.gz +Patch3: bz1350875-disaster-recovery-with-copies.patch +Patch4: expand-etcd-arch-validation.patch + +# e.g. el6 has ppc64 arch without gcc-go, so EA tag is required +ExclusiveArch: %{?go_arches:%{go_arches}}%{!?go_arches:x86_64 aarch64 ppc64le s390x} +# If go_compiler is not set to 1, there is no virtual provide. Use golang instead. +#BuildRequires: %{?go_compiler:compiler(go-compiler)}%{!?go_compiler:golang} +BuildRequires: compiler(go-compiler) + +Obsoletes: etcd3 < 3.0.15 +Provides: etcd3 = %{version}-%{release} + +BuildRequires: libpcap-devel + +BuildRequires: systemd + +Requires(pre): shadow-utils +Requires(post): systemd +Requires(preun): systemd +Requires(postun): systemd + +%description +A highly-available key value store for shared configuration. + +%{?enable_gotoolset7} + +%prep +%setup -q -n man-%{man_version} -T -b 3 +%setup -q -n %{repo}-%{commit} +mkdir -p man/man1 +cp ../man-%{man_version}/*.1 man/man1/. + +# move content of vendor under Godeps as has been so far +mkdir -p Godeps/_workspace/src +mv cmd/vendor/* Godeps/_workspace/src/. + +%patch3 -p1 +%patch4 -p1 + +%build +mkdir -p src/github.com/coreos +ln -s ../../../ src/github.com/coreos/etcd + +export GOPATH=$(pwd):$(pwd)/Godeps/_workspace:%{gopath} + +export LDFLAGS="-X %{import_path}/version.GitSHA=%{shortcommit} -B 0x$(head -c20 /dev/urandom|od -An -tx1|tr -d ' \n')" + +%gobuild -o bin/%{system_name} %{import_path} +%gobuild -o bin/%{system_name}ctl %{import_path}/%{system_name}ctl + +%install +install -D -p -m 0755 bin/%{system_name} %{buildroot}%{_bindir}/%{system_name} +install -D -p -m 0755 bin/%{system_name}ctl %{buildroot}%{_bindir}/%{system_name}ctl +install -D -p -m 0644 %{SOURCE1} %{buildroot}%{_unitdir}/%{system_name}.service +install -d -m 0755 %{buildroot}%{_sysconfdir}/%{system_name} +install -m 644 -t %{buildroot}%{_sysconfdir}/%{system_name} %{SOURCE2} + +# install manpages +install -d %{buildroot}%{_mandir}/man1 +install -p -m 644 man/man1/* %{buildroot}%{_mandir}/man1 + +# And create /var/lib/etcd +install -d -m 0755 %{buildroot}%{_sharedstatedir}/%{system_name} + +%pre +getent group %{system_name} >/dev/null || groupadd -r %{system_name} +getent passwd %{system_name} >/dev/null || useradd -r -g %{system_name} -d %{_sharedstatedir}/%{system_name} \ + -s /sbin/nologin -c "etcd user" %{system_name} + +%post +%systemd_post %{system_name}.service + +%preun +%systemd_preun %{system_name}.service + +%postun +%systemd_postun %{system_name}.service + +#define license tag if not already defined +%{!?_licensedir:%global license %doc} + +%files +%license LICENSE +%doc *.md +%doc glide.lock +%config(noreplace) %{_sysconfdir}/%{system_name} +%{_bindir}/%{system_name} +%{_bindir}/%{system_name}ctl +%dir %attr(-,%{system_name},%{system_name}) %{_sharedstatedir}/%{system_name} +%{_unitdir}/%{system_name}.service +%{_mandir}/man1/*.1* + +%changelog +* Wed Mar 06 2019 Lon Hohberger - 3.2.21-2 +- Rebuild for new architectures + +* Mon Jun 04 2018 Jan Chaloupka - 3.2.21-1 +- Update to 3.2.21 + resolves: #1585787 + +* Tue Apr 17 2018 Jan Chaloupka - 3.2.18-1 +- Update to 3.2.18 + resolves: #1568389 + +* Tue Feb 06 2018 Jan Chaloupka - 3.2.15-2 +- Rebuild for 7.5.0 + resolves: #1542526 + +* Mon Jan 29 2018 Jan Chaloupka - 3.2.15-1 +- Update to 3.2.15 + resolves: #1539670 + resolves: #1378706 + +* Wed Dec 06 2017 Jan Chaloupka - 3.2.11-1 +- Update to 3.2.11 + related: #1514612 + +* Tue Nov 21 2017 Jan Chaloupka - 3.2.10-1 +- Update to 3.2.10 + resolves: #1514612 + +* Mon Nov 20 2017 Jan Chaloupka - 3.2.9-3 +- Bump man-pages tarball + related: #1510480 + +* Mon Nov 20 2017 Jan Chaloupka - 3.2.9-2 +- Fix Synopsis of etcdctl3 man pages + related: #1510480 + +* Tue Nov 07 2017 Jan Chaloupka - 3.2.9-1 +- Update to 3.2.9 + resolves: #1510480 +- Generate etcd and etcdctl man-pages + resolves: #1444336 + +* Fri Sep 29 2017 Jan Chaloupka - 3.2.7-2 +- Rebuild with correct hardening flags + resolves: #1420783 + +* Tue Sep 19 2017 Jan Chaloupka - 3.2.7-1 +- Update to 3.2.7 + resolves: #1493165 + +* Tue Aug 08 2017 Jan Chaloupka - 3.2.5-1 +- Update to 3.2.5 + resolves: #1479371 + +* Mon Jun 12 2017 Jan Chaloupka - 3.1.9-2 +- Build for secondary architectures as well + +* Fri Jun 09 2017 Scott Dodson - 3.1.9-1 +- Update to 3.1.9 + resolves: #1458941 + +* Tue Jun 06 2017 Jan Chaloupka - 3.1.8-1 +- Update to 3.1.8 + resolves: #1459122 + +* Tue May 02 2017 Jan Chaloupka - 3.1.7-1 +- Update to 3.1.7 + resolves: #1447235 + +* Tue Apr 04 2017 Yaakov Selkowitz - 3.1.3-2 +- Circumvent runtime check of officially supported architectures + resolves: #1434973 + +* Tue Mar 21 2017 Jan Chaloupka - 3.1.3-1 +- Update to 3.1.3 + resolves: #1434364 + +* Mon Feb 27 2017 Josh Boyer - 3.1.0-2.1 +- Rebuild rebase on all architectures + +* Tue Feb 21 2017 Jan Chaloupka - 3.1.0-2 +- Apply "add --keep-cluster-id and --node-id to 'etcdctl backup'" + from extras-rhel-7.2 branch + resolves: #1350875 + +* Thu Feb 16 2017 Josh Boyer - 3.1.0-1.1 +- Rebuild rebase on all architectures + +* Mon Feb 06 2017 Jan Chaloupka - 3.1.0-1 +- Update to 3.1.0 + etcdctl-top removed by upstream + resolves: #1416440 + +* Fri Jan 20 2017 d.marlin +- Build for all archs (adding ppc64le and s390x) + +* Tue Jan 10 2017 d.marlin +- Add aarch64 to ExclusiveArch list. + +* Mon Jan 09 2017 d.marlin +- Correct 'link' warning for -X flag. + +* Thu Dec 01 2016 jchaloup - 3.0.15-1 +- Update to 3.0.15 + Obsolete etcd3 < 3.0.15 + +* Fri Nov 18 2016 jchaloup - 3.0.14-3 +- Build with debug-info subpackage +- Until etcd3 obsoletes etcd it conflicts with it + +* Tue Nov 15 2016 Avesh Agarwal - 3.0.14-2 +- Resolves: #1395359 etcd3 should not obsolete etcd + +* Mon Nov 07 2016 jchaloup - 3.0.14-1 +- Update to v3.0.14 + related: #1386963 + +* Thu Oct 27 2016 jchaloup - 3.0.13-1 +- Update to v3.0.13 + related: #1386963 + +* Fri Oct 21 2016 jchaloup - 3.0.12-3 +- etcdctl: fix migrate in outputing client.Node to json + resolves: #1386963 + +* Tue Oct 18 2016 jchaloup - 3.0.12-2 +- Replace etcd with etcd3 when upgrading + resolves: #1384161 + +* Thu Oct 13 2016 jchaloup - 3.0.12-1 +- Update to v3.0.12 + +* Thu Oct 06 2016 jchaloup - 3.0.10-1 +- Update to v3.0.10 + +* Fri Sep 23 2016 jchaloup - 3.0.3-2 +- Extend etcd.conf with new flags + resolves: #1378706 + +* Fri Jul 22 2016 jchaloup - 3.0.2-1 +- Update to v3.0.3 + related: #1347499 + +* Tue Jul 12 2016 jchaloup - 3.0.2-1 +- Update to v3.0.2 + related: #1347499 + +* Sun May 15 2016 jchaloup - 3.0.0-0.1.beta0 +- Build etcd3 v3.0.0-beta0 for AH 7.3 + resolves: #1347499 diff --git a/expand-etcd-arch-validation.patch b/expand-etcd-arch-validation.patch new file mode 100644 index 0000000..d6c4fba --- /dev/null +++ b/expand-etcd-arch-validation.patch @@ -0,0 +1,30 @@ +From b3e78645c1ffa84bcde511c90df4e3dde652c3fa Mon Sep 17 00:00:00 2001 +From: Jan Chaloupka +Date: Tue, 8 Aug 2017 15:01:04 +0200 +Subject: [PATCH] expand etcd arch validation + +--- + etcdmain/etcd.go | 7 +++++++ + 1 file changed, 7 insertions(+) + +diff --git a/etcdmain/etcd.go b/etcdmain/etcd.go +index 2f7f00d..61553d4 100644 +--- a/etcdmain/etcd.go ++++ b/etcdmain/etcd.go +@@ -396,6 +396,13 @@ func checkSupportArch() { + if runtime.GOARCH == "amd64" || runtime.GOARCH == "ppc64le" { + return + } ++ ++ if runtime.GOARCH == "arm64" || runtime.GOARCH == "s390x" { ++ plog.Warningf("Running etcd on %s architecture is experimental.", runtime.GOARCH) ++ plog.Warningf("Please report any bugs you encounter: https://bugzilla.redhat.com/") ++ return ++ } ++ + if env, ok := os.LookupEnv("ETCD_UNSUPPORTED_ARCH"); ok && env == runtime.GOARCH { + plog.Warningf("running etcd on unsupported architecture %q since ETCD_UNSUPPORTED_ARCH is set", env) + return +-- +2.7.5 + diff --git a/man-3.2.21.tar.gz b/man-3.2.21.tar.gz new file mode 100644 index 0000000..9b8121f Binary files /dev/null and b/man-3.2.21.tar.gz differ