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 a docker endpoint for health-check of archive node docker image #421

Open
wants to merge 1 commit into
base: dev
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,10 @@ RUN apt-get -qq update && \
unzip \
wget

COPY ./healthcheck.sh /usr/bin/
HEALTHCHECK --interval=300s --timeout=75s --start-period=30s --retries=3 \
CMD ["/usr/bin/healthcheck.sh"]

# Configure sccache
ENV SCCACHE_VERSION=0.5.4
RUN wget -q https://github.com/mozilla/sccache/releases/download/v${SCCACHE_VERSION}/sccache-v${SCCACHE_VERSION}-x86_64-unknown-linux-musl.tar.gz \
Expand Down
15 changes: 15 additions & 0 deletions healthcheck.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#!/usr/bin/env bash

set -e

head () {
polkadot-js-api --ws ws://127.0.0.1:9944 query.system.number 2>/dev/null |\
Copy link
Contributor

@yahortsaryk yahortsaryk Aug 16, 2024

Choose a reason for hiding this comment

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

I don't think this endpoint performs the check for synchronization. The health check should respond with failure in case node is in syncing process at the moment to let the load balancer evict it from the pool. Please, read the doc I sent you previously. We should mimic the /health/readiness endpoint in our health check.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sure. Let me address this.

tail -3 |\
jq -r .number
}

start=$(head)
sleep 60
end=$(head)

[ "$start" != "$end" ]
Loading