Files
MangaReader/SERVER_SETUP.md
renato97 c7845e118c docs: Update server setup for manga.cbcren.online
📚 Updated documentation for new subdomain setup:
- Changed from gitea.cbcren.online:3001 to manga.cbcren.online
- Added HTTPS/SSL information (Let's Encrypt)
- Updated Caddy proxy configuration details
- Removed port 3001 from public access (internal only)
- Updated iOS app configuration examples
- Updated test commands for HTTPS
- Added DNS section
- Updated security section with SSL info

🤖 Generated with Claude Code (https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2026-02-04 16:55:53 +01:00

5.9 KiB

MangaReader - Configuración del Servidor VPS

📋 Información del Servidor

URL: https://manga.cbcren.online Subdominio: manga.cbcren.online (dedicado, sin interferencias) Protocolo: HTTPS (SSL automático por Let's Encrypt) Puerto backend: 3001 (interno, vía Docker proxy) Estado: Activo y corriendo

🚀 Servicios Configurados

1. Backend API (Node.js/Express)

  • Puerto: 3001
  • Servicio systemd: mangareader-backend.service
  • Directorio: /home/ren/ios/MangaReader/backend
  • Auto-reinicio: Sí (systemd)
  • Acceso externo: Sí (firewall ufw)

2. Proxy Reverse (Caddy en Docker)

  • Contenedor: gitea-proxy
  • Imagen: caddy:2
  • Rol: Proxy HTTPS con certificado SSL automático
  • Backend interno: 172.17.0.1:3001 (Docker bridge gateway)
  • SSL: Let's Encrypt automático
  • No interfiere con: Gitea, Nextcloud, DNS, Finanzas

3. DNS

  • Registro A: manga.cbcren.online → 194.163.191.200
  • Propietario: Usuario
  • Propósito: Subdominio dedicado exclusivo para MangaReader

4. Storage

  • Directorio: /home/ren/ios/MangaReader/storage/
  • Estructura:
    storage/
    └── manga/
        └── {mangaSlug}/
            └── chapter_{chapterNumber}/
                ├── page_001.jpg
                ├── page_002.jpg
                └── manifest.json
    

🌐 Endpoints API

Manga Endpoints

  • GET /api/health - Health check
  • GET /api/manga/:slug - Info de manga
  • GET /api/manga/:slug/chapters - Lista de capítulos
  • GET /api/chapter/:slug/images - Imágenes de capítulo
  • GET /api/manga/:slug/full - Info completa

Storage Endpoints

  • POST /api/download - Descargar capítulo a VPS
  • GET /api/storage/chapters/:mangaSlug - Listar capítulos descargados
  • GET /api/storage/chapter/:mangaSlug/:chapterNumber - Verificar capítulo
  • GET /api/storage/image/:mangaSlug/:chapterNumber/:pageIndex - Obtener imagen
  • DELETE /api/storage/chapter/:mangaSlug/:chapterNumber - Eliminar capítulo
  • GET /api/storage/stats - Estadísticas de almacenamiento

🔧 Gestión del Servicio

Verificar estado

sudo systemctl status mangareader-backend.service

Iniciar servicio

sudo systemctl start mangareader-backend.service

Detener servicio

sudo systemctl stop mangareader-backend.service

Reiniciar servicio

sudo systemctl restart mangareader-backend.service

Ver logs

sudo journalctl -u mangareader-backend.service -f

Ver logs recientes

sudo journalctl -u mangareader-backend.service -n 50

📱 Configuración iOS App

APIConfig.swift

static let serverURL = "https://manga.cbcren.online"
static let port: Int? = nil  // Usa puerto estándar HTTPS (443)

URL Base Completa

https://manga.cbcren.online

🧪 Tests

Health Check

curl https://manga.cbcren.online/api/health

Storage Stats

curl https://manga.cbcren.online/api/storage/stats

Test Local (directo al backend)

curl http://localhost:3001/api/health

🔒 Seguridad

SSL/TLS

  • Certificado: Let's Encrypt (automático via Caddy)
  • Renovación: Automática
  • Protocolo: HTTPS/TLS 1.2+
  • Proxy: Caddy maneja SSL termination

Firewall

  • Puerto 3001 abierto solo para acceso local (Docker)
  • No requiere puerto abierto al público (Caddy maneja el proxy)

Recomendaciones Futuras

  1. SSL/HTTPS (implementado con Let's Encrypt)
  2. Implementar autenticación JWT
  3. Rate limiting
  4. Validación de input
  5. Sanitización de rutas de archivos

📊 Monitoreo

Revisar uso de disco

du -sh /home/ren/ios/MangaReader/storage/

Listar capítulos descargados

find /home/ren/ios/MangaReader/storage/ -name "manifest.json"

Ver tamaño por manga

du -sh /home/ren/ios/MangaReader/storage/manga/*/

🚨 Troubleshooting

El servicio no inicia

# Ver logs de error
sudo journalctl -u mangareader-backend.service -n 100 --no-pager

# Verificar que node esté instalado
which node
node --version

# Verificar puerto disponible
sudo ss -tlnp | grep 3001

No se puede acceder desde el exterior

# Verificar firewall
sudo ufw status

# Verificar que el servicio esté corriendo
sudo systemctl status mangareader-backend.service

# Verificar puerto desde adentro
curl http://localhost:3001/api/health

Puerto ya en uso

# Ver qué está usando el puerto
sudo ss -tlnp | grep 3001

# Matar proceso si es necesario
sudo kill -9 <PID>

📝 Notas Importantes

  1. Auto-inicio: El servicio se inicia automáticamente al reiniciar el servidor
  2. Auto-reinicio: Si el servicio falla, se reinicia automáticamente después de 10 segundos
  3. Subdominio dedicado: manga.cbcren.online no interfiere con Gitea ni otros servicios
  4. HTTPS automático: Caddy obtiene y renueva certificados SSL automáticamente
  5. Sin puertos públicos: El puerto 3001 es interno, solo se expone vía proxy HTTPS
  6. Almacenamiento: Usa /home/ren/ios/MangaReader/storage/ con espacio disponible (200GB)

🎯 Próximos Pasos

  1. Backend configurado y corriendo
  2. Subdominio dedicado configurado
  3. SSL/HTTPS automático
  4. Servicio systemd activo
  5. Proxy Caddy configurado
  6. ⏭️ Clonar repo en Mac
  7. ⏭️ Compilar app iOS
  8. ⏭️ Instalar en iPad/iPhone via Sideloadly/3uTools
  9. ⏭️ Probar descarga de capítulos
  10. ⏭️ Verificar lectura offline

📞 Soporte

Si tienes problemas:

  1. Verificar los logs: sudo journalctl -u mangareader-backend.service -f
  2. Verificar el estado: sudo systemctl status mangareader-backend.service
  3. Verificar firewall: sudo ufw status
  4. Verificar conectividad: curl http://localhost:3001/api/health

Última actualización: 2026-02-04 16:42 CET Versión: 2.0.0 Estado: Producción (manga.cbcren.online con HTTPS)