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 HEALTHCHECK to all services #296

Closed
wants to merge 8 commits into from
Closed

Add HEALTHCHECK to all services #296

wants to merge 8 commits into from

Conversation

mic-max
Copy link
Contributor

@mic-max mic-max commented Aug 12, 2022

Fixes #89

Changes

  • Add a docker image that downloads the grpc_health_probe binary.
  • Added HEALTHCHECK command to all the services Dockerfiles and the command to copy it over from the includer docker image
  • Note: emailservice and frontend do their HEALTHCHECK with an HTTP endpoint /_healthz. Other services use gRPC.

I will make a follow-up PR where I add tests to verify the services are reporting their health correctly, which will rely on #284 being merged :)

Screenshots:

Ignoring the feature-flag-service which is dead and the services that we do not build all show starting here
image

and after a bit they all show healthy
image

For significant contributions please make sure you have completed the following items:

  • Appropriate CHANGELOG.md updated for non-trivial changes
  • Design discussion issue #

README.md Outdated
@@ -41,6 +41,12 @@ cd opentelemetry-demo/

#### Run Docker Compose

- Build an image that downloads required files
Copy link
Contributor Author

Choose a reason for hiding this comment

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

How will this integrate with the CI / CD? Do I need to add something to a GitHub workflow?

@mic-max mic-max changed the title Add Healthcheck to services and gracefully exit Add HEALTHCHECK to all services Aug 16, 2022
@mic-max mic-max marked this pull request as ready for review August 16, 2022 00:38
@mic-max mic-max requested a review from a team August 16, 2022 00:38
@mic-max mic-max mentioned this pull request Aug 17, 2022
@puckpuck
Copy link
Contributor

Are the docker health checks re-used within a Kubernetes deployment? Do we need to update our Helm chart to reflect this?

@puckpuck
Copy link
Contributor

I do a docker compose build against this branch and I get an authorization error. Here is the entire output.

√ opentelemetry-demo-webstore 🤘 : docker compose build            
[+] Building 4.2s (73/202)                                                                                                                                                          
 => [ghcr.io/open-telemetry/demo:0.1.0-currencyservice internal] load build definition from Dockerfile                                                                         0.0s
 => => transferring dockerfile: 2.14kB                                                                                                                                         0.0s
 => [ghcr.io/open-telemetry/demo:0.1.0-paymentservice internal] load build definition from Dockerfile                                                                          0.0s
 => => transferring dockerfile: 1.30kB                                                                                                                                         0.0s
 => [ghcr.io/open-telemetry/demo:0.1.0-emailservice internal] load build definition from Dockerfile                                                                            0.0s
 => => transferring dockerfile: 860B                                                                                                                                           0.0s
 => [ghcr.io/open-telemetry/demo:0.1.0-loadgenerator internal] load build definition from Dockerfile                                                                           0.0s
 => => transferring dockerfile: 832B                                                                                                                                           0.0s
 => [ghcr.io/open-telemetry/demo:0.1.0-shippingservice internal] load build definition from Dockerfile                                                                         0.0s
 => => transferring dockerfile: 807B                                                                                                                                           0.0s
 => [ghcr.io/open-telemetry/demo:0.1.0-adservice internal] load build definition from Dockerfile                                                                               0.1s
 => => transferring dockerfile: 1.43kB                                                                                                                                         0.0s
 => [ghcr.io/open-telemetry/demo:0.1.0-productcatalogservice internal] load build definition from Dockerfile                                                                   0.0s
 => => transferring dockerfile: 1.51kB                                                                                                                                         0.0s
 => [ghcr.io/open-telemetry/demo:0.1.0-frontend internal] load build definition from Dockerfile                                                                                0.1s
 => => transferring dockerfile: 1.17kB                                                                                                                                         0.0s
 => [ghcr.io/open-telemetry/demo:0.1.0-checkoutservice internal] load build definition from Dockerfile                                                                         0.1s
 => => transferring dockerfile: 1.42kB                                                                                                                                         0.0s
 => [ghcr.io/open-telemetry/demo:0.1.0-recommendationservice internal] load build definition from Dockerfile                                                                   0.1s
 => => transferring dockerfile: 1.19kB                                                                                                                                         0.0s
 => [ghcr.io/open-telemetry/demo:0.1.0-cartservice internal] load build definition from Dockerfile                                                                             0.0s
 => => transferring dockerfile: 1.51kB                                                                                                                                         0.0s
 => [ghcr.io/open-telemetry/demo:0.1.0-featureflagservice internal] load build definition from Dockerfile                                                                      0.0s
 => => transferring dockerfile: 2.59kB                                                                                                                                         0.0s
 => [ghcr.io/open-telemetry/demo:0.1.0-currencyservice internal] load .dockerignore                                                                                            0.0s
 => => transferring context: 64B                                                                                                                                               0.0s
 => [ghcr.io/open-telemetry/demo:0.1.0-paymentservice internal] load .dockerignore                                                                                             0.0s
 => => transferring context: 1.04kB                                                                                                                                            0.0s
 => [ghcr.io/open-telemetry/demo:0.1.0-emailservice internal] load .dockerignore                                                                                               0.0s
 => => transferring context: 2B                                                                                                                                                0.0s
 => [ghcr.io/open-telemetry/demo:0.1.0-loadgenerator internal] load .dockerignore                                                                                              0.0s
 => => transferring context: 1.04kB                                                                                                                                            0.0s
 => [ghcr.io/open-telemetry/demo:0.1.0-shippingservice internal] load .dockerignore                                                                                            0.0s
 => => transferring context: 1.04kB                                                                                                                                            0.0s
 => [ghcr.io/open-telemetry/demo:0.1.0-adservice internal] load .dockerignore                                                                                                  0.0s
 => => transferring context: 1.04kB                                                                                                                                            0.0s
 => [ghcr.io/open-telemetry/demo:0.1.0-productcatalogservice internal] load .dockerignore                                                                                      0.0s
 => => transferring context: 1.04kB                                                                                                                                            0.0s
 => [ghcr.io/open-telemetry/demo:0.1.0-frontend internal] load .dockerignore                                                                                                   0.0s
 => => transferring context: 1.04kB                                                                                                                                            0.0s
 => [ghcr.io/open-telemetry/demo:0.1.0-checkoutservice internal] load .dockerignore                                                                                            0.0s
 => => transferring context: 1.04kB                                                                                                                                            0.0s
 => [ghcr.io/open-telemetry/demo:0.1.0-recommendationservice internal] load .dockerignore                                                                                      0.0s
 => => transferring context: 1.04kB                                                                                                                                            0.0s
 => [ghcr.io/open-telemetry/demo:0.1.0-cartservice internal] load .dockerignore                                                                                                0.0s
 => => transferring context: 1.04kB                                                                                                                                            0.0s
 => [ghcr.io/open-telemetry/demo:0.1.0-featureflagservice internal] load .dockerignore                                                                                         0.0s
 => => transferring context: 1.31kB                                                                                                                                            0.0s
 => [ghcr.io/open-telemetry/demo:0.1.0-currencyservice internal] load metadata for docker.io/library/ubuntu:20.04                                                              1.5s
 => [ghcr.io/open-telemetry/demo:0.1.0-frontend internal] load metadata for docker.io/library/node:16-alpine                                                                   1.1s
 => [ghcr.io/open-telemetry/demo:0.1.0-emailservice internal] load metadata for docker.io/library/ruby:3.1.2-slim                                                              1.2s
 => [ghcr.io/open-telemetry/demo:0.1.0-loadgenerator internal] load metadata for docker.io/library/python:3.10                                                                 1.3s
 => [ghcr.io/open-telemetry/demo:0.1.0-shippingservice internal] load metadata for docker.io/library/rust:1.61-alpine                                                          2.2s
 => [ghcr.io/open-telemetry/demo:0.1.0-shippingservice internal] load metadata for docker.io/library/alpine:latest                                                             1.1s
 => [ghcr.io/open-telemetry/demo:0.1.0-adservice internal] load metadata for docker.io/library/openjdk:18-slim                                                                 1.2s
 => [ghcr.io/open-telemetry/demo:0.1.0-checkoutservice internal] load metadata for docker.io/library/golang:1.17.7-alpine                                                      1.0s
 => [auth] library/ubuntu:pull token for registry-1.docker.io                                                                                                                  0.0s
 => [ghcr.io/open-telemetry/demo:0.1.0-recommendationservice internal] load metadata for docker.io/library/python:3.10-slim                                                    1.1s
 => [auth] library/node:pull token for registry-1.docker.io                                                                                                                    0.0s
 => [auth] library/ruby:pull token for registry-1.docker.io                                                                                                                    0.0s
 => [ghcr.io/open-telemetry/demo:0.1.0-cartservice internal] load metadata for mcr.microsoft.com/dotnet/runtime-deps:6.0.5-alpine3.15-amd64                                    0.8s
 => [ghcr.io/open-telemetry/demo:0.1.0-cartservice internal] load metadata for mcr.microsoft.com/dotnet/sdk:6.0.300                                                            0.6s
 => [auth] library/python:pull token for registry-1.docker.io                                                                                                                  0.0s
 => [ghcr.io/open-telemetry/demo:0.1.0-featureflagservice internal] load metadata for docker.io/library/debian:bullseye-20210902-slim                                          1.0s
 => [ghcr.io/open-telemetry/demo:0.1.0-featureflagservice internal] load metadata for docker.io/hexpm/elixir:1.13.3-erlang-25.0-debian-bullseye-20210902-slim                  1.1s
 => [auth] library/openjdk:pull token for registry-1.docker.io                                                                                                                 0.0s
 => [auth] library/golang:pull token for registry-1.docker.io                                                                                                                  0.0s
 => [auth] library/rust:pull token for registry-1.docker.io                                                                                                                    0.0s
 => [auth] library/alpine:pull token for registry-1.docker.io                                                                                                                  0.0s
 => [auth] hexpm/elixir:pull token for registry-1.docker.io                                                                                                                    0.0s
 => [auth] library/debian:pull token for registry-1.docker.io                                                                                                                  0.0s
 => CANCELED [ghcr.io/open-telemetry/demo:0.1.0-cartservice stage-1 1/4] FROM mcr.microsoft.com/dotnet/runtime-deps:6.0.5-alpine3.15-amd64@sha256:cb910054da834ef945b5220d054  1.2s
 => => resolve mcr.microsoft.com/dotnet/runtime-deps:6.0.5-alpine3.15-amd64@sha256:cb910054da834ef945b5220d054d3cd665f4b03967bd74a5bd6d88c1fe34fd4b                            0.1s
 => => sha256:00348c290af72c45bd69979fa091f55f75e7750294d7dbba4f773c69315e3a55 2.28kB / 2.28kB                                                                                 0.0s
 => => sha256:df9b9388f04ad6279a7410b85cedfdcb2208c0a003da7ab5613af71079148139 0B / 2.81MB                                                                                     2.0s
 => => sha256:3ae3a38ed752842e75d1609c931b29e565b53c24229c87bf1ba64251b5f1f094 1.05MB / 1.74MB                                                                                 2.0s
 => => sha256:cb910054da834ef945b5220d054d3cd665f4b03967bd74a5bd6d88c1fe34fd4b 739B / 739B                                                                                     0.0s
 => ERROR [ghcr.io/open-telemetry/demo:0.1.0-shippingservice] FROM docker.io/library/includer:latest                                                                           0.4s
 => => resolve docker.io/library/includer:latest                                                                                                                               0.4s
 => CANCELED [ghcr.io/open-telemetry/demo:0.1.0-cartservice builder 1/6] FROM mcr.microsoft.com/dotnet/sdk:6.0.300@sha256:58a93345aa1069d69f4e32eded710dcf5cd563171226fbce69e  1.1s
 => => resolve mcr.microsoft.com/dotnet/sdk:6.0.300@sha256:58a93345aa1069d69f4e32eded710dcf5cd563171226fbce69e65b1e98b5e5a5                                                    0.0s
 => => sha256:58a93345aa1069d69f4e32eded710dcf5cd563171226fbce69e65b1e98b5e5a5 2.17kB / 2.17kB                                                                                 0.0s
 => => sha256:cc1ce0dd02b9ec0f8a8968f1023e01ace8ee47ce9d8d54c497c021eaaa2b4a4c 2.01kB / 2.01kB                                                                                 0.0s
 => => sha256:83ae347bcb57d8893830ffbf03ca84baa22c786f050893ba5bd3c43dbb90ae7e 7.16kB / 7.16kB                                                                                 0.0s
 => => sha256:42c077c10790d51b6f75c4eb895cbd4da37558f7215b39cbf64c46b288f89bda 0B / 31.38MB                                                                                    1.9s
 => [ghcr.io/open-telemetry/demo:0.1.0-cartservice internal] load build context                                                                                                0.1s
 => => transferring context: 45.75kB                                                                                                                                           0.0s
 => CANCELED [ghcr.io/open-telemetry/demo:0.1.0-checkoutservice internal] load build context                                                                                   0.9s
 => => transferring context:                                                                                                                                                   0.9s
 => CANCELED [ghcr.io/open-telemetry/demo:0.1.0-productcatalogservice builder  1/10] FROM docker.io/library/golang:1.17.7-alpine@sha256:d030a987c28ca403007a69af28ba419fca00f  1.0s
 => => resolve docker.io/library/golang:1.17.7-alpine@sha256:d030a987c28ca403007a69af28ba419fca00fc15f08e7801fc8edee77c00b8ee                                                  0.1s
 => => sha256:d030a987c28ca403007a69af28ba419fca00fc15f08e7801fc8edee77c00b8ee 1.65kB / 1.65kB                                                                                 0.0s
 => CANCELED [ghcr.io/open-telemetry/demo:0.1.0-checkoutservice stage-1 1/4] FROM docker.io/library/alpine@sha256:bc41182d7ef5ffc53a40b044e725193bc10142a1243f395ee852a8d9730  1.0s
 => => resolve docker.io/library/alpine@sha256:bc41182d7ef5ffc53a40b044e725193bc10142a1243f395ee852a8d9730fc2ad                                                                0.1s
 => => sha256:bc41182d7ef5ffc53a40b044e725193bc10142a1243f395ee852a8d9730fc2ad 1.64kB / 1.64kB                                                                                 0.0s
 => CANCELED [ghcr.io/open-telemetry/demo:0.1.0-productcatalogservice internal] load build context                                                                             0.9s
 => => transferring context:                                                                                                                                                   0.8s
 => CANCELED [ghcr.io/open-telemetry/demo:0.1.0-emailservice 1/6] FROM docker.io/library/ruby:3.1.2-slim@sha256:2ff431da1c17f98513f7133b974c9410f15d3fe0cf72da7a33caf8434c79f  1.0s
 => => resolve docker.io/library/ruby:3.1.2-slim@sha256:2ff431da1c17f98513f7133b974c9410f15d3fe0cf72da7a33caf8434c79f0ae                                                       0.1s
 => => sha256:2ff431da1c17f98513f7133b974c9410f15d3fe0cf72da7a33caf8434c79f0ae 1.86kB / 1.86kB                                                                                 0.0s
 => [ghcr.io/open-telemetry/demo:0.1.0-emailservice internal] load build context                                                                                               0.1s
 => => transferring context: 7.43kB                                                                                                                                            0.0s
 => CANCELED [ghcr.io/open-telemetry/demo:0.1.0-currencyservice stage-0 1/9] FROM docker.io/library/ubuntu:20.04@sha256:af5efa9c28de78b754777af9b4d850112cad01899a5d37d2617bb  1.0s
 => => resolve docker.io/library/ubuntu:20.04@sha256:af5efa9c28de78b754777af9b4d850112cad01899a5d37d2617bb94dc63a49aa                                                          0.2s
 => => sha256:af5efa9c28de78b754777af9b4d850112cad01899a5d37d2617bb94dc63a49aa 1.42kB / 1.42kB                                                                                 0.0s
 => [ghcr.io/open-telemetry/demo:0.1.0-currencyservice internal] load build context                                                                                            0.0s
 => CANCELED [ghcr.io/open-telemetry/demo:0.1.0-adservice internal] load build context                                                                                         1.0s
 => => transferring context:                                                                                                                                                   0.7s
 => CANCELED [ghcr.io/open-telemetry/demo:0.1.0-adservice] https://github.com/open-telemetry/opentelemetry-java-instrumentation/releases/download/v1.16.0/opentelemetry-javaa  0.2s
 => CANCELED [ghcr.io/open-telemetry/demo:0.1.0-adservice builder 1/7] FROM docker.io/library/openjdk:18-slim@sha256:96dc93559313672bbd34fbb47dd2cda8de357c64c64fb3ef131f5d99  1.2s
 => => resolve docker.io/library/openjdk:18-slim@sha256:96dc93559313672bbd34fbb47dd2cda8de357c64c64fb3ef131f5d99ec616387                                                       0.2s
 => => sha256:96dc93559313672bbd34fbb47dd2cda8de357c64c64fb3ef131f5d99ec616387 547B / 547B                                                                                     0.0s
 => CANCELED [ghcr.io/open-telemetry/demo:0.1.0-frontend build 1/4] FROM docker.io/library/node:16-alpine@sha256:2c405ed42fc0fd6aacbe5730042640450e5ec030bada7617beac88f742b6  1.1s
 => => resolve docker.io/library/node:16-alpine@sha256:2c405ed42fc0fd6aacbe5730042640450e5ec030bada7617beac88f742b6997b                                                        0.2s
 => => sha256:2c405ed42fc0fd6aacbe5730042640450e5ec030bada7617beac88f742b6997b 1.43kB / 1.43kB                                                                                 0.0s
 => [ghcr.io/open-telemetry/demo:0.1.0-paymentservice internal] load build context                                                                                             0.1s
 => => transferring context: 277.02kB                                                                                                                                          0.0s
 => CANCELED [ghcr.io/open-telemetry/demo:0.1.0-frontend internal] load build context                                                                                          1.0s
 => => transferring context:                                                                                                                                                   0.7s
 => [ghcr.io/open-telemetry/demo:0.1.0-loadgenerator internal] load build context                                                                                              0.0s
 => [ghcr.io/open-telemetry/demo:0.1.0-loadgenerator 1/4] FROM docker.io/library/python:3.10@sha256:cbf49327fae903d64ab28251912fc00faea2c1baee493d347a07973a2cb50f98           1.0s
 => => resolve docker.io/library/python:3.10@sha256:cbf49327fae903d64ab28251912fc00faea2c1baee493d347a07973a2cb50f98                                                           1.0s
 => [auth] library/includer:pull token for registry-1.docker.io                                                                                                                0.0s
 => [ghcr.io/open-telemetry/demo:0.1.0-recommendationservice stage-0 1/9] FROM docker.io/library/python:3.10-slim@sha256:59129c9fdea259c6a9b6d9c615c065c336aca680ee030fc38522  1.0s
 => => resolve docker.io/library/python:3.10-slim@sha256:59129c9fdea259c6a9b6d9c615c065c336aca680ee030fc3852211695a21c1cf                                                      1.0s
 => [ghcr.io/open-telemetry/demo:0.1.0-recommendationservice internal] load build context                                                                                      0.0s
 => [ghcr.io/open-telemetry/demo:0.1.0-featureflagservice internal] load build context                                                                                         0.0s
 => [ghcr.io/open-telemetry/demo:0.1.0-featureflagservice builder  1/18] FROM docker.io/hexpm/elixir:1.13.3-erlang-25.0-debian-bullseye-20210902-slim@sha256:319af72370fdded0  0.9s
 => => resolve docker.io/hexpm/elixir:1.13.3-erlang-25.0-debian-bullseye-20210902-slim@sha256:319af72370fdded0a0a7ea976c2d7a0d5c465b901ab0bb2b2440cb0f23f1b650                 0.9s
 => [ghcr.io/open-telemetry/demo:0.1.0-featureflagservice stage-1 1/6] FROM docker.io/library/debian:bullseye-20210902-slim@sha256:e3ed4be20c22a1358020358331d177aa2860632f25  1.0s
 => => resolve docker.io/library/debian:bullseye-20210902-slim@sha256:e3ed4be20c22a1358020358331d177aa2860632f25b21681d79204ace20455a6                                         1.0s
------
 > [ghcr.io/open-telemetry/demo:0.1.0-shippingservice] FROM docker.io/library/includer:latest:
------
failed to solve: rpc error: code = Unknown desc = failed to load cache key: pull access denied, repository does not exist or may require authorization: server message: insufficient_scope: authorization failed

@puckpuck
Copy link
Contributor

In the colored output in my terminal, this is the only red error output line from the above command

ERROR [ghcr.io/open-telemetry/demo:0.1.0-shippingservice] FROM docker.io/library/includer:latest 

@mic-max
Copy link
Contributor Author

mic-max commented Aug 18, 2022

In the colored output in my terminal, this is the only red error output line from the above command

ERROR [ghcr.io/open-telemetry/demo:0.1.0-shippingservice] FROM docker.io/library/includer:latest 

I conflicted the merge conflict, need to add instruction to docker build src/includer/ -t includer
Then again, does anyone know a better way to do this?
| This being: having a container in docker that downloads a file that many other containers need to have a copy of.

@austinlparker
Copy link
Member

In the colored output in my terminal, this is the only red error output line from the above command

ERROR [ghcr.io/open-telemetry/demo:0.1.0-shippingservice] FROM docker.io/library/includer:latest 

I conflicted the merge conflict, need to add instruction to docker build src/includer/ -t includer Then again, does anyone know a better way to do this? | This being: having a container in docker that downloads a file that many other containers need to have a copy of.

Volume mapping? Map something under the host like /build/bin/... into a shell container as well as the other containers, then have the shell container download it, have the others copy it from that path?

@github-actions
Copy link

This PR was marked stale due to lack of activity. It will be closed in 7 days.

@github-actions github-actions bot added the Stale label Aug 27, 2022
@github-actions
Copy link

github-actions bot commented Sep 3, 2022

Closed as inactive. Feel free to reopen if this PR is still being worked on.

@github-actions github-actions bot closed this Sep 3, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Save a copy of grpc_health_probe binary to the repository
3 participants