-
Notifications
You must be signed in to change notification settings - Fork 8
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(cassandra.in.sh): Refactor script for readability and consistency #17
Conversation
This commit refactors the cassandra.in.sh script to improve readability and consistency. Changes include adjusting indentation, modifying the path for jar files, and streamlining the JVM version and vendor detection. The changes aim to enhance maintainability and adherence to coding standards. But mainly including the path correction for looking the files up: ```diff - SCYLLA_HOME="$(dirname "$0")/../../../scylla" + SCYLLA_HOME="$(dirname "$0")/../.." ``` Signed-off-by: Daniel Boll <[email protected]>
Steps to Compile Cassandra-Stress from Source1. Clone the Repository from ScyllaDB's GitHubStart by cloning the gh repo clone scylladb/cassandra-stress This command will create a local copy of the repository in your current directory. 2. Install Apache AntApache Ant is a Java-based build tool required to compile Cassandra-Stress. To keep this process as platform-independent as possible, we’ll use asdf, a version manager that allows you to manage multiple runtime versions easily. Although using
3. Set Up the Java VersionCassandra-Stress requires Java to run, and it's important to ensure the correct version is used. We will use
4. Build the Project Using AntWith Ant and Java set up, you can now compile the Cassandra-Stress tool from the source.
5. Copy a Configuration FileBefore running Cassandra-Stress, you need a configuration file. You can use the provided example configuration: cp ./tools/cqlstress-example.yaml conf/scylla.yaml This copies the example configuration file to the appropriate directory, renaming it to 6. Run Cassandra-StressFinally, you can run Cassandra-Stress using the following command: ./tools/bin/cassandra-stress help write |
Before merge it, would be good to have a |
I see that's a Daniel network in play here :) |
tools/bin/cassandra.in.sh
Outdated
@@ -15,11 +15,11 @@ | |||
# limitations under the License. | |||
|
|||
if [ "$SCYLLA_HOME" = "" ]; then | |||
SCYLLA_HOME="$(dirname "$0")/../../../scylla" | |||
SCYLLA_HOME="$(dirname "$0")/../.." |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We need to make sure it doesn't breaks the docker usage
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As the Dockerfile
already provide a SCYLLA_HOME probably when running this it won't override, but I'll take a look.
ENV SCYLLA_HOME=/scylla-tools-java
What can I say, bring talented contributors closer to scylladb is my job :p |
This commit enhances the way SCYLLA_HOME is determined by searching upwards in the directory tree until a directory with a 'conf' subdirectory is found. If no such directory is found, an error is thrown. Additionally, the paths for jar files have been updated to reflect the correct locations. This ensures that all necessary jar files are included in the CLASSPATH. Signed-off-by: Daniel Boll <[email protected]>
This commit replaces the previous method of generating the CLASSPATH variable in the cassandra.in.sh script. Instead of using two separate for loops to add .jar files from different directories to the CLASSPATH, it now uses the find command to locate all .jar files in the specified directories and adds them to the CLASSPATH in one line. Signed-off-by: Daniel Boll <[email protected]>
CLASSPATH="${CLASSPATH}:$(find "$SCYLLA_HOME/lib" "$SCYLLA_HOME/build/lib" "$SCYLLA_HOME/tools" -name '*.jar' -print 2>/dev/null | paste -sd ":" -)" | ||
CLASSPATH="${CLASSPATH#:}" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Albeit odd this is to allow running from ./build, ./tools and docker
gh repo clone daniel-boll/cassandra-stress -- --depth 1 --branch fix/scripts-path
cd cassandra-stress
ant -Drelease=true artifacts
docker buildx build --build-arg='CASSANDRA_STRESS_VERSION=3.12.0' -t scylla-daniel:cassandra-stress .
Now with that the three ways
./tools/bin/cassandra-stress
./build/dist/tools/bin/cassandra-stress
docker run scylla-daniel:cassandra-stress
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
This commit refactors the cassandra.in.sh script to improve readability
and consistency. Changes include adjusting indentation, modifying the
path for jar files, and streamlining the JVM version and vendor
detection. The changes aim to enhance maintainability and adherence to
coding standards.
But mainly including the path correction for looking the files up:
Signed-off-by: Daniel Boll [email protected]