mirror of
https://github.com/dani-garcia/vaultwarden.git
synced 2025-03-15 04:30:26 +03:00
Reduce healthcheck internal while keep performance
This commit is contained in:
parent
a4c7fadbf4
commit
6c87c8882e
4 changed files with 12 additions and 4 deletions
|
@ -153,6 +153,6 @@ COPY docker/healthcheck.sh docker/start.sh /
|
|||
COPY --from=vault /web-vault ./web-vault
|
||||
COPY --from=build /app/target/final/vaultwarden .
|
||||
|
||||
HEALTHCHECK --interval=60s --timeout=10s CMD ["/healthcheck.sh"]
|
||||
HEALTHCHECK --interval=3s --timeout=2s CMD ["/healthcheck.sh"]
|
||||
|
||||
CMD ["/start.sh"]
|
||||
|
|
|
@ -196,6 +196,6 @@ COPY docker/healthcheck.sh docker/start.sh /
|
|||
COPY --from=vault /web-vault ./web-vault
|
||||
COPY --from=build /app/target/final/vaultwarden .
|
||||
|
||||
HEALTHCHECK --interval=60s --timeout=10s CMD ["/healthcheck.sh"]
|
||||
HEALTHCHECK --interval=3s --timeout=2s CMD ["/healthcheck.sh"]
|
||||
|
||||
CMD ["/start.sh"]
|
||||
|
|
|
@ -240,6 +240,6 @@ COPY docker/healthcheck.sh docker/start.sh /
|
|||
COPY --from=vault /web-vault ./web-vault
|
||||
COPY --from=build /app/target/final/vaultwarden .
|
||||
|
||||
HEALTHCHECK --interval=60s --timeout=10s CMD ["/healthcheck.sh"]
|
||||
HEALTHCHECK --interval=3s --timeout=2s CMD ["/healthcheck.sh"]
|
||||
|
||||
CMD ["/start.sh"]
|
||||
|
|
|
@ -1,5 +1,13 @@
|
|||
#!/usr/bin/env sh
|
||||
|
||||
LAST_HEALTHY_FILE="/tmp/healthy"
|
||||
|
||||
last_check="$(cat "$LAST_HEALTHY_FILE" 2>/dev/null || echo "0")"
|
||||
current_time="$(date +%s)"
|
||||
if [ $((current_time - last_check)) -le 60 ]; then
|
||||
exit 0
|
||||
fi
|
||||
|
||||
# Use the value of the corresponding env var (if present),
|
||||
# or a default value otherwise.
|
||||
: "${DATA_FOLDER:="/data"}"
|
||||
|
@ -62,4 +70,4 @@ if [ -n "${ROCKET_TLS}" ]; then
|
|||
s='s'
|
||||
fi
|
||||
curl --insecure --fail --silent --show-error \
|
||||
"http${s}://${addr}:${ROCKET_PORT}${base_path}/alive" || exit 1
|
||||
"http${s}://${addr}:${ROCKET_PORT}${base_path}/alive" && echo "$current_time" > "$LAST_HEALTHY_FILE" || exit 1
|
||||
|
|
Loading…
Add table
Reference in a new issue