Skip to content
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: support Cassandra with docker-compose in server #2307

Merged
merged 10 commits into from
Oct 23, 2023

Conversation

aroundabout
Copy link
Contributor

…840)

Purpose of the PR

Main Changes

  1. change the dockerfile, adding the shell to wait for storage backend and use a docker-entrypoint.sh to manage the starting process.
  2. delete a deprecated class in gremlin-console.sh (reference: doc of ScriptExecutor)
  3. add a healthy check in docker-compose
  4. add an example folder where we can put all the template docker-compose.yml here
  5. add *swagger-ui* in gitignore, which appears after you compile the source code locally.

Detailed doc of the pr is here: https://hugegraph.feishu.cn/wiki/BBrgwmytNi0DiQkvDj1cpNbFn5b
Some test case: https://hugegraph.feishu.cn/docx/CBcydSr6CokDpexlZAQcH4Icnlb#TbYrdpl3io1c9NxT4vLcDTn8nhg

Verifying these changes

  • Trivial rework / code cleanup without any test coverage. (No Need)
  • Already covered by existing tests, such as (please modify tests here).
  • Need tests and can be verified as follows:
    • xxx

Does this PR potentially affect the following parts?

  • Nope
  • Dependencies (add/update license info)
  • Modify configurations
  • The public API
  • Other affects ( docker images )

Documentation Status

  • Doc - TODO
  • Doc - Done
  • Doc - No Need

@codecov
Copy link

codecov bot commented Sep 9, 2023

Codecov Report

Merging #2307 (da46a0f) into master (869fc81) will increase coverage by 4.44%.
The diff coverage is n/a.

@@             Coverage Diff              @@
##             master    #2307      +/-   ##
============================================
+ Coverage     63.85%   68.29%   +4.44%     
- Complexity      684      987     +303     
============================================
  Files           505      505              
  Lines         41902    41902              
  Branches       5817     5817              
============================================
+ Hits          26756    28619    +1863     
+ Misses        12455    10513    -1942     
- Partials       2691     2770      +79     

see 94 files with indirect coverage changes

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

.gitignore Outdated
@@ -83,3 +83,5 @@ hs_err_pid*
.mtj.tmp/
# blueJ files
*.ctxt

*swagger-ui*
Copy link
Member

Choose a reason for hiding this comment

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

seems no need to add here due to the master code has fixed it (#2277)

Copy link
Member

@imbajin imbajin Sep 9, 2023

Choose a reason for hiding this comment

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

and also need handle the CI error (if we used refined github plugin)
image

Dockerfile Outdated

EXPOSE 8080
VOLUME /hugegraph

ENTRYPOINT ["/usr/bin/dumb-init", "--"]
CMD ["./bin/start-hugegraph.sh", "-d false -j $JAVA_OPTS -g zgc"]
CMD ["./bin/docker-entrypoint.sh"]
Copy link
Member

Choose a reason for hiding this comment

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

maybe we shouldn't put the docker files in general path?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

https://github.com/JanusGraph/janusgraph/tree/master/janusgraph-dist/docker
maybe I can try to move the docker related file in a split folder in hugegraph-dist, like janusgraph?


./bin/init-store.sh

./bin/start-hugegraph.sh -d false -j "$JAVA_OPTS" -g zgc
Copy link
Member

Choose a reason for hiding this comment

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

why the params here? could we get the value of $JAVA_OPTS?

Copy link
Contributor Author

@aroundabout aroundabout Sep 9, 2023

Choose a reason for hiding this comment

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

JAVA_OPTS is an env var which is set in dockerfile. And this shell is only used in dockerfile, hence I think this way is available.

depends_on:
- cassandra
healthcheck:
test: ["CMD", "bin/gremlin-console.sh", "--" ,"-e", "scripts/remote-connect.groovy"]
Copy link
Member

Choose a reason for hiding this comment

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

we still need -e?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

https://tinkerpop.apache.org/docs/3.6.2-SNAPSHOT/reference/#execution-mode
-e is for the gremlin console to use the execution mode to execute scripts.

retries: 3

cassandra:
image: cassandra:3.11
Copy link
Member

Choose a reason for hiding this comment

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

try C* 4 for it

Copy link
Contributor Author

Choose a reason for hiding this comment

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

tested, no problem
image

hugegraph-dist/docker/example/docker-compose-cassandra.yml Outdated Show resolved Hide resolved
@imbajin imbajin added ci-cd Build or deploy cassandra Cassandra backend labels Sep 11, 2023
@imbajin imbajin requested a review from javeme October 12, 2023 15:50
RegisterUtil.registerPalo()
RegisterUtil.registerPostgresql()

graph = HugeFactory.open('./conf/graphs/hugegraph.properties')
Copy link
Contributor

Choose a reason for hiding this comment

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

can we rename this file to detect-storage.groovy?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sure. And "detect" seems better than "try". I have applied the change.

@aroundabout aroundabout requested review from imbajin and javeme October 13, 2023 11:03
TOP="$(cd "$BIN"/../ && pwd)"
GRAPH_PROP="$TOP/conf/graphs/hugegraph.properties"
HUGE_STORAGE_TIMEOUT_S=120
TRY_STORAGE="$TOP/scripts/detect-storage.groovy"
Copy link
Contributor

Choose a reason for hiding this comment

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

also update TRY_STORAGE

BIN=$(abs_path)
TOP="$(cd "$BIN"/../ && pwd)"
GRAPH_PROP="$TOP/conf/graphs/hugegraph.properties"
HUGE_STORAGE_TIMEOUT_S=120
Copy link
Contributor

Choose a reason for hiding this comment

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

prefer WAIT_STORAGE_TIMEOUT_S


BIN=$(abs_path)
TOP="$(cd "$BIN"/../ && pwd)"
GRAPH_PROP="$TOP/conf/graphs/hugegraph.properties"
Copy link
Contributor

Choose a reason for hiding this comment

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

prefer GRAPH_CONF

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The changes have been applied on the var name

@aroundabout aroundabout requested a review from javeme October 15, 2023 11:45
Copy link
Contributor

@javeme javeme left a comment

Choose a reason for hiding this comment

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

LGTM

@imbajin imbajin changed the title feat: support Cassandra(Docker) as backend (compose with HugeGraph)(#… feat: support Cassandra in docker-compose with server Oct 23, 2023
@imbajin imbajin merged commit d4b95ca into apache:master Oct 23, 2023
18 of 21 checks passed
@imbajin imbajin changed the title feat: support Cassandra in docker-compose with server feat: support Cassandra with docker-compose in server Oct 23, 2023
VGalaxies pushed a commit to VGalaxies/incubator-hugegraph that referenced this pull request Nov 10, 2023
1. change the dockerfile, adding the shell to wait for storage backend and use a docker-entrypoint.sh to manage the starting process.
2. delete a deprecated class in  gremlin-console.sh (reference: [doc of ScriptExecutor](https://tinkerpop.apache.org/javadocs/3.2.3/full/org/apache/tinkerpop/gremlin/groovy/jsr223/ScriptExecutor.html))
3. add a healthy check in docker-compose
4. add an example folder where we can put all the template docker-compose.yml here
5. add `*swagger-ui*` in gitignore, which appears after you compile the source code locally.

---------

Co-authored-by: imbajin <[email protected]>
imbajin added a commit that referenced this pull request Nov 10, 2023
1. change the dockerfile, adding the shell to wait for storage backend and use a docker-entrypoint.sh to manage the starting process.
2. delete a deprecated class in  gremlin-console.sh (reference: [doc of ScriptExecutor](https://tinkerpop.apache.org/javadocs/3.2.3/full/org/apache/tinkerpop/gremlin/groovy/jsr223/ScriptExecutor.html))
3. add a healthy check in docker-compose
4. add an example folder where we can put all the template docker-compose.yml here
5. add `*swagger-ui*` in gitignore, which appears after you compile the source code locally.

---------

Co-authored-by: imbajin <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cassandra Cassandra backend ci-cd Build or deploy
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

3 participants