cluster.scm 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264
  1. ;;; GNU Guix --- Functional package management for GNU
  2. ;;; Copyright © 2018 Sou Bunnbu <iyzsong@member.fsf.org>
  3. ;;; Copyright © 2018, 2020 Tobias Geerinckx-Rice <me@tobias.gr>
  4. ;;; Copyright © 2019 Andrew Miloradovsky <andrew@interpretmath.pw>
  5. ;;; Copyright © 2020 Marius Bakke <marius@gnu.org>
  6. ;;; Copyright © 2021 Dion Mendel <guix@dm9.info>
  7. ;;;
  8. ;;; This file is part of GNU Guix.
  9. ;;;
  10. ;;; GNU Guix is free software; you can redistribute it and/or modify it
  11. ;;; under the terms of the GNU General Public License as published by
  12. ;;; the Free Software Foundation; either version 3 of the License, or (at
  13. ;;; your option) any later version.
  14. ;;;
  15. ;;; GNU Guix is distributed in the hope that it will be useful, but
  16. ;;; WITHOUT ANY WARRANTY; without even the implied warranty of
  17. ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  18. ;;; GNU General Public License for more details.
  19. ;;;
  20. ;;; You should have received a copy of the GNU General Public License
  21. ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
  22. (define-module (gnu packages cluster)
  23. #:use-module ((guix licenses) #:prefix license:)
  24. #:use-module (guix build-system gnu)
  25. #:use-module (guix download)
  26. #:use-module (guix git-download)
  27. #:use-module (guix packages)
  28. #:use-module (gnu packages autotools)
  29. #:use-module (gnu packages check)
  30. #:use-module (gnu packages flex)
  31. #:use-module (gnu packages gettext)
  32. #:use-module (gnu packages libevent)
  33. #:use-module (gnu packages linux)
  34. #:use-module (gnu packages pkg-config)
  35. #:use-module (gnu packages sphinx)
  36. #:use-module (gnu packages sqlite)
  37. #:use-module (gnu packages texinfo)
  38. #:use-module (gnu packages tls))
  39. (define-public drbd-utils
  40. (package
  41. (name "drbd-utils")
  42. (version "9.15.1")
  43. (source (origin
  44. (method url-fetch)
  45. ;; Older releases are moved to /archive. List it first because in
  46. ;; practice this URL will be the most current (e.g. time-machine).
  47. (uri (list (string-append "https://www.linbit.com/downloads/drbd"
  48. "/utils/archive/drbd-utils-" version
  49. ".tar.gz")
  50. (string-append "https://www.linbit.com/downloads/drbd"
  51. "/utils/drbd-utils-" version ".tar.gz")))
  52. (sha256
  53. (base32
  54. "1q92bwnprqkkj9iy6fxcybcfpxvvjw5clis0igrbxqnq869kwp1i"))
  55. (modules '((guix build utils)))
  56. (snippet
  57. '(begin
  58. (substitute* "scripts/global_common.conf"
  59. ;; Do not participate in usage count survey by default.
  60. (("usage-count: yes")
  61. "usage-count: no"))
  62. (substitute* "scripts/Makefile.in"
  63. ;; Install the Pacemaker resource agents to the libdir,
  64. ;; regardless of what the OCF specification says...
  65. (("\\$\\(DESTDIR\\)/usr/lib")
  66. "$(DESTDIR)$(LIBDIR)"))
  67. (substitute* "configure"
  68. ;; Use a sensible default udev rules directory.
  69. (("default_udevdir=/lib/udev")
  70. "default_udevdir='${prefix}/lib/udev'"))
  71. #t))))
  72. (build-system gnu-build-system)
  73. (arguments
  74. `(#:configure-flags '(;; Do not install sysv or systemd init scripts.
  75. "--with-initscripttype=none"
  76. ;; Use the pre-built manual pages present in release
  77. ;; tarballs instead of generating them from scratch.
  78. "--with-prebuiltman"
  79. ;; Disable support for DRBD 8.3 as it is only for
  80. ;; Linux-Libre versions < 3.8. 8.4 is the latest
  81. ;; kernel driver as of Linux 5.7.
  82. "--without-83support"
  83. "--sysconfdir=/etc"
  84. "--localstatedir=/var")
  85. #:test-target "test"
  86. #:phases
  87. (modify-phases %standard-phases
  88. (add-after 'patch-generated-file-shebangs 'patch-documentation
  89. (lambda _
  90. ;; The preceding phase misses some Makefiles with unusual file
  91. ;; names, so we handle those here.
  92. (for-each patch-makefile-SHELL (find-files "documentation/common"
  93. "^Makefile"))
  94. #t))
  95. (add-before 'configure 'use-absolute-/lib/drbd
  96. (lambda* (#:key outputs #:allow-other-keys)
  97. (let ((out (assoc-ref outputs "out")))
  98. ;; Look for auxiliary executables below exec_prefix instead
  99. ;; of assuming /lib/drbd (see TODO comment in the file).
  100. (substitute* "user/v9/drbdtool_common.c"
  101. (("\"/lib/drbd\"")
  102. (string-append "\"" out "/lib/drbd\"")))
  103. #t)))
  104. (add-after 'configure 'adjust-installation-directories
  105. (lambda _
  106. ;; Do not attempt to create /etc or /var.
  107. (substitute* "scripts/Makefile"
  108. (("\\$\\(DESTDIR\\)\\$\\(sysconfdir\\)")
  109. "$(DESTDIR)$(prefix)$(sysconfdir)"))
  110. (substitute* "user/v84/Makefile"
  111. (("\\$\\(DESTDIR\\)\\$\\(localstatedir\\)")
  112. "$(DESTDIR)$(prefix)$(localstatedir)")
  113. (("\\$\\(DESTDIR\\)/lib/drbd")
  114. "$(DESTDIR)$(prefix)/lib/drbd"))
  115. (substitute* "user/v9/Makefile"
  116. (("\\$\\(DESTDIR\\)\\$\\(localstatedir\\)")
  117. "$(DESTDIR)$(prefix)$(localstatedir)")
  118. (("\\$\\(DESTDIR\\)\\$\\(DRBD_LIB_DIR\\)")
  119. "$(DESTDIR)$(prefix)$(DRBD_LIB_DIR)"))
  120. #t)))))
  121. (native-inputs
  122. `(("clitest" ,clitest)
  123. ("flex" ,flex)
  124. ("udev" ,eudev))) ;just to satisfy a configure check
  125. (home-page "https://www.linbit.com/drbd/")
  126. (synopsis "Replicate block devices between machines")
  127. (description
  128. "@acronym{DRBD, Distributed Replicated Block Device} is a software-based,
  129. shared-nothing, replicated storage solution mirroring the content of block
  130. devices (hard disks, partitions, logical volumes etc.) over any network
  131. connection. This package contains the userland utilities.")
  132. (license license:gpl2+)))
  133. (define-public keepalived
  134. (package
  135. (name "keepalived")
  136. (version "2.0.19")
  137. (source (origin
  138. (method url-fetch)
  139. (uri (string-append
  140. "http://www.keepalived.org/software/keepalived-"
  141. version ".tar.gz"))
  142. (sha256
  143. (base32
  144. "19scrrjsxw5g914d5ka352445blaq77dk2vm4vxabijvfra88bqf"))))
  145. (build-system gnu-build-system)
  146. (arguments
  147. '(#:phases
  148. (modify-phases %standard-phases
  149. (add-after 'build 'build-info
  150. (lambda _
  151. (invoke "make" "-C" "doc" "texinfo")
  152. ;; Put images in a subdirectory as recommended by 'texinfo'.
  153. (install-file "doc/source/images/software_design.png"
  154. "doc/build/texinfo/keepalived-figures")
  155. (substitute* "doc/build/texinfo/keepalived.texi"
  156. (("@image\\{software_design,")
  157. "@image{keepalived-figures/software_design,"))
  158. (invoke "make" "-C" "doc/build/texinfo")))
  159. (add-after 'install 'install-info
  160. (lambda* (#:key outputs #:allow-other-keys)
  161. (let* ((out (assoc-ref outputs "out"))
  162. (infodir (string-append out "/share/info")))
  163. (install-file "doc/build/texinfo/keepalived.info" infodir)
  164. (install-file "doc/source/images/software_design.png"
  165. (string-append infodir "/keepalived-figures"))
  166. #t))))))
  167. (native-inputs
  168. `(("pkg-config" ,pkg-config)
  169. ("python-sphinx" ,python-sphinx)
  170. ("texinfo" ,texinfo)))
  171. (inputs
  172. `(("openssl" ,openssl)
  173. ("libnfnetlink" ,libnfnetlink)
  174. ("libnl" ,libnl)))
  175. (home-page "https://www.keepalived.org/")
  176. (synopsis "Load balancing and high-availability frameworks")
  177. (description
  178. "Keepalived provides frameworks for both load balancing and high
  179. availability. The load balancing framework relies on the Linux Virtual
  180. Server (@dfn{IPVS}) kernel module. High availability is achieved by the Virtual
  181. Redundancy Routing Protocol (@dfn{VRRP}). Each Keepalived framework can be used
  182. independently or together to provide resilient infrastructures.")
  183. (license license:gpl2+)))
  184. (define-public libraft
  185. (package
  186. (name "libraft")
  187. (version "0.10.1")
  188. (home-page "https://github.com/canonical/raft")
  189. (source (origin
  190. (method git-fetch)
  191. (uri (git-reference (url home-page)
  192. (commit (string-append "v" version))))
  193. (file-name (git-file-name name version))
  194. (sha256
  195. (base32
  196. "18idj53vnl5fx1ja1zlp8kiwmdxgwjxsi88rdql0pbh0484b92a3"))))
  197. (arguments '(#:configure-flags '("--enable-uv")
  198. #:phases
  199. (modify-phases %standard-phases
  200. (add-after 'unpack 'disable-failing-tests
  201. (lambda _
  202. (substitute* "Makefile.am"
  203. ((".*test_uv_append.c.*") ""))
  204. #t)))))
  205. (inputs
  206. `(("libuv" ,libuv)))
  207. (native-inputs
  208. `(("autoconf" ,autoconf)
  209. ("automake" ,automake)
  210. ("gettext" ,gettext-minimal)
  211. ("libtool" ,libtool)
  212. ("pkg-config" ,pkg-config)))
  213. (build-system gnu-build-system)
  214. (synopsis "C implementation of the Raft consensus protocol")
  215. (description "The library has modular design: its core part implements only
  216. the core Raft algorithm logic, in a fully platform independent way. On top of
  217. that, a pluggable interface defines the I/O implementation for networking
  218. (send/receive RPC messages) and disk persistence (store log entries and
  219. snapshots).")
  220. (license license:asl2.0)))
  221. (define-public libdqlite
  222. (package
  223. (name "libdqlite")
  224. (version "1.7.0")
  225. (home-page "https://github.com/canonical/dqlite")
  226. (source (origin
  227. (method git-fetch)
  228. (uri (git-reference (url home-page)
  229. (commit (string-append "v" version))))
  230. (file-name (git-file-name name version))
  231. (sha256
  232. (base32
  233. "15cg8yl3n7lcg0qyg0byciz8v6y200ghmzzkwpdzggy3m6c168wl"))))
  234. (arguments
  235. '(#:phases
  236. (modify-phases %standard-phases
  237. (add-after 'unpack 'disable-failing-tests
  238. (lambda _
  239. (substitute* "Makefile.am"
  240. ;; Test client/query sometimes fails.
  241. ;; The actual tested asserts succeed, but there appears to be a
  242. ;; race condition when tearing down the test server.
  243. ((".*test_client.c.*") "")))))))
  244. (native-inputs
  245. `(("autoconf" ,autoconf)
  246. ("automake" ,automake)
  247. ("libtool" ,libtool)
  248. ("pkg-config" ,pkg-config)))
  249. (inputs
  250. `(("libraft" ,libraft)
  251. ("libuv" ,libuv)))
  252. (propagated-inputs
  253. `(("sqlite" ,sqlite))) ; dqlite.h includes sqlite3.h
  254. (build-system gnu-build-system)
  255. (synopsis "Distributed SQLite")
  256. (description "dqlite is a C library that implements an embeddable and replicated
  257. SQL database engine with high-availability and automatic failover.")
  258. (license license:lgpl3)))