📚 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>
5.9 KiB
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 checkGET /api/manga/:slug- Info de mangaGET /api/manga/:slug/chapters- Lista de capítulosGET /api/chapter/:slug/images- Imágenes de capítuloGET /api/manga/:slug/full- Info completa
Storage Endpoints
POST /api/download- Descargar capítulo a VPSGET /api/storage/chapters/:mangaSlug- Listar capítulos descargadosGET /api/storage/chapter/:mangaSlug/:chapterNumber- Verificar capítuloGET /api/storage/image/:mangaSlug/:chapterNumber/:pageIndex- Obtener imagenDELETE /api/storage/chapter/:mangaSlug/:chapterNumber- Eliminar capítuloGET /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
- ✅ SSL/HTTPS (implementado con Let's Encrypt)
- Implementar autenticación JWT
- Rate limiting
- Validación de input
- 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
- Auto-inicio: El servicio se inicia automáticamente al reiniciar el servidor
- Auto-reinicio: Si el servicio falla, se reinicia automáticamente después de 10 segundos
- Subdominio dedicado: manga.cbcren.online no interfiere con Gitea ni otros servicios
- HTTPS automático: Caddy obtiene y renueva certificados SSL automáticamente
- Sin puertos públicos: El puerto 3001 es interno, solo se expone vía proxy HTTPS
- Almacenamiento: Usa /home/ren/ios/MangaReader/storage/ con espacio disponible (200GB)
🎯 Próximos Pasos
- ✅ Backend configurado y corriendo
- ✅ Subdominio dedicado configurado
- ✅ SSL/HTTPS automático
- ✅ Servicio systemd activo
- ✅ Proxy Caddy configurado
- ⏭️ Clonar repo en Mac
- ⏭️ Compilar app iOS
- ⏭️ Instalar en iPad/iPhone via Sideloadly/3uTools
- ⏭️ Probar descarga de capítulos
- ⏭️ Verificar lectura offline
📞 Soporte
Si tienes problemas:
- Verificar los logs:
sudo journalctl -u mangareader-backend.service -f - Verificar el estado:
sudo systemctl status mangareader-backend.service - Verificar firewall:
sudo ufw status - 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)