Revert "Add Cassandra Reaper Spec in Mariner. (#3178)" (#3416)

This reverts commit e286a93b30.
This commit is contained in:
Pawel Winogrodzki 2022-07-22 15:20:58 -07:00 committed by GitHub
parent 12a1e71281
commit 1c324f2f78
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 1 additions and 417 deletions

File diff suppressed because one or more lines are too long

View File

@ -2047,7 +2047,6 @@
"python-sphinxcontrib-websupport",
"python-yamlloader",
"R",
"reaper",
"rocksdb",
"rubygem-asciidoctor",
"rubygem-bigdecimal",

View File

@ -1,63 +0,0 @@
# Downloading files during build time is not allowed
# apply pre-downloaded reaper-build-cache which is
# required for reaper to build based on maven pom.xml
# Generate reaper-build-cache when ever update to latest version.
# Cassandra reaper caches entails below items:
# a. /root/.m2 - maven build cache
# b. /root/.npm - npm caches
# c. /root/.cache - bower caches
# d. /usr/local - Current nodejs/npm versions cause build to fail due to incompatible node-sass/node-gyp version dependencies added in reaper's sources - package.json. This requires downgraded nodejs version of 14.18.0 and corresponding npm v6 that needs to be installed.
# e. <sources>/src/ui/bower_components - bower artifacts built in sources directory
# f. <sources>/src/ui/node_modules - npm-install related modeuls built in sources directory
1. Boot up Mariner Core 2.0
2. Refer to reaper spec and install all build required dependenices.
3. Download reaper sources and extract under /usr/src
4. cd /usr/src/cassandra-reaper-<version>
5. Run "export JAVA_HOME=/usr/lib/jvm/msopenjdk-11"
6. Run "export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/lib/jvm/msopenjdk-11/lib/jli"
7. Run "sudo npm install -g bower"
8. Run "sudo npm install -g n"
9. Run "sudo n 14.18.0"
10. One can check versions for bower/node/npm.
11. Run "mvn -DskipTests clean package"
12. Once build is completed successfully, take build cache as below
13. cd /root
14. sudo tar --sort=name \
--mtime="2021-04-26 00:00Z" \
--owner=0 --group=0 --numeric-owner \
--pax-option=exthdr.name=%d/PaxHeaders/%f,delete=atime,delete=ctime \
-cf reaper-bower-cache-<version>.tar.gz .cache
14. sudo tar --sort=name \
--mtime="2021-04-26 00:00Z" \
--owner=0 --group=0 --numeric-owner \
--pax-option=exthdr.name=%d/PaxHeaders/%f,delete=atime,delete=ctime \
-cf reaper-m2-cache-<version>.tar.gz .m2
16. sudo tar --sort=name \
--mtime="2021-04-26 00:00Z" \
--owner=0 --group=0 --numeric-owner \
--pax-option=exthdr.name=%d/PaxHeaders/%f,delete=atime,delete=ctime \
-cf reaper-npm-cache-<version>.tar.gz .npm
17. cd /usr/src/cassandra-reaper-<version>/src/ui
18. sudo tar --sort=name \
--mtime="2021-04-26 00:00Z" \
--owner=0 --group=0 --numeric-owner \
--pax-option=exthdr.name=%d/PaxHeaders/%f,delete=atime,delete=ctime \
-cf reaper-bower-components-<version>.tar.gz bower_components
19. sudo tar --sort=name \
--mtime="2021-04-26 00:00Z" \
--owner=0 --group=0 --numeric-owner \
--pax-option=exthdr.name=%d/PaxHeaders/%f,delete=atime,delete=ctime \
-cf reaper-srcui-node-modules-<version>.tar.gz node_modules
20. cd /usr/local/lib
21. sudo tar --sort=name \
--mtime="2021-04-26 00:00Z" \
--owner=0 --group=0 --numeric-owner \
--pax-option=exthdr.name=%d/PaxHeaders/%f,delete=atime,delete=ctime \
-cf reaper-local-lib-node-modules-<version>.tar.gz node_modules
22. cd /usr/local/
23. sudo tar --sort=name \
--mtime="2021-04-26 00:00Z" \
--owner=0 --group=0 --numeric-owner \
--pax-option=exthdr.name=%d/PaxHeaders/%f,delete=atime,delete=ctime \
-cf reaper-local-<version>.tar.gz n
24. Update latest build cache signatures in reaper signature json and update to sources server.

View File

@ -1,12 +0,0 @@
{
"Signatures": {
"cassandra-reaper-3.1.1.tar.gz": "6efe52195ad4a3c3b7a6f928bafa60d3df011709d9bc918e717033bf86d724d8",
"reaper-bower-cache-3.1.1.tar.gz": "a8532fe1d28f6d2c99a5e0d08b17b85465617931d49c7d27450ed328e59c0b08",
"reaper-bower-components-3.1.1.tar.gz": "213f956916bbfaa02eb880bd9e17d0ab41985987e7b95a925fde5f7c2e8bd44f",
"reaper-local-lib-node-modules-3.1.1.tar.gz": "8daf9a8726a85ca31b024a5bab60a357fe927f670908955cdd9b106bf9c6bd60",
"reaper-local-n-3.1.1.tar.gz": "23704dcc1a2be5384eb5bddc4db07ce0f23c619fe6e3083e2efa075329d33a92",
"reaper-m2-cache-3.1.1.tar.gz": "14103df496c6bfd1bf2690b45e6082e3411872f7332f03a68cf5d8e28fc6b27f",
"reaper-npm-cache-3.1.1.tar.gz": "1fd8fd9438ef682cccceaaf49d0e65ec50eb7145c20f27253a3521c731e79585",
"reaper-srcui-node-modules-3.1.1.tar.gz": "182d346f73d29544cabec090877f1a63ead6914371cd3db11aac5e5f4ec3c5dc"
}
}

View File

@ -1,167 +0,0 @@
%global debug_package %{nil}
%define srcdir cassandra-%{name}-%{version}
%define bower_components reaper-bower-components-%{version}.tar.gz
%define srcui_node_modules reaper-srcui-node-modules-%{version}.tar.gz
%define bower_cache reaper-bower-cache-%{version}.tar.gz
%define maven_cache reaper-m2-cache-%{version}.tar.gz
%define npm_cache reaper-npm-cache-%{version}.tar.gz
%define local_lib_node_modules reaper-local-lib-node-modules-%{version}.tar.gz
%define local_n reaper-local-n-%{version}.tar.gz
Name: reaper
Version: 3.1.1
Release: 1%{?dist}
Summary: Reaper for cassandra is a tool for running Apache Cassandra repairs against single or multi-site clusters.
License: ASL 2.0
Distribution: Mariner
Vendor: Microsoft Corporation
Group: Applications/System
URL: https://cassandra-reaper.io/
Source0: https://github.com/thelastpickle/cassandra-reaper/archive/refs/tags/%{version}.tar.gz#/cassandra-reaper-%{version}.tar.gz
# Building reaper from sources downloads artifacts related to maven/node/etc. These artifacts need to be downloaded as caches in order to build reaper using maven in offline mode.
# Below is the list of cached sources.
# bower-components downloaded under src/ui
# NOTE: USE "reaper_build_caches.sh" TO RE-GENERATE BUILD CACHES.
Source1: %{bower_components}
# node_modules downloaded under src/ui
Source2: %{srcui_node_modules}
# bower cache
Source3: %{bower_cache}
# m2 cache
Source4: %{maven_cache}
# npm cache
Source5: %{npm_cache}
# node_modules downloaded to /usr/local/lib
Source6: %{local_lib_node_modules}
# v14.18.0 node binary under /usr/local
Source7: %{local_n}
BuildRequires: git
BuildRequires: javapackages-tools
BuildRequires: maven
BuildRequires: msopenjdk-11
BuildRequires: nodejs
BuildRequires: python3
Requires(pre): %{_sbindir}/groupadd
Requires(pre): %{_sbindir}/useradd
Provides: reaper = %{version}-%{release}
%description
Cassandra reaper is an open source tool that aims to schedule and orchestrate repairs of Apache Cassandra clusters.
%prep
%autosetup -n cassandra-%{name}-%{version}
%build
export JAVA_HOME="%{_libdir}/jvm/msopenjdk-11"
export LD_LIBRARY_PATH="%{_libdir}/jvm/msopenjdk-11/lib/jli"
pushd "$HOME"
echo "Installing bower cache."
tar xf %{SOURCE3}
echo "Installing m2 cache."
tar xf %{SOURCE4}
echo "Installing npm cache"
tar xf %{SOURCE5}
popd
# Reaper build fails when trying to install node-sass@4.9.0/node-gyp@3.8.0 and build node native addons using mariner default node@16.14.2/npm@8.5.0.
# ERROR:
# npm ERR! Building: /usr/bin/node /usr/src/mariner/BUILD/cassandra-reaper-3.1.1/src/ui/node_modules/node-gyp/bin/node-gyp.js rebuild --verbose --libsass_ext= --libsass_cflags= --libsass_l dflags= --libsass_library=" - python/python2 not found. node-gyp 3.8.0 does not support python3.
# Howerver, using node@14.18.0/npm@6.14.15 does not cause this issue.
# There is no way to remove node-sass dependency from builds, hence we need to install local node/npm and caches to be able to build reaper.
# NOTE: This issue was also faced on Fedora Fc37 when trying to build reaper.
# NOTE: node-sass seems to be deprecated, the spec and build process will be modified once reaper removes its dependencies as well.
pushd %{_prefix}/local
echo "Installing node_modules"
tar xf %{SOURCE6} -C ./lib/
echo "Installing n version 14.18.0"
tar xf %{SOURCE7}
echo "Creating symlinks under local/bin"
cd ./bin
ln -sf ../lib/node_modules/bower/bin/bower bower
ln -sf ../lib/node_modules/npm/bin/npm-cli.js npm
ln -sf ../lib/node_modules/npm/bin/npx-cli.js npx
cp ../n/versions/node/14.18.0/bin/node .
ls -al
popd
cd %{_builddir}/%{srcdir}
echo "Installing src caches"
pushd ./src/ui
echo "Installing bower_components"
tar xf %{SOURCE1}
echo "Installing npm_modules"
tar fx %{SOURCE2}
popd
# Building using maven in offline mode.
mvn -DskipTests package -o
%install
mkdir -p %{buildroot}%{_datadir}/cassandra-reaper
mkdir -p %{buildroot}%{_prefix}/local/bin
mkdir -p %{buildroot}%{_sysconfdir}/init.d
mkdir -p %{buildroot}%{_sysconfdir}/cassandra-reaper
mkdir -p %{buildroot}%{_sysconfdir}/cassandra-reaper/configs
mkdir -p %{buildroot}%{_sysconfdir}/bash_completion.d
mkdir -p %{buildroot}/lib/systemd/system/
mkdir -p %{buildroot}%{_datadir}/licenses/reaper
cd %{_builddir}/%{srcdir}/src/packaging
cp resource/cassandra-reaper.yaml %{buildroot}%{_sysconfdir}/cassandra-reaper/
cp resource/cassandra-reaper*.yaml %{buildroot}%{_sysconfdir}/cassandra-reaper/configs
cp resource/cassandra-reaper-ssl.properties %{buildroot}%{_sysconfdir}/cassandra-reaper/configs
cp ../server/target/cassandra-reaper-%{version}.jar %{buildroot}%{_datadir}/cassandra-reaper
cp bin/* %{buildroot}%{_prefix}/local/bin/
cp etc/bash_completion.d/spreaper %{buildroot}%{_sysconfdir}/bash_completion.d/
cp debian/reaper.init %{buildroot}%{_sysconfdir}/init.d/cassandra-reaper
cp debian/cassandra-reaper.service %{buildroot}/lib/systemd/system/cassandra-reaper.service
chmod 7555 %{buildroot}%{_sysconfdir}/init.d/cassandra-reaper
cp %{_builddir}/%{srcdir}/LICENSE.txt %{buildroot}%{_datadir}/licenses/reaper
%pre
if id -u reaper; then
echo "skipping user"
else
%{_sbindir}/groupadd reaper || true
%{_sbindir}/useradd -r -g reaper -s /sbin/nologin -d %{_localstatedir}/empty -c 'cassandra-reaper' reaper || true
fi
%post
mkdir -p %{_localstatedir}/log/cassandra-reaper/
touch %{_localstatedir}/log/cassandra-reaper/reaper.log
chown -R reaper: %{_localstatedir}/log/cassandra-reaper/
%files
%license LICENSE.txt
%{_sysconfdir}/cassandra-reaper/cassandra-reaper.yaml
%{_sysconfdir}/cassandra-reaper/configs/cassandra-reaper-astra.yaml
%{_sysconfdir}/cassandra-reaper/configs/cassandra-reaper-cassandra-sidecar.yaml
%{_sysconfdir}/cassandra-reaper/configs/cassandra-reaper-cassandra-ssl.yaml
%{_sysconfdir}/cassandra-reaper/configs/cassandra-reaper-cassandra.yaml
%{_sysconfdir}/cassandra-reaper/configs/cassandra-reaper-memory.yaml
%{_sysconfdir}/cassandra-reaper/configs/cassandra-reaper.yaml
%{_sysconfdir}/cassandra-reaper/configs/cassandra-reaper-ssl.properties
%{_datadir}/cassandra-reaper/cassandra-reaper-%{version}.jar
%{_prefix}/local/bin/cassandra-reaper
%{_prefix}/local/bin/spreaper
%{_sysconfdir}/bash_completion.d/spreaper
%{_sysconfdir}/init.d/cassandra-reaper
/lib/systemd/system/cassandra-reaper.service
%changelog
* Mon Jun 13 2022 Sumedh Sharma <sumsharma@microsoft.com> - 3.1.1-1
- Original version for CBL-Mariner (license: MIT)
- License verified

View File

@ -1,163 +0,0 @@
#! /bin/bash
set -euo pipefail
# NOTE: EXECUTING with id=0 (root) CAUSES REAPER BUILD TO FAIL.
if [[ $(id -u) -eq 0 ]]; then
echo "Must run script as non-root user!" >&2
exit 1
fi
# Cassandra reaper version for which to generate build caches.
# (a) Modify VERSION="x.x.x" in script.
# (b) Pass arguments to command line: ./reaper_build_caches.sh 3.1.1
VERSION="3.1.1"
if [ $# -ge 1 ]; then
VERSION=$1
fi
echo "Building Cassandra cache for version '$VERSION'."
# URL to download the sources to build
SOURCE_URL="https://github.com/thelastpickle/cassandra-reaper/archive/refs/tags/${VERSION}.tar.gz"
# Build cache names
BOWER_COMPONENTS="reaper-bower-components-${VERSION}.tar.gz"
SRC_UI_NODE_MODULES="reaper-srcui-node-modules-${VERSION}.tar.gz"
BOWER_CACHE="reaper-bower-cache-${VERSION}.tar.gz"
MAVEN_CACHE="reaper-m2-cache-${VERSION}.tar.gz"
NPM_CACHE="reaper-npm-cache-${VERSION}.tar.gz"
LOCAL_LIB_NODE_MODULES="reaper-local-lib-node-modules-${VERSION}.tar.gz"
LOCAL_N="reaper-local-n-${VERSION}.tar.gz"
tempDir=$(mktemp -d)
function cleanup {
exit_code=$?
set +e
if [[ -n $tempDir ]];then
rm -Rf $tempDir
echo "Deleted $tempDir."
fi
exit $exit_code
}
trap cleanup EXIT SIGINT SIGTERM
reaperCacheDir=${tempDir}/reaper_caches
homeCacheDir=${tempDir}/cache
mkdir -p ${reaperCacheDir}
mkdir -p ${homeCacheDir}
function checkInternet {
sudo tdnf install -y nc
nc -z 8.8.8.8 443
if [ $? -eq 0 ]; then
echo "Online."
else
echo "Offline, reaper needs internet connectivity to download and build cache."
exit 1
fi
}
function installNodeModules {
echo "Installing node modules."
sudo tdnf install -y nodejs
npm config set cache "$homeCacheDir/.npm" --global
# Default node/npm versions in Mariner fails to build dependency node module versions due to known
# incompatibilities.
# Backward compatible with node@v14.18.0
# When installing modules via npm to default prefix='/usr/local' in mariner, the permissions for 'others'
# is incoorectly set that causes 'which' to still point to older path, as access/newfstatat fail with -ENOPERM
# Setting a new global npm folder for fixing permission issues.
# (works well with id=0, but reaper build will fail.)
mkdir --mode 0777 $homeCacheDir/.npm-global
npm config set prefix "$homeCacheDir/.npm-global"
export PATH="$homeCacheDir/.npm-global/bin":$PATH
npm install -g n
export N_PREFIX="$homeCacheDir/.npm-global"
n 14.18.0
export XDG_CACHE_HOME=$homeCacheDir/.cache
npm install -g bower
# Clear bash hash tables for node/npm paths
hash -r
bower -v
node -v
npm -v
}
function buildReaperSources {
pushd $tempDir
sudo tdnf install -y wget
wget $SOURCE_URL -O reaper.tar.gz
tar -xf reaper.tar.gz
cd cassandra-reaper-${VERSION}
export JAVA_HOME="/usr/lib/jvm/msopenjdk-11"
export LD_LIBRARY_PATH="/usr/lib/jvm/msopenjdk-11/lib/jli"
echo "Building reaper in online mode."
mvn -DskipTests package
popd
}
function createCacheTars {
echo "Creating build caches."
pushd ${homeCacheDir}
echo "creating bower_cache tar..."
tar -cf ${BOWER_CACHE} .cache
mv ${BOWER_CACHE} ${reaperCacheDir}
echo "creating maven_cache tar..."
tar -cf ${MAVEN_CACHE} .m2
mv ${MAVEN_CACHE} ${reaperCacheDir}
echo "creating npm_cache tar..."
tar -cf ${NPM_CACHE} .npm
mv ${NPM_CACHE} ${reaperCacheDir}
popd
pushd ${tempDir}/cassandra-reaper-${VERSION}/src/ui
echo "creating bower_components tar..."
tar -cf ${BOWER_COMPONENTS} bower_components
mv ${BOWER_COMPONENTS} ${reaperCacheDir}
echo "creating node_modules tar..."
tar -cf ${SRC_UI_NODE_MODULES} node_modules
mv ${SRC_UI_NODE_MODULES} ${reaperCacheDir}
popd
pushd $homeCacheDir/.npm-global/lib
echo "creating local_lib_node_modules tar..."
tar -cf ${LOCAL_LIB_NODE_MODULES} node_modules
mv ${LOCAL_LIB_NODE_MODULES} ${reaperCacheDir}
popd
pushd $homeCacheDir/.npm-global
echo "creating local node tar..."
tar -cf ${LOCAL_N} n
mv ${LOCAL_N} ${reaperCacheDir}
popd
}
echo "Generate cassandra reaper build caches..."
checkInternet
echo "Installing msopenjdk-11."
sudo tdnf install -y msopenjdk-11
echo "Installing maven modules."
sudo tdnf install -y maven
export MAVEN_OPTS="-Dmaven.repo.local=$homeCacheDir/.m2/repository"
installNodeModules
buildReaperSources
createCacheTars
mkdir "$HOME/reaper_caches"
cp -a ${reaperCacheDir} "$HOME/reaper_caches"
echo "Copied cache tars to $HOME/reaper_caches/ .Exiting."

View File

@ -22819,16 +22819,6 @@
}
}
},
{
"component": {
"type": "other",
"other": {
"name": "reaper",
"version": "3.1.1",
"downloadUrl": "https://github.com/thelastpickle/cassandra-reaper/archive/refs/tags/3.1.1.tar.gz"
}
}
},
{
"component": {
"type": "other",