mirror of
https://github.com/go-admin-team/go-admin.git
synced 2026-09-22 18:37:43 +00:00
Stopping this process takes drain + server + cleanup seconds: eight out of the box, and more for anyone who configures a drain window. Three places decide whether it gets that long, and none of them was written with it in mind. The release workflow stopped the previous container with the default deadline, which docker sets at ten seconds. The compose file - which the Makefile calls the first way to run this - set no stop_grace_period, so it took the same ten. Under either, a drain window over two seconds would have been cut off by SIGKILL part-way through the cleanup callbacks: this project's own deployments could not have run the capability it ships. The third was worse. `make run` removed the previous container with `docker rm -f`, and the force flag kills a running container outright - "uses SIGKILL", in docker's own words - with no grace at all. Restarting locally cut every shutdown short, so the drain window would never once have been reached on a developer's machine. It now stops with a deadline and then removes, which leaves what gets removed unchanged: on a container that has already stopped, stop is a no-op. So: --timeout 30 in the workflow, stop_grace_period: 30s on the compose service, and stop --timeout 30 before the removal in the Makefile. --timeout rather than --time, which docker still honours but has deprecated - it prints a warning on every use, and a deploy log that always carries a warning is one nobody reads. The three remaining `docker rm -f` calls in the workflow are left alone. Two remove containers that have already been stopped and one is the rollback path, and nothing static can tell those apart from a container that is still running - which is also why the check added next does not look at `rm -f` at all: a forced removal has no deadline to compare against. What keeps that path honest is the line above it, not a check. Thirty will drift the first time somebody raises a budget. The next commit is what notices, which is also why these comments name a check that does not exist yet.
27 lines
805 B
YAML
27 lines
805 B
YAML
version: '3.8'
|
|
services:
|
|
go-admin-api:
|
|
container_name: go-admin
|
|
image: go-admin:latest
|
|
privileged: true
|
|
restart: always
|
|
ports:
|
|
- 8000:8000
|
|
# Compose allows 10 seconds by default, and this process spends
|
|
# drain + server + cleanup from extend.shutdown before it exits - 8 out of
|
|
# the box, more for anyone who configures a drain window. Past the deadline
|
|
# it is sent SIGKILL and the cleanup callbacks are cut off part-way
|
|
# through. checksilent's docker-stop-cuts-shutdown-short check compares
|
|
# this against config/settings.yml.
|
|
stop_grace_period: 30s
|
|
volumes:
|
|
- ./config/:/go-admin-api/config/
|
|
- ./static/:/go-admin-api/static/
|
|
- ./temp/:/go-admin-api/temp/
|
|
networks:
|
|
- myweb
|
|
networks:
|
|
myweb:
|
|
driver: bridge
|
|
|