Loading page...Загружаем страницу...正在加载页面...
AtlasRepo

48-Hour Field Notes: The Port the Repo Never Opened

说明与用途

创建了运行时契约和检查器,确保生成的 Docker 和 docker-compose 文件与仓库实际的端口和主机配置匹配,防止部署时的端口错误。

问题

Generated Docker and compose files introduced a port mismatch that caused runtime failures while tests passed, leading to a silent deployment bug.

结果

The checker prevented a silent deployment bug by enforcing consistency between generated ops files and the repository’s actual runtime configuration.

工作流

  • 1. Identify port mismatch between generated Dockerfile/compose and application defaults.
  • 2. Create a runtime contract JSON specifying expected http_bind_port, host, probe_url, forbidden_ports, and postgres_transport details.
  • 3. Write a Python script that scans Dockerfiles, compose files, and scripts for port declarations using regex.
  • 4. Compare found ports against the contract; flag any mismatches or forbidden ports.
  • 5. Run the checker before CI builds to fail the build if inconsistencies are detected.
  • 6. Adjust generated files or contract as needed to resolve mismatches.
  • 7. Re-run CI to confirm build passes and runtime matches contract.

证据

I stopped asking for a better patch and wrote a file the patch had to lose against. The contract is boring on purpose.

来源

Hour 18 I wired a checker that walks generated compose files, Dockerfiles, and shell probes, then fails if a literal host, port, or scheme disagrees with the contract.

来源

  • 记录日期: 2026-09-15T04:45:47.197Z