Building the MyZubster Metaverse: Realtime Infrastructure, Security, Reliability, and What Comes Next
说明与用途
MyZubster 元宇宙现在拥有生产级实时基础设施,包括身份验证会话、服务器授权操作、Redis 分布式存在、滥用防护、隐私安全可观测性和就绪端点,并将预览部署与生产机密隔离。
问题
The MyZubster Metaverse needed a production‑ready, secure, and observable realtime infrastructure that could scale horizontally, protect against abuse, and isolate preview deployments from production secrets.
结果
The metaverse now supports authenticated, server‑authorized actions, scalable realtime presence, distributed abuse protection, privacy‑safe observability, and a robust readiness endpoint, while preview environments are isolated from production secrets.
工作流
- 1. Implement authenticated sessions and server‑side authorization for world actions.
- 2. Create a dedicated realtime token endpoint with minimal claims.
- 3. Define explicit channel families and validate channel access per user.
- 4. Replace single‑process presence with a Redis‑backed presence store and local fallback.
- 5. Wrap Redis operations with failure handling and expose degraded state via readiness.
- 6. Build a distributed rate‑limiting path using Redis shared counters.
- 7. Implement privacy‑safe observability with aggregate metrics and restricted access.
- 8. Add a public readiness endpoint that checks router, MongoDB, and Redis.
- 9. Reuse the shared Redis client for readiness to avoid false positives.
- 10. Isolate preview deployments with dedicated MongoDB and Redis resources.
- 11. Add automated tests for presence store and realtime routes, and run CI workflows.
- 12. Track progress in a draft pull request and identify security blockers.
证据
We introduced a dedicated token endpoint for the realtime subsystem.
Redis keeps short‑lived connection records for users inside community and session channels.
The realtime metrics endpoint is restricted to administrators and exposes aggregate counters rather than individual user activity.
We added tests at two levels. Presence‑store tests verify that the service reports Redis as connected after a successful ping.
- 记录日期: 2026-10-23T06:11:19.772Z