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

Add health checks to Node.js services #26

Merged
merged 9 commits into from
Sep 19, 2018
Merged

Add health checks to Node.js services #26

merged 9 commits into from
Sep 19, 2018

Conversation

ace-n
Copy link
Contributor

@ace-n ace-n commented Aug 20, 2018

FYI: I've tested these locally, but not with Docker.

@ace-n ace-n requested a review from ahmetb August 20, 2018 23:09
@googlebot googlebot added the cla: yes This human has signed the Contributor License Agreement. label Aug 20, 2018
@@ -1 +1,2 @@
proto/
Copy link
Contributor

Choose a reason for hiding this comment

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

You should probably undo this.

We want the app to be buildable from source just after git-clone, so we should keep the duplicate protos –it's fine for now (until/if we decide to use Bazel).

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done.

pb/demo.proto Outdated
@@ -156,6 +157,7 @@ message CurrencyConversionRequest {

service PaymentService {
rpc Charge(ChargeRequest) returns (ChargeResponse) {}
rpc Check(Empty) returns (Empty) {}
Copy link
Contributor

Choose a reason for hiding this comment

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

This would come from the standard gRPC HC protocol: https://github.com/grpc/grpc/blob/master/src/proto/grpc/health/v1/health.proto
Also: https://github.com/grpc/grpc/blob/master/doc/health-checking.md

So we need to implement the grpc.health.v1.Health's rpc Check instead. This would

  1. download health.proto to pb/
  2. update genproto scripts for node
  3. register for Health service in app
  4. implement rpc Check(HealthCheckRequest) returns (HealthCheckResponse); from the health.proto

Ace Nassri and others added 5 commits August 20, 2018 18:18
this gets currencyservice to work but paymentservice is still crashing
in the docker container.

Signed-off-by: Ahmet Alp Balkan <ahmetb@google.com>
@ahmetb
Copy link
Contributor

ahmetb commented Aug 21, 2018

I pushed a commit that fixes genproto.sh path issue in these services + ran the scripts.

  • currencyservice is now fixed and working correctly.

  • paymentservice is returning this error:

/usr/src/app/server.js:26
      hipsterShop: this.loadProtoFile(path.join(protoRoot, 'demo.proto')),
                        ^
TypeError: this.loadProtoFile is not a function
    at new HipsterShopServer (/usr/src/app/server.js:26:25)

@ahmetb
Copy link
Contributor

ahmetb commented Aug 21, 2018

This works fine now.

Signed-off-by: Ahmet Alp Balkan <ahmetb@google.com>
@ahmetb ahmetb merged commit 6c37a96 into master Sep 19, 2018
@ahmetb ahmetb deleted the node-health branch September 20, 2018 17:31
D-Mwanth pushed a commit to D-Mwanth/microservices-demo that referenced this pull request Mar 6, 2024
* Move Node healthchecks to gRPC

* gitignore proto files

* Switch to standard health RPC

* Fix lint

* Update client.js

* Add protos back + update them

* node services: fix & run genproto.sh

this gets currencyservice to work but paymentservice is still crashing
in the docker container.

Signed-off-by: Ahmet Alp Balkan <ahmetb@google.com>

* Fix docker breaking

* update dockerfiles with released health probe

Signed-off-by: Ahmet Alp Balkan <ahmetb@google.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/grpc cla: yes This human has signed the Contributor License Agreement.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants