summaryrefslogtreecommitdiff
blob: 681492e5929ea2d4173a9de7e38bfeedcebdbd95 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
# Copyright 1999-2020 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2

EAPI=6

MY_PV="3.2/202004222203"

inherit linux-info user

DESCRIPTION="NoSQL data store using the seastar framework, compatible with Apache Cassandra"
HOMEPAGE="https://scylladb.com/"
SRC_URI="http://scratch.scylladb.com/lubos/numberly-cql-npq/scylla-package.tar.gz -> ${P}-package.tar.gz http://downloads.scylladb.com/relocatable/unstable/branch-${MY_PV}/scylla-python3-package.tar.gz -> ${P}-python3.tar.gz http://downloads.scylladb.com/relocatable/unstable/branch-${MY_PV}/scylla-tools-package.tar.gz -> ${P}-tools.tar.gz http://downloads.scylladb.com/relocatable/unstable/branch-${MY_PV}/scylla-jmx-package.tar.gz -> ${P}-jmx.tar.gz"

KEYWORDS="~amd64"
LICENSE="AGPL-3"
SLOT="0"
IUSE="doc"
RESTRICT="strip test"

RDEPEND="
	!app-admin/scylla-jmx
	!app-admin/scylla-tools
	!dev-db/scylla
"
DEPEND="${RDEPEND}
	>=sys-kernel/linux-headers-3.5
"

# Discussion about kernel configuration:
# https://groups.google.com/forum/#!topic/scylladb-dev/qJu2zrryv-s
CONFIG_CHECK="~NUMA_BALANCING ~SYN_COOKIES ~TRANSPARENT_HUGEPAGE"
ERROR_NUMA_BALANCING="${PN} recommends support for Memory placement aware NUMA scheduler (NUMA_BALANCING)."
ERROR_SYN_COOKIES="${PN} recommends support for TCP syncookie (SYN_COOKIES)."
ERROR_TRANSPARENT_HUGEPAGE="${PN} recommends support for Transparent Hugepage (TRANSPARENT_HUGEPAGE)."

# NOTE: maybe later depending on upstream energy, support DPDK
# For DPDK, removed HUGETLBFS PROC_PAGE_MONITOR UIO_PCI_GENERIC in favor of VFIO
# CONFIG_CHECK="~NUMA_BALANCING ~SYN_COOKIES ~TRANSPARENT_HUGEPAGE ~VFIO"
# ERROR_VFIO="${PN} running with DPDK recommends support for Non-Privileged userspace driver framework (VFIO)."

DOCS=( README.md NOTICE.txt SCYLLA-PRODUCT-FILE SCYLLA-RELEASE-FILE SCYLLA-RELOCATABLE-FILE SCYLLA-VERSION-FILE )
PATCHES=( )
S=${WORKDIR}

pkg_setup() {
	linux-info_pkg_setup
	enewgroup scylla
	enewuser scylla -1 -1 /var/lib/${PN} scylla
}

src_unpack() {
	for pkg in package python3 tools jmx;
	do
		mkdir "${pkg}" || die
		pushd "${pkg}" || die
		unpack ${P}-${pkg}.tar.gz || die
		find . -type f -name "*.pyc" -delete
		popd || die
	done
}

install_package() {
	pushd package

	bash install.sh --root "${D}" --sysconfdir /etc/default || die

	for x in /var/lib/scylla /var/lib/scylla/{data,commitlog,hints,coredump,hints,view_hints} /var/lib/scylla-housekeeping /var/log/scylla; do
		keepdir "${x}"
		fowners scylla:scylla "${x}"
	done

	insinto /etc/sudoers.d
	newins "${FILESDIR}"/scylla.sudoers scylla

	insinto /etc/rsyslog.d
	doins "${FILESDIR}/10-scylla.conf"

	newinitd "${FILESDIR}/scylla-server.initd" scylla-server
	newconfd "${FILESDIR}/scylla-server.confd" scylla-server

	popd
}

install_python3() {
	pushd python3
	bash install.sh --root "${D}" || die
	popd
}

install_jmx() {
	pushd jmx
	# fix symlink runtime error on scylla-jmx script
	# * scylla-jmx is not available for oracle-jdk-bin-1.8 on x86_64
	# * IMPORTANT: some Java tools are not available on some VMs on some architectures
	sed -e 's@"$LOCATION_SCRIPTS"/symlinks/scylla-jmx@/usr/bin/java@g' -i scylla-jmx || die
	bash install.sh --root "${D}" --sysconfdir /etc/default || die
	newinitd "${FILESDIR}/scylla-jmx.initd" scylla-jmx
	newconfd "${FILESDIR}/scylla-jmx.confd" scylla-jmx
	popd
}

install_tools() {
	pushd tools
	find . -type f -name '*.bat' -delete || die
	for e in nodetool cqlsh sstableverify sstableutil sstableupgrade sstablescrub scylla-sstableloader debug-cql; do
		sed -e "2i export CASSANDRA_INCLUDE=/opt/scylladb/bin/cassandra.in.sh" -i "bin/${e}" || die
		sed -e "2i export CASSANDRA_HOME=/opt/scylladb/" -i "bin/${e}" || die
	done
	insinto /opt/scylladb
	for f in bin conf doc lib pylib tools; do
		doins -r "${f}"
	done
	for e in nodetool cqlsh sstableverify sstableutil sstableupgrade sstablescrub scylla-sstableloader debug-cql; do
		fperms +x "/opt/scylladb/bin/${e}"
		dosym "/opt/scylladb/bin/${e}" "/usr/bin/${e}"
		sed -e "2i export CASSANDRA_INCLUDE=/opt/scylladb/bin/cassandra.in.sh" -i "bin/${e}" || die
		sed -e "2i export CASSANDRA_HOME=/opt/scylladb/" -i "bin/${e}" || die
	done
	popd
}

src_install() {
	install_package
	install_python3
	install_tools
	install_jmx
}

pkg_postinst() {
	elog "You should run 'emerge --config dev-db/scylla' to finalize your Scylla installation."
}

pkg_config() {
	elog "Running 'scylla_setup'..."
	scylla_setup
}