![Oracle Drags Its Feet in the JavaScript Trademark Dispute](https://cdn.sanity.io/images/cgdhsj6q/production/919c3b22c24f93884c548d60cbb338e819ff2435-1024x1024.webp?w=400&fit=max&auto=format)
Security News
Oracle Drags Its Feet in the JavaScript Trademark Dispute
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
github.com/pelletierkevin/go_microservice_elasticsearch
Microservice written in Go to retrieve and deliver the health, status and the indices of an Elasticsearch cluster using gRPC endpoints.
The project is a microservice written in Golang exposing gRPC endpoints. Those endpoints allow a client program to retrieve informations about an Elasticsearch cluster like health, status and its indices. The global implementation is wrapped around a Docker container. The docker image can be found in Docker hub here: https://hub.docker.com/repository/docker/kevinplltr/elastic-health. Additionally, the project can be used in a Kubernetes/Openshift environment, as it provides a usable Helm chart running this docker image.
Currently, the microservice allows a client to call his gRPC endpoints and offers the following functionalities:
The gRPC server will use the port 9000.
Elasticsearch installed.
elasticsearch
command). Get the hostname and port of this cluster.To modify the project you'll have to install Go and have a Go environment set up.
Docker installed
Helm installed
Protoc installed (protobuf)
protoc
executable in your $PATH
In folder elastic_health there is the executable for the microservice
First of all start an elasticsearch cluster. You will need the hostname and the port (usually 9200) of your cluster.
The microservice is launched by passing the elasticsearch cluster hostname:port parameter. There is a one-to-one relationship between the microservice and an elasticsearch cluster. In order to use the microservice on another elasticsearch cluster you need to execute a 2nd instance of the elastichealth microservice.
Go the the elastic_health
folder
./elastic_health <cluster hostname> <cluster port>
Example: ./elastic_health 127.0.0.1 9200
docker pull kevinplltr/elastic-health:0.1.0
docker build -t kevinplltr/elastic-health:0.1.0 .
Then run the docker container : docker run -p 9000:9000 kevinplltr/elastic-health:0.0.1 <cluster hostname> <cluster port>
Example: docker run -p 9000:9000 kevinplltr/elastic-health:0.0.1 host.docker.internal 9200
if the cluster is running on the host machine.
helm install --generate-name ./helm-chart-elastic
kubectl get pods
Once you have an elasticsearch cluster and the elastichealth microservice running you can launch a client to call the gRPC endpoints.
In the grpc_client
folder a client executable is ready to be used. To use it :
./client <grpc hostname> <grpc port> clusterhealth
./client <grpc hostname> <grpc port> listindices
./client <grpc hostname> <grpc port> indexhealth <index name>
./client <grpc hostname> <grpc port> createindex <index name>
./client <grpc hostname> <grpc port> deleteindex <index name>
The gRPC hostname will be the IP address where the microservice is running.
Example : ./client 127.0.0.1 clusterhealth
To build the Go project you obviously first need to have a Go environment installed.
Currently the go.mod
files for each module are referencing to each other by using the replace
keyword and are not downloaded. This will be changed in the future to directly download from Github using a tag version.
Go to the elastic_health
folder and build:
cd elastic_health
go build -o elastic_health elastic_health.go
To build the Client program it will be the same thing:
cd grpc_client
go build -o client client.go
This part describes the elastic_health
folder.
This folder contains the Go project running the microservice and the Dockerfile definition.
There are 2 modules in this project. The first one elasticsearch
is responsible of making the calls to the elasticsearch API. The second one grpc_health
is defining the
gRPC server and its different services/endpoints. Those 2 modules are called by the elastic_health.go
main interface.
The project tries to use the standard Go packages : https://golang.org/pkg/ instead of using fancy modules (exception for gRPC module still provided by golang).
To compile and regenerate the grpc_health/server.pb.go
file use this command:
protoc --go_out=plugins=grpc:grpc_health server.proto
elastic_health
executable as an entrypoint. When running the docker image, you'll have to specify the arguments, like when you run the executable.Build the docker image:
docker build -t kevinplltr/elastic-health:0.1.0 .
Run the docker image:
docker run -p 9000:9000 kevinplltr/elastic-health:0.0.1 <cluster hostname> <cluster port >
The docker image is published in Dockerhub: https://hub.docker.com/repository/docker/kevinplltr/elastic-health.
Last tag version: 0.1.0.
This part describes the grpc_client
folder.
This folder is composed by the client.go
file which is basically able to call the different gRPC endpoints of our microservice given its hostname.
./client <grpc hostname> <grpc port> clusterhealth
./client <grpc hostname> <grpc port> listindices
./client <grpc hostname> <grpc port> indexhealth <index name>
./client <grpc hostname> <grpc port> createindex <index name>
./client <grpc hostname> <grpc port> deleteindex <index name>
This part describes the helm-chart-elastic
folder.
This folder defines the different files required to use a Helm Chart which will run the microservice (using the docker image) on Kubernetes or Openshift.
In values.yaml we define the docker image which is the one stored in dockerhub kevinplltr/elastic-health
and we specify the gRPC port which is 9000.
FAQs
Unknown package
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
Security News
The Linux Foundation is warning open source developers that compliance with global sanctions is mandatory, highlighting legal risks and restrictions on contributions.
Security News
Maven Central now validates Sigstore signatures, making it easier for developers to verify the provenance of Java packages.