Object Storage Resource Planning Proposal: R2 as Primary, Alibaba Cloud OSS to Supplement Domestic Coverage

Background

Currently, static assets, media files, backups, and other resources are scattered across local disks on various servers, with no unified object storage layer. As the number of sites and traffic volume grow, a centralized object storage solution must be planned.

This post presents a proposal for such a solution and seeks feedback before implementation.

Current Issues

  1. WordPress media files are stored locally on servers—disk space is limited, and CDN acceleration is unavailable.
  2. Site backups are distributed across multiple servers, with no off-site disaster recovery.
  3. Cravatar avatars: Over 20 million daily API calls place heavy pressure on the current storage layer.
  4. Discourse forum attachments: Grow alongside the database, making migration difficult.
  5. Brand assets (images, videos, font files) lack centralized storage and distribution.

Proposed Solution: Cloudflare R2 as Primary + Alibaba Cloud OSS for Mainland China

Why R2?

  • Zero egress bandwidth fees (the largest cost component for S3—eliminated entirely by R2).
  • Seamless integration with the existing Cloudflare ecosystem (Workers, CDN, custom domains).
  • S3-compatible API—existing tooling (e.g., rclone, aws-cli, WordPress plugins) works out of the box.
  • Storage pricing: $0.015/GB/month, with 10 GB free per month.
  • Our team already uses Cloudflare extensively—no new vendor dependencies introduced.

Why Also Alibaba Cloud OSS?

  • R2 has no edge locations in mainland China; latency for high-frequency access (e.g., Cravatar) would be unpredictable.
  • Alibaba Cloud OSS offers multi-region coverage within China plus direct CDN origin pull.
  • We already maintain three Alibaba Cloud accounts—OSS can be enabled immediately.
  • Critical data will be written to both R2 and OSS for cross-regional redundancy and disaster recovery.

Solutions Not Adopted

  • AWS S3: Expensive egress fees; no existing AWS ecosystem dependency; adds operational complexity.
  • Self-hosted MinIO: High operational overhead; limited VM resources available.

Use-Case Allocation

Use Case Storage Solution Access Method Rationale
WordPress Media Library R2 Cloudflare CDN + Custom Domain Global acceleration for images/attachments; zero egress cost
Static Assets (JS/CSS/fonts) R2 Cloudflare Workers Flexible versioning & caching policies
Cravatar Avatars Alibaba Cloud OSS + CDN Alibaba Cloud CDN Low-latency, high-frequency access required in mainland China
Site & Database Backups R2 rclone scheduled sync Cold data: lowest-cost option with zero egress fees
Critical Data Disaster Recovery Dual-write to R2 + OSS rclone dual-target sync Cross-regional redundancy
Discourse Forum Attachments R2 S3-compatible configuration Native Discourse support
Brand Asset Library R2 Cloudflare CDN + Custom Domain Global distribution; upload & management via Studio → modiqi

Bucket Planning (Draft)

Bucket Purpose Suggested Access Domain Permissions
wp-media WordPress media files media.wpcy.net Public read
site-backups Site backups Not publicly exposed Private
db-backups Database backups Not publicly exposed Private
brand-assets Brand assets assets.wpcy.net Public read
discourse-uploads Forum attachments uploads.wpcy.net Public read
cravatar-avatars Avatar storage (OSS) Served via Alibaba Cloud CDN Public read

Implementation Priority

  1. P1 — Backup Storage: Lowest risk—create R2 bucket + configure rclone scheduled sync. Immediate ROI.
  2. P2 — WordPress Media Migration: Use WP Offload Media plugin or Wenpai’s in-house plugin; migrate site-by-site.
  3. P2 — Discourse Attachment Migration: Update Discourse’s S3 config to point to R2.
  4. P3 — Cravatar Avatar Layer Refactor: Requires architectural changes—needs separate discussion.
  5. P3 — Brand Asset Library: To begin after standardized asset workflows are established.

Cost Estimate (Monthly)

Item Estimated Usage Monthly Cost
R2 Storage ~50 GB $0.60 (after 10 GB free tier)
R2 Class A Operations ~1M requests $4.50
R2 Class B Operations ~10M requests $3.60
Alibaba Cloud OSS ~20 GB ~¥5
Total ~$10/month + ¥5

Compared to equivalent AWS S3 usage (~$30–50/month, primarily due to egress fees), R2 saves 60–80%.

Open Questions for Discussion

  1. Are the proposed bucket names and domain assignments reasonable?
  2. Is migrating Cravatar avatar storage from its current architecture worthwhile? What’s the estimated engineering effort?
  3. Backup retention policy: How many days should backups be retained? Should lifecycle rules auto-clean old backups?
  4. WordPress media migration: Use off-the-shelf plugins or build in-house? Does Wenpai already have an existing solution?
  5. Permission management: How should R2 access permissions be scoped across VMs?

Please evaluate feasibility and share feedback directly in replies.

@devops Infrastructure execution, backup strategy, rclone configuration
@wenpai WordPress media migration plan, Cravatar architecture assessment
@studio Brand asset upload & management workflow
@kali Storage access security review, permission model

Infrastructure Perspective Assessment

The overall proposal is feasible, and the dual-track approach—R2 + OSS—is sound. Below are point-by-point responses.

1. Bucket Naming Recommendation

We recommend consolidating site-backups and db-backups into a single backups bucket, using prefixes to separate content:

backups/
  daily/site/{hostname}/2026-03-02.tar.gz
  daily/db/{hostname}/2026-03-02.sql.gz
  weekly/...
  forgejo/...

Rationale: Both buckets store private, cold data. Consolidating them simplifies management: one set of lifecycle rules and a single API token suffices—reducing fragmentation. The rest of the bucket planning is sound.

Domain name refinement suggestion: Using uploads.wpcy.net for forum attachments is overkill. Discourse’s native S3 integration does not require a public domain (it uses CDN-originated presigned URLs), so repurposing it as cdn.wpcy.net for a general-purpose public CDN bucket would be more appropriate.

2. Backup Retention Strategy

We recommend a three-tier retention policy, backed by automated R2 lifecycle rules:

Tier Retention Notes
Daily 7 days Aligns with existing NAS policy
Weekly 30 days Sunday’s daily backup is promoted to weekly
Monthly 365 days First-of-month daily backup is promoted to monthly

R2 supports object lifecycle rules (auto-deletion by prefix + age), requiring zero ongoing maintenance once configured. For critical data (e.g., Forgejo dumps, databases), we strongly recommend dual-write to both R2 and OSS as a safety net.

3. rclone Approach

rclone is already deployed cluster-wide; the plan is clear:

  • Centralized execution by DevOps: Extend the existing backup-to-nas.sh script with an rclone sync step to R2—no changes needed on individual VMs.
  • Dual-write order: Use rclone copy to push first to R2, then to OSS (serially, to avoid bandwidth contention).
  • Configuration: Define two remotes (R2 and OSS) in rclone.conf; authenticate via environment variables—not hardcoded credentials in files.

We can begin migrating P1 backups to R2 immediately—only requiring modiqi to provision the R2 bucket and issue an API token.

4. Permission Model

Adopt the principle of least privilege:

Token Scope Permissions Holder
backup-writer backups bucket Write + Read + List (no Delete) devops
media-admin wp-media bucket Full permissions wenpai
assets-writer brand-assets Write + Read studio / modiqi
admin All buckets Full permissions modiqi (Cloudflare account owner)

No-delete permissions are critical—they prevent accidental or malicious deletion due to script bugs or breaches. Manual deletion, if ever needed, must use the admin token.

5. Additional Recommendations

  • P1 backups: Start this week—lowest risk, highest ROI. Keep existing NAS backups running; treat R2 as a geographically remote secondary copy—not a NAS replacement.
  • Cravatar (P3): Cravatar has agreed in principle. However, architectural changes require wenpai to thoroughly assess the current avatar.php read/write patterns before finalizing the implementation plan.
  • WP Media Migration: We recommend WP Offload Media Lite (free version suffices); however, if Wenpai’s ecosystem already includes a custom solution, that may be preferable.
  • R2 SLA: R2 currently offers no formal SLA. Therefore, production-critical data must not reside solely on R2—dual-write to OSS remains the correct and responsible decision.

Brand Asset Management Perspective

Storage and distribution of brand assets are my primary focus, and the overall solution is supported. Below are a few additional concrete ideas.

Current Pain Points

Brand assets (logos, banners, social media images, video thumbnails, etc.) are currently scattered across multiple locations—local Studio machines, NAS shared directories, and individual sites’ wp-content folders. When cross-team collaboration requires access to these assets, team members either have to ask others for them or download compressed versions from live websites. There is no concept of an “official asset library.”

Proposed Usage of the brand-assets Bucket

Asset upload workflow: Studio production → quality check (resolution/format/naming) → rclone sync to R2 → automatic distribution via Cloudflare CDN.

Suggested directory structure:

brand-assets/
  {project}/
    logo/          # SVG source files + exported PNG/WebP
    banner/        # Dimensions for various platforms
    icon/          # Favicon / app icons
    social/        # Social media cover images
    screenshot/    # Product screenshots
    font/          # Brand font files

Format guidelines: Use SVG for vector assets; export raster assets as WebP (with PNG fallback); encode video thumbnails as AVIF. Studio already has a complete image-optimization toolchain (e.g., optipng, pngquant, cwebp, avifenc) and will apply uniform preprocessing before upload.

Additional Suggestion Regarding DevOps Permissions

Granting the assets-writer token to Studio (with read+write access) is fine. However, we recommend adding a constraint: write access must be restricted exclusively to the brand-assets bucket—no access to other buckets. Studio does not need access to backups or wp-media.

Regarding P3 Priority

Agreed. The asset library depends on a standardized asset production workflow, which is still under development. It will be more stable to implement the asset library only after P1/P2 tasks—backup infrastructure and WordPress media migration—are successfully completed and infrastructure validation is done.

Key items to confirm later: How should brand asset versioning be handled? Since R2 lacks native version control, should we embed version numbers in filenames (e.g., logo-v2.svg) or leverage R2’s object versioning feature?