📚 Added comprehensive server setup documentation including: - Service information and endpoints - Systemd service management commands - Firewall configuration - Troubleshooting guide - Monitoring commands - Security recommendations 🤖 Generated with Claude Code (https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
4.9 KiB
4.9 KiB
MangaReader - Configuración del Servidor VPS
📋 Información del Servidor
URL: http://gitea.cbcren.online:3001 Puerto: 3001 Protocolo: HTTP 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. Firewall (UFW)
- Puerto 3001: Abierto para TCP
- Comando:
sudo ufw allow 3001/tcp - Estado: ✅ Activo
3. 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 = "http://gitea.cbcren.online"
static let port: Int = 3001
URL Base Completa
http://gitea.cbcren.online:3001
🧪 Tests
Health Check
curl http://gitea.cbcren.online:3001/api/health
Storage Stats
curl http://gitea.cbcren.online:3001/api/storage/stats
Test Local
curl http://localhost:3001/api/health
🔒 Seguridad
Firewall
- Puerto 3001 abierto para acceso externo
- No se requiere autenticación (por ahora)
Recomendaciones Futuras
- Implementar autenticación JWT
- Usar HTTPS con certificado SSL
- 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
- No interfiere con Gitea: Usa puerto diferente (3001 vs 3000)
- No interfiere con otros servicios: Puerto independiente y firewall específico
- Almacenamiento: Usa /home/ren/ios/MangaReader/storage/ con espacio disponible (200GB)
🎯 Próximos Pasos
- ✅ Backend configurado y corriendo
- ✅ Firewall configurado
- ✅ Servicio systemd activo
- ⏭️ 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 Versión: 1.0.0 Estado: ✅ Producción