Skip to content

Commit

Permalink
Add command to clean elasticsearch (#163)
Browse files Browse the repository at this point in the history
  • Loading branch information
kuskoman authored Aug 17, 2023
1 parent 1266f78 commit 065a4af
Show file tree
Hide file tree
Showing 2 changed files with 57 additions and 43 deletions.
9 changes: 9 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,15 @@ install-helm-readme:
helm-readme:
./scripts/generate_helm_readme.sh

#: Cleans Elasticsearch data, works only with default ES port. The command may take a very long time to complete
clean-elasticsearch:
@indices=$(shell curl -s -X GET "http://localhost:9200/_cat/indices" | awk '{print $$3}') ;\
for index in $$indices ; do \
echo "Deleting all documents from index $$index" ;\
curl -X POST "http://localhost:9200/$$index/_delete_by_query?conflicts=proceed" -H "Content-Type: application/json" -d '{"query": {"match_all": {}}}' ;\
echo "" ;\
done

#: Shows info about available commands
help:
@grep -B1 -E "^[a-zA-Z0-9_-]+\:([^\=]|$$)" Makefile \
Expand Down
91 changes: 48 additions & 43 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ All configuration variables can be checked in the [config directory](./config/).
#### Available Commands

<!--- GENERATED by ./scripts/add_descriptions_to_readme.sh --->

- `make all`: Builds binary executables for all OS (Win, Darwin, Linux).
- `make run`: Runs the Go Exporter application.
- `make build-linux`: Builds a binary executable for Linux.
Expand All @@ -125,8 +125,9 @@ All configuration variables can be checked in the [config directory](./config/).
- `make minify`: Minifies the binary executables.
- `make install-helm-readme`: Installs readme-generator-for-helm tool.
- `make helm-readme`: Generates Helm chart README.md file.
- `make clean-elasticsearch`: Cleans Elasticsearch data, works only with default ES port. The command may take a very long time to complete.
- `make help`: Shows info about available commands.

<!--- **************************************************** --->

#### File Structure
Expand All @@ -137,87 +138,91 @@ The binary executables are saved in the out directory.
#### Example Usage

<!--- GENERATED by ./scripts/add_descriptions_to_readme.sh --->

Builds binary executables for all OS (Win, Darwin, Linux):

make all

Runs the Go Exporter application:

make run

Builds a binary executable for Linux:

make build-linux

Builds a binary executable for Darwin:

make build-darwin

Builds a binary executable for Windows:

make build-windows

Builds a Docker image for the Go Exporter application:

make build-docker

Builds a multi-arch Docker image (`amd64` and `arm64`):

make build-docker-multi

Deletes all binary executables in the out directory:

make clean

Runs all tests:

make test

Displays test coverage report:

make test-coverage

Starts a Docker-compose configuration:

make compose

Starts a Docker-compose configuration until it's ready:

make wait-for-compose

Stops a Docker-compose configuration:

make compose-down

Verifies the metrics from the Go Exporter application:

make verify-metrics

Pulls the Docker image from the registry:

make pull

Shows logs from the Docker-compose configuration:

make logs

Minifies the binary executables:

make minify

Installs readme-generator-for-helm tool:

make install-helm-readme

Generates Helm chart README.md file:

make helm-readme


Cleans Elasticsearch data, works only with default ES port. The command may take a very long time to complete:

make clean-elasticsearch

Shows info about available commands:

make help

<!--- **************************************************** --->

## Helper Scripts
Expand Down

0 comments on commit 065a4af

Please sign in to comment.