Skip to content

CASSANDRA-18035: Add quick start development guide and ant targets for local docker development #1996

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

Open
wants to merge 1 commit into
base: trunk
Choose a base branch
from

Conversation

pauloricardomg
Copy link
Contributor

No description provided.

@pauloricardomg pauloricardomg changed the title CASSANDRA-18035: Add "Hello World" docker-based quick start guide CASSANDRA-18035: Add quick start development guide and ant targets for local docker development Nov 16, 2022
@pauloricardomg pauloricardomg force-pushed the CASSANDRA-18035 branch 3 times, most recently from c934c6b to 0ccf661 Compare November 30, 2022 18:57
…velopment

Patch by Paulo Motta; Reviewed by X for CASSANDRA-18035
@@ -11,16 +11,18 @@ For more information, see http://cassandra.apache.org/[the Apache Cassandra web

Issues should be reported on https://issues.apache.org/jira/projects/CASSANDRA/issues/[The Cassandra Jira].
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@pauloricardomg this whole file should be called "README.adoc". "asc" suffix does not make the document rendered in IDEA automatically.

-----

[start=2]
2. On IntelliJ IDEA startup screen, open the the directory of your Cassandra project (/path/to/cassandra). It may take a little bit until the IDE loads all dependencies and indexes the project. Please refer to the troubleshooting items below if you face any issues when loading Cassandra on IntelliJ IDEA:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

double "the the"

* ⛔ If a `JDK11 is missing` error message pops up, click `configure` > `Add new JDK` and point to the installed JDK, usually located in `/usr/lib/jvm/<jdk>` in Debian-based systems or `/Library/Java/JavaVirtualMachines/<jdk>` on macOS.

[start=3]
3. In order to check that the project is loaded orrectly, open the test class https://github.com/apache/cassandra/blob/trunk/test/distributed/org/apache/cassandra/distributed/test/RepairTest.java[test/distributed/org/apache/cassandra/distributed/test/RepairTest.java] and attempt to run this test suite by right-clicking in the test class name (`RepairTest`) and selecting the option `Run RepairTest` or using the shortcut `Ctrl+Shift+F10` after clicking on the class name.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

missing "c" in "orrectly"

@@ -0,0 +1,33 @@
#!/bin/bash
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

shouldnt this be #!/bin/sh ?

fi

if [ $( docker ps -a -f name=cassandra-test | wc -l ) -eq 2 ]; then
CONTAINER=`docker rm --force cassandra-test`
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IDEA says Use $(...) notation instead of legacy backticked ....

## Create network if does not exist
docker network create cassandra-test 2>/dev/null || true

CONTAINER_ID=`docker run --rm --name cassandra-test --network cassandra-test -d apache/cassandra-test`
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IDEA says: Use $(...) notation instead of legacy backticked

fi

# Check if container is already running
if [ $( docker ps -a -f name=cassandra-test | wc -l ) -eq 2 ]; then
Copy link
Contributor

@smiklosovic smiklosovic Dec 20, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IDEA says: Quote this to prevent word splitting. Probably should be something like this:

if [ "$(docker ps -a -f name=cassandra-test | wc -l)" -eq 2 ]; then

@@ -0,0 +1,64 @@
#!/bin/bash
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

#!/bin/sh ?

EXPOSE 7000 7001 7199 9042 9160

# Container is healthy when JMX port is up
HEALTHCHECK CMD /usr/bin/nc localhost -z 7199 || exit 1
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This might be replaced by nodetool status returning 0 exit code. The fact that this port is up does not necessarily mean that nodetool status will be successful as port is open but the node is still booting anyway under the hood.

}

if [ "$1" = 'cassandra' ]; then
: ${CASSANDRA_RPC_ADDRESS='0.0.0.0'}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

all of these in this if in IDEA emit issues like: "This default assignment may cause DoS due to globbing. Quote it."

fi

# allow the container to be started with `--user`
if [ "$1" = 'cassandra' -a "$(id -u)" = '0' ]; then
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Prefer [ p ] && [ q ] as [ p -a q ] is not well defined.
See SC2166.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants