health check with axon server 4.3.1 with curl not working anymore

Hi,

After testing the upgrade to axon server 4.3.1 our health checks are not working anymore and therefore reported as unhealthy.

distroless-java 11 has not curl anymore. What is the recommended way now to do a health check in docker-compose for axon?

Best,
Michael

Hi Michael,

AxonServer is using distroless-java 11 as a base image. https://github.com/GoogleContainerTools/distroless

“Distroless” images contain only your application and its runtime dependencies. They do not contain package managers, shells or any other programs you would expect to find in a standard Linux distribution.

Please be aware that I do not know how exactly you do health checking at the moment.
I see two options:

  1. Create your own image based on the AxonServer jar and tools you need (CURL included) or by using current axon server docker image as a base (and adding the tools you need, which can be difficult)
  2. If you are using healthcheck property on docker-compose for health checking at the moment, you can switch to wait-for-it or dockerize scripts.

Best,
Ivan

Hi Ivan,

Thanks for the reply. I was hoping you have already included something.

We use it in docker-compose right now:

healthcheck:
  test: curl -f http://localhost:8024/actuator/health || exit 1;
  interval: 5s

One of my colleagues also said using your docker image as base is an option. What do you think is the difficult part?

  1. I’m not sure where e.g. the wait-for-it.sh should be? Does it have to be next to the docker-compose file? Because if it is like curl I assume it has to be in the image…

Best, Michael

Hi Ivan,

I was looking into the 2nd solution more. These scripts have to be in MY image which is waiting for the axon server - right?
So option 1 is the one if I want that if I start the axon server I that a “healthy” is shown when doing a docker ps.

Best, Michael

Hi Michael,

I do not have any concrete examples for you :frowning: I do not use docker-compose in production. I use it for test/demo purposes, and in this case, I do not need a health check (axon application will eventually connect to axon-server).
In production, I use Kubernetes to orchestrate containers and this problem is solved differently there (with livness and rediness probes)

If you choose option 1, I’m sure you will find examples on how to update your image (in a multi-stage manner) in order to add Curl (or wget) tool.
This is what I have found so far (pleas note that in this case base image is gcr.io/distroless/java and not Axon Server): https://github.com/GoogleContainerTools/distroless/issues/183

FROM busybox AS builder

ARG BUSYBOX_VERSION=1.31.0-i686-uclibc
ADD https://busybox.net/downloads/binaries/$BUSYBOX_VERSION/busybox_WGET /wget
RUN chmod a+x /wget

FROM gcr.io/distroless/java

COPY --from=builder /wget /usr/bin/wget

If you choose option 2:
These scripts have to be in MY image which is waiting for the axon server - right? Yes !

Best,
Ivan

Hi Ivan,

This is exactly the stuff I also found. So I think for now I know all the ways howto solve it.

Thanks a lot for the quick help,
Michael

Happy to help, cheers!