CanastaWiki / Canasta-CLI

The Canasta command line interface, written in Go
MIT License
5 stars 14 forks source link

Added "canasta elasticsearch index" command #76

Open chl178 opened 1 year ago

chl178 commented 1 year ago

Fixes #41

Summary

This PR adds the canasta elasticsearch index command to the Canasta CLI, which allows users to easily initialize the search index for a Canasta instance. This new command will make it more convenient for users to set up and manage the Elasticsearch indices and clusters associated with their Canasta installations.

Changes

Create a new elasticsearch package for managing Elasticsearch indices and clusters for Canasta. Add indexCmdCreate() function in the elasticsearch package to create a new Cobra command for initializing the search index for a Canasta instance. Add initializeIndex() function in the elasticsearch package to perform the actual index initialization process. Add NewCmdCreate() function in the elasticsearch package to create a new Cobra command for managing Elasticsearch. Update the root CLI command to include the new elasticsearch package and its commands.

Test

Test the new command by following these steps:

Check out this branch and build the CLI tool. Use an existing Canasta instance Run the canasta elasticsearch index command with the appropriate flags Verify that the search index initialization process completes successfully and the Elasticsearch indices and clusters are configured correctly. Screenshot from 2023-03-26 20-07-56

Please let me know if you have any questions or concerns about the changes in this PR.

chl178 commented 1 year ago

@jeffw16 @yaronkoren I have already submitted 3 Pull Requests related to the CLI, and I would like to try tackling Canasta issues. However, all the Canasta issues in #219 have been assigned. Can I choose an issue that is not listed in #219?

jeffw16 commented 1 year ago

@chl178 Can you try https://github.com/CanastaWiki/Canasta/issues/223?

Basically, it would be doing https://github.com/CanastaWiki/Canasta/pull/218 except refactor almost all of the run-apache.sh script into a maintenance-scripts folder. It should resemble the Taqasta implementation, except the scripts should be in the maintenance-scripts folder, which should be located within _sources/scripts: https://github.com/WikiTeq/Taqasta/tree/master/_sources/scripts

yaronkoren commented 1 year ago

@chl178 - this looks great! And well-documented. It certainly looks correct; hopefully someone can test it soon.

Yes, @jeffw16 is right that adding that maintenance-scripts/ directory would be a great next task, if you want to do another one. Although I have a correction: it wouldn't be that much of the run-apache.sh script that has to get refactored. Also, I'm not sure that looking at the Taqasta code would help that much (maybe it would, I don't know). If you follow the explanation in the task description, you should be fine. Although of course let us know if you have questions.

chl178 commented 1 year ago

@jeffw16 @yaronkoren Thank you for your suggestions, I would like to try #223.

jeffw16 commented 1 year ago

Go for it

yaronkoren commented 7 months ago

@vedmaka - @jeffw16 and I were just talking about this PR. Neither of us could remember why these three scripts need to be called in this specific order (if they do). I know that it's been almost a year, but - do you know the reason for this order, if there is one?

Oops, I put this comment in the wrong PR! Please ignore this one.

vedmaka commented 7 months ago

@yaronkoren so the question is for some other PR, right? not related to ElasticSearch?

yaronkoren commented 7 months ago

That's right - it was actually for https://github.com/CanastaWiki/Canasta/pull/269 .