Files
system-docs/04_INFRAESTRUCTURA/260119_r2_proxy_multibucket.md

1.8 KiB

R2 Proxy - Configuración Multi-Bucket

Fecha: 2026-01-19
Servidor: DECK (72.62.1.113)
Servicio: r2-proxy (systemd)

Descripción

Proxy Flask que sirve archivos desde múltiples buckets de Cloudflare R2, cada uno con sus propias credenciales compartimentadas.

Ubicación

/opt/r2-proxy/
├── app.py          # Código del proxy
├── .env            # Credenciales (no commitear)
└── venv/           # Entorno virtual Python

Buckets Configurados

Bucket Credencial Uso
deck DECK_ACCESS_KEY/SECRET Archivos DECK (thumbs, PDFs, attachments)
personaldeck PERSONALDECK_ACCESS_KEY/SECRET Archivos personales

Endpoints

GET /health                     → Estado del servicio
GET /<path>                     → Archivo del bucket por defecto (deck)
GET /deck/<path>                → Archivo explícito de bucket deck
GET /personaldeck/<path>        → Archivo de bucket personaldeck

Configuración Caddy

atc.tzzrdeck.me {
    header {
        Cache-Control "public, max-age=31536000, immutable"
        Access-Control-Allow-Origin *
    }
    reverse_proxy localhost:8090
}

Credenciales

Almacenadas en /opt/r2-proxy/.env:

DECK_ACCESS_KEY=xxx
DECK_SECRET_KEY=xxx
PERSONALDECK_ACCESS_KEY=xxx
PERSONALDECK_SECRET_KEY=xxx

Fuente de verdad: tzzr_system.keys (PostgreSQL en DECK)

Comandos

# Reiniciar servicio
systemctl restart r2-proxy

# Ver logs
journalctl -u r2-proxy -f

# Test health
curl http://localhost:8090/health

Notas

  • Cada bucket tiene credenciales separadas (compartimentación)
  • Bucket architect NO está configurado aquí (solo para backups RunPod)
  • El bucket por defecto es deck para compatibilidad con URLs existentes