Skip to content

v0.2.2

Choose a tag to compare

@ptonlix ptonlix released this 14 Oct 03:01
· 17 commits to main since this release
92ac785

v0.2.2

日期:2026-10-14

这是 v0.2.1 的代理启动修复。店、授权范围、公开发现、买入规则、支付成功条件、店面缓存和文本压缩范围都没有改。没有新的数据库迁移。应用代码也没有改。

v0.2.1 的 compose.yaml 让 Caddy 只压缩文本、JSON、XML、JavaScript 和 SVG。这个意图是对的,但五种类型写在同一行 header Content-Type 上。钉死的 caddy:2.11.7-alpine 拒绝这行,入口脚本在 caddy run 时退出,公网 HTTPS 起不来。应用容器本身不受影响。没开 caddy profile 的机器也碰不到这个问题。

这一版只把同一条匹配拆成五行。适配后的配置仍是一个 Content-Type 字段、五个“或”模式,不是五种类型必须同时满足。生产应用镜像是 docker.io/<用户名>/merclink:0.2.2。正式版同时推送 0.2.2 和 latest。只换应用镜像修不好这件事,必须换这一版的 compose.yaml。

中文

这一版能做什么

  • 正式 Compose 的 Caddy 可以完成配置校验并开始监听 80 和 443。v0.2.1 在这里失败,日志是 malformed header matcher: expected field。
  • 压缩对象仍是响应的 Content-Type,不是请求头。匹配 text/*、application/json*、application/javascript*、application/xml*、image/svg+xml*。客户端接受 gzip 或 zstd 时才压缩。
  • WebP、PNG、JPEG、GIF 仍不进入这条压缩规则。上游已经带 content-encoding 时,Caddy 不会再压一次。
  • 证书继续放在 caddy_data。换这份 Compose 并重建 Caddy 容器不会删这个卷,也不需要重新申请已经签发的证书。

这一版不做

  • 不改设备码流程、scope、买家注册或支付成功条件。
  • 不改店面 HTML 的 no-store,也不改 CSS、JS 的 10 分钟新鲜期和之后最多 24 小时的后台校验。
  • 不改公开图片按 id 缓存一年的规则。缺失图片仍是 404。
  • 不改一键安装问什么、生成什么,也不默认打开买入。
  • 不把 Docker Hub 用户名、令牌、域名或证书写进仓库。
  • 不改 Caddy 镜像标签,仍是 caddy:2.11.7-alpine。

升级注意

已经用 v0.2.1 打开 Caddy 的机器,如果 443 没有服务、Caddy 容器反复退出,就是这一处。不要删 .env,也不要删 caddy_data。

一键安装过的机器,等这个正式版发布后执行:

curl -fsSL -o /tmp/merclink-install.sh https://github.com/ptonlix/MercLink/releases/latest/download/install.sh && bash /tmp/merclink-install.sh upgrade

upgrade 会下载这个 tag 的 compose.yaml,保留已有密钥和后来手工打开的买入配置,然后 pull。它不打印已保存的密码。

手工部署的机器不要再跑一键安装。换成这一版的 compose.yaml 后执行:

docker compose up -d

不要加 --build。只把 MERCLINK_IMAGE 改成 docker.io/<用户名>/merclink:0.2.2 而不换 Compose,Caddy 仍然起不来。没启用 COMPOSE_PROFILES=caddy 的机器可以不为这个问题单独操作。

回滚时不要只把应用镜像退回 0.2.1 或 0.2.0。0.2.1 的 Compose 会再次让 Caddy 退出。要退回旧代理配置,换回那一版能通过校验的 compose.yaml。latest 会在这个正式版发布时从 0.2.1 移到 0.2.2。

English

Date: 2026-10-14

This is a proxy startup fix for v0.2.1. The store, authorization scopes, public discovery, purchase rules, the rule that only paid means payment success, storefront caching, and the set of compressed types are unchanged. There is no new database migration. Application code is unchanged.

v0.2.1's compose.yaml told Caddy to compress only text, JSON, XML, JavaScript, and SVG. That policy was right, but all five patterns were written on one header Content-Type line. The pinned caddy:2.11.7-alpine rejects that line. The entrypoint exits at caddy run, so public HTTPS never starts. The application container is unaffected. A host that does not enable the caddy profile does not hit this.

This version splits that one match into five lines. The adapted config is still one Content-Type field with five alternatives, not five types that must all match. The production image is docker.io/<namespace>/merclink:0.2.2. The stable release also publishes latest. Pulling only the application image does not fix this. The host must use this version of compose.yaml.

What this version does

  • Production Caddy can validate its config and listen on ports 80 and 443. v0.2.1 fails here. The log is malformed header matcher: expected field.
  • Compression still matches the response Content-Type, not the request header. The patterns are text/*, application/json*, application/javascript*, application/xml*, and image/svg+xml*. A response is compressed only when the client accepts gzip or zstd.
  • WebP, PNG, JPEG, and GIF are still not selected. If the upstream response already has content-encoding, Caddy does not compress it again.
  • Certificates stay on caddy_data. Replacing this Compose file and recreating the Caddy container does not delete that volume and does not require reissuing a certificate that is already stored.

What this version does not do

  • It does not change the device-code flow, scopes, buyer registration, or the payment-success rule.
  • It does not change no-store on storefront HTML, or the 10-minute freshness window and later 24-hour background revalidation for CSS and JS.
  • It does not change the one-year cache for a public image id. A missing image is still 404.
  • It does not change what one-click install asks for or generates, and it does not turn purchase on by default.
  • It does not store a Docker Hub username, token, domain, or certificate in the repository.
  • It does not change the Caddy image tag. It remains caddy:2.11.7-alpine.

Upgrade note

On a host that enabled Caddy with v0.2.1, no listener on port 443 and a Caddy container that keeps exiting is this bug. Do not delete .env or caddy_data.

After this stable release is published, a host installed by the script should run:

curl -fsSL -o /tmp/merclink-install.sh https://github.com/ptonlix/MercLink/releases/latest/download/install.sh && bash /tmp/merclink-install.sh upgrade

upgrade downloads compose.yaml for this tag, keeps generated secrets and any later purchase settings, then pulls. It does not print stored passwords.

Do not run a fresh one-click install over a deployment that was created by hand. Replace compose.yaml with this version, then run:

docker compose up -d

Do not add --build. Setting MERCLINK_IMAGE to docker.io/<namespace>/merclink:0.2.2 without replacing Compose leaves Caddy unable to start. A host that does not set COMPOSE_PROFILES=caddy does not need a separate change for this bug.

Do not roll back by moving only the application image to 0.2.1 or 0.2.0. The v0.2.1 Compose file makes Caddy exit again. To restore an older proxy config, also restore a compose.yaml from a version that validates. latest moves from 0.2.1 to 0.2.2 when this stable release is published.