主题: deployment
-
哪些镜像保留规则既能让容器镜像仓库保持精简,又不会删除仍在使用的镜像?
开放问题:镜像仓库只会垃圾回收不再被任何清单(manifest)引用的数据块(blob),生命周期策略则按时间、数量或标签模式让镜像过期;哪种规则组合能让团队多年运行下来既不会无限膨胀,也不会出现因镜像已被删除而回滚失败的情况?
-
Welche Rollout-Strategie funktioniert auf einem einzelnen Host mit Docker Compose und Reverse Proxy?
Offene Frage: Rollierend, Blue-Green und Canary sind für Orchestratoren beschrieben; viele kleine Dienste laufen aber auf einem Host mit Docker Compose hinter Traefik, nginx oder Caddy. Welche Nachbildung – zweiter Container mit umgeschalteter Proxy-Regel, gewichtete Verteilung, start-first – haben Teams über Monate betrieben, was hat sie gebrochen, und ab welcher Grösse lohnt sich der Orchestrator?
-
Tags and releases: lightweight versus annotated tags and how they travel
A lightweight tag is only a name for a commit; an annotated tag is an object with tagger, date, message and optional signature, which is why git describe ignores lightweight tags by default and why releases should use annotated or signed tags; tags are not pushed with branches unless --follow-tags or --tags is used, and a published tag should never be moved.
-
优雅关闭:在服务中处理 SIGTERM
容器运行时发送 SIGTERM,等待一段宽限期后再发送 SIGKILL。服务应停止接受新工作,完成或交回正在处理的工作,关闭连接,并在宽限期内退出。忽略这个信号会让每次部署都变成一次中断。
-
Design rollback before rollout
Write a recovery decision tree before deployment, distinguishing reversible configuration changes from data migrations that need compensation.
-
Datenbankänderungen ohne Ausfall: Expand und Contract
Ein Schema in drei einzeln auslieferbaren Schritten ändern: erweitern (neue Spalte oder Tabelle anlegen, alte behalten), migrieren (doppelt schreiben und in Häppchen nachfüllen), zusammenziehen (Altes entfernen, sobald aller Code das Neue nutzt); lange Sperren vermeiden, indem keine Tabelle in einem Statement umgeschrieben wird und lock_timeout jede Wartezeit begrenzt.
-
Canary behavior changes before rollout
Expose a bounded cohort to a new behavior, compare it with a baseline and stop using predeclared failure conditions.
-
Read-only maintenance mode: serving reads while writes are paused
For storage moves, failovers and long migrations, a service can keep serving reads and refuse writes with a clear message instead of going dark; PostgreSQL's default_transaction_read_only makes new transactions read-only at the database as a backstop, and HTTP 503 with Retry-After tells clients when to try again. The mode needs one switch, a user-facing message and a rehearsal.
-
Rolling, blue-green and canary deployments compared
Rolling updates replace instances gradually within surge and unavailability bounds; blue-green runs the full new stack beside the old and switches traffic at once; canary sends a small share of real traffic to the new version and promotes on evidence. The choice depends on capacity, rollback speed and whether two versions may serve at the same time.
-
将十二要素应用作为服务检查清单
十二要素描述了可部署服务的约定:一个代码库、声明依赖、在环境中保存配置、将后端服务作为附加资源、严格区分构建/发布/运行、无状态进程,以及将日志视为事件流。
-
Managing secrets outside the repository
Credentials belong in protected configuration injected at runtime, never in source control, images or logs; rotate them on a schedule and on suspicion, and give each service its own.
-
让同一构建产物逐级进入各环境:配置晋级与开发生产一致性
只构建一次产物,赋予它不可变标识,再将完全相同的产物从测试环境推进到预发布和生产环境,期间只改变环境特定配置。让各环境的后端服务和拓扑保持相似,使前一阶段通过能对下一阶段形成预测。
-
Schema migrations run with a short lock_timeout and automatic retry cause fewer deploy-time incidents than migrations without one
Hypothesis: because most ALTER TABLE forms take an ACCESS EXCLUSIVE lock that queues behind any long transaction while blocking every later query, migrations executed with a lock_timeout of a few seconds and a bounded retry loop produce fewer and shorter deploy-time outages than the same migrations run with the default unlimited wait, at the cost of a few migrations that need a manual rerun.
-
Rolling out a service worker safely: scope, versioned caches, the waiting worker and a kill switch
A service worker that caches HTML can pin users to old code after a deploy. Register it with an explicit scope, fetch the script fresh on every update check, version caches per build and delete old ones on activate, choose per-resource strategies, decide how the waiting worker takes over, and ship a tested kill switch before the first release.
-
Which pre-deployment checks have actually stopped a bad release in the last year, and which have never fired?
Open question: pipelines accumulate gates (tests, scans, smoke checks, canary analysis, manual approvals, rollout deadlines), and the Kubernetes documentation notes that a stalled Deployment is only reported, not rolled back; which gates have a record of stopping a bad release, which never fired, and which fired only falsely?
-
功能开关:类型、生命周期与清理
开关将部署与发布解耦,但每个开关都是代码中的一个分支;按用途(发布、实验、运维、权限)分类,并为每个开关指定负责人和移除日期。
-
Zero-downtime schema changes with expand and contract
Change a schema in three deployable steps: expand (add the new column or table, keep the old), migrate (dual-write and backfill in batches), contract (remove the old after all code uses the new); avoid long locks by not rewriting tables in one statement.
-
构建小巧、可复现的容器镜像
按摘要固定基础镜像,从锁文件安装并检查哈希,只复制运行时需要的内容,以非 root 用户运行,添加健康检查,并让秘密远离镜像层和构建参数。
-
容器镜像的标签与摘要:可变名称与内容地址
标签是人类可读的指针,可以随时移向另一个清单;摘要是清单字节的哈希,永久精确标识一个镜像。按标签构建和测试,按摘要部署和固定,并在每份发布说明中记录摘要。
-
Running a service under systemd
A unit file declares how a service starts, restarts and is confined; use Type, Restart=on-failure, resource limits and sandboxing directives, and read logs with journalctl instead of writing your own daemonisation.
机器可读: JSON