Repository navigation
feat(deploy): SaaS compose 加可选的 push-relay 服务 - #188
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
变更摘要 / Summary
deploy/saas/compose.yml加可选服务push-relay(profilepush,缺省的docker compose up -d不起):镜像ghcr.io/ama-link/armadra-push-relay,标签跟ARMADRA_CLOUD_VERSION(版本线分开走时可设PUSH_RELAY_VERSION);只进edge网络(要出网访问 APNs / FCM,够不到 postgres 与 redis);只读根文件系统、cap_drop: ALL、no-new-privileges;健康检查用镜像自带的。push_relay_secret(init-secrets.sh生成,封中继令牌)必填;APNs.p8与 FCM 服务账号是占位的空文件,对应变量缺省为空,不填也能启动(/health报空平台列表,登记与推送答platformUnavailable;此行为由 Armadra 同批 PR 提供)。push.<域>站点,只转/v1/register、/v1/push、/health,登记按 IP 限流。.env.example、deploy/README.md(deploy/saas的说明与变量表)、运维手册新节「推送中继(可选)」、CHANGELOG Unreleased(中英)同步。镜像要到 Armadra v0.12.0 打标签后才第一次存在(AMA-Link/Armadra#698,标签发布时由
push-relay-image.yml推送)。在那之前启用--profile push会拉取失败;不启用则对现有部署没有任何影响。合并本 PR 不依赖镜像,但文档与 CHANGELOG 已写明这一点。push-relayservice todeploy/saas/compose.yml(profilepush, not started by a plaindocker compose up -d): imageghcr.io/ama-link/armadra-push-relay, tag followsARMADRA_CLOUD_VERSION(setPUSH_RELAY_VERSIONif the version lines diverge);edgenetwork only (needs egress to APNs/FCM, cannot reach postgres/redis); read-only rootfs,cap_drop: ALL,no-new-privileges; the image's own healthcheck.push_relay_secret(generated byinit-secrets.sh, seals relay tokens) is required; the APNs.p8and FCM service account are empty placeholder files with empty-by-default variables, and the relay starts without them (/healthreports no platforms, register/push answerplatformUnavailable; that behaviour comes from the companion Armadra PR).push.<domain>site forwarding only/v1/register,/v1/pushand/health, with per-IP rate limiting on register..env.example,deploy/README.md(thedeploy/saasdescription and variable table), a new runbook section "推送中继(可选)" and CHANGELOG Unreleased (zh and en) are updated.The image first exists once Armadra v0.12.0 is tagged (AMA-Link/Armadra#698; pushed by
push-relay-image.ymlon tag release). Until then--profile pushfails to pull; leaving it off changes nothing for existing deployments. Merging this PR does not depend on the image, and the docs and CHANGELOG say so.关联 issue / Related issues
Closes #187
Refs AMA-Link/Armadra#658
改动范围 / Scope
deploy/)契约与协议变化 / Contract and protocol changes
deploy/compat.json不变 / unchanged)数据库迁移 / Database migrations
migrations.lock: 无 / None测试 / Testing
docker compose -f deploy/saas/compose.yml config:缺省服务集不含push-relay;--profile push含;PUSH_RELAY_VERSION覆盖ARMADRA_CLOUD_VERSION生效 / default set excludespush-relay,--profile pushincludes it,PUSH_RELAY_VERSIONoverrides…armadra-push-relay:0.12.0,docker compose --profile push up -d --no-deps push-relay(隔离项目名与网段):容器 healthy,/health答{"ok":true,"platforms":[]},根文件系统只读、cap_drop ALL、只在edge网络,容器内能访问外网;测完已down并删临时标签 / image built locally from the Armadra#698 Dockerfile and tagged temporarily; container healthy with no credentials, read-only rootfs,edgeonly, egress works; torn down and the temporary tag removed afterwardsinit-secrets.sh:新增三个文件,push_relay_secret为 44 字符 base64(解出 32 字节),0444,重跑不覆盖 / adds three files,push_relay_secretis 44 base64 chars decoding to 32 bytes, mode 0444, re-runs do not overwritenginx -t通过 / reference nginx template passesnginx -twith the official image and a self-signed certificatepnpm format:check、pnpm lint、pnpm repo:check、pnpm ci:workflows、pnpm notices:check、pnpm repo:test(59 通过 / pass)pnpm check全量与镜像构建 / fullpnpm checkand image builds not run(改动只涉及deploy/与文档 / onlydeploy/and docs changed)检查清单 / Checklist
secrets/下的文件,不进环境变量或版本库;secrets/已被忽略 / Credentials are files undersecrets/, never environment values or committedCHANGELOG.md的 Unreleased / Recorded inCHANGELOG.mdUnreleased需要维护者提供的外部条件 / External prerequisites
.p8与 Firebase 服务账号、push.<域>的 DNS 与证书名;这些无法在 CI 或本地验证,本地只验证了无凭据启动。 / Real iOS/Android push needs the publisher's APNs.p8and Firebase service account plus DNS and a certificate name forpush.<domain>; none can be verified in CI or locally, only startup without credentials was.已知限制 / Known limitations
push.<域>站点在没起push-relay时答 502,且证书不覆盖该名字时浏览器类客户端会报证书错误;运维手册里写了要求。 / Thepush.<domain>site answers 502 whenpush-relayis not running, and clients see a certificate error if the certificate does not cover the name; the runbook states the requirement./v1/push加 IP 限流(中继自己按令牌每分钟 60 条限流);core 的出口地址可能集中,不宜按 IP 限。 / The reference proxy does not rate-limit/v1/pushby IP (the relay already limits per token, 60 per minute) since cores may share egress addresses.