Orderly shutdown on SIGHUP too, forced exit when stuck; version in the image

SIGINT, SIGTERM and SIGHUP all shut the node down in order (SIGTERM is what a
Kubernetes pod termination sends). A second signal, or 20 seconds (below the
30 s Kubernetes grants), stops the process at once, so a stuck shutdown cannot
hang.

The binary knows its version (allmende version, and the 'node running' log
line); the image is built with the commit as version and 'make image' pushes it
tagged with that commit, refusing a dirty tree.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AeFqV96dVeBX94inzcgZKw
This commit is contained in:
2026-11-18 13:08:14 +01:00
co-authored by Claude Sonnet 5.5
parent 7120959cb8
commit 0cfb59c469
5 changed files with 88 additions and 4 deletions
+10 -1
View File
@@ -3,7 +3,7 @@ REGION ?= u1j# Bonn; several are allowed: make run REGION="u1j u1h" (u1h is Colo
DATA ?=
FLAGS := $(if $(DATA),--data $(DATA))
.PHONY: help build run init test vet web web-test e2e check clean docker
.PHONY: help build run init test vet web web-test e2e check clean docker image
help: ## list the targets
@grep -E '^[a-z-]+:.*## ' $(MAKEFILE_LIST) | awk -F':.*## ' '{printf " %-10s %s\n", $$1, $$2}'
@@ -20,6 +20,15 @@ run: build ## run a node (default region Bonn): make run [REGION=u1j] [DATA=dir]
docker: ## build the container image (allmende:dev)
docker build -t allmende:dev .
IMAGE ?= git.stinnesbeck.com/nils/allmende
image: ## build and push the image, tagged with the commit (clean tree only); prints the tag to put in k8s/base/kustomization.yaml
@test -z "$$(git status --porcelain)" || { echo "commit your changes first: the tag must name what is in the image"; exit 1; }
@tag=$$(git rev-parse --short HEAD) && \
docker build --build-arg VERSION=$$tag -t $(IMAGE):$$tag . && \
docker push $(IMAGE):$$tag && \
echo "pushed $(IMAGE):$$tag -> set newTag: $$tag in k8s/base/kustomization.yaml"
vet: ## go vet
go vet ./...