diff --git a/SERVER_SETUP.md b/SERVER_SETUP.md index b2ad5a9..2ec68ae 100644 --- a/SERVER_SETUP.md +++ b/SERVER_SETUP.md @@ -2,9 +2,10 @@ ## 📋 Información del Servidor -**URL:** http://gitea.cbcren.online:3001 -**Puerto:** 3001 -**Protocolo:** HTTP +**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 @@ -16,12 +17,20 @@ - **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 +### 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. Storage +### 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:** ``` @@ -87,41 +96,47 @@ sudo journalctl -u mangareader-backend.service -n 50 ### APIConfig.swift ```swift -static let serverURL = "http://gitea.cbcren.online" -static let port: Int = 3001 +static let serverURL = "https://manga.cbcren.online" +static let port: Int? = nil // Usa puerto estándar HTTPS (443) ``` ### URL Base Completa ``` -http://gitea.cbcren.online:3001 +https://manga.cbcren.online ``` ## 🧪 Tests ### Health Check ```bash -curl http://gitea.cbcren.online:3001/api/health +curl https://manga.cbcren.online/api/health ``` ### Storage Stats ```bash -curl http://gitea.cbcren.online:3001/api/storage/stats +curl https://manga.cbcren.online/api/storage/stats ``` -### Test Local +### Test Local (directo al backend) ```bash 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 para acceso externo -- No se requiere autenticación (por ahora) +- Puerto 3001 abierto solo para acceso local (Docker) +- No requiere puerto abierto al público (Caddy maneja el proxy) ### Recomendaciones Futuras -1. Implementar autenticación JWT -2. Usar HTTPS con certificado SSL +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 @@ -183,20 +198,23 @@ sudo kill -9 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. **No interfiere con Gitea:** Usa puerto diferente (3001 vs 3000) -4. **No interfiere con otros servicios:** Puerto independiente y firewall específico -5. **Almacenamiento:** Usa /home/ren/ios/MangaReader/storage/ con espacio disponible (200GB) +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. ✅ Firewall configurado -3. ✅ Servicio systemd activo -4. ⏭️ Clonar repo en Mac -5. ⏭️ Compilar app iOS -6. ⏭️ Instalar en iPad/iPhone via Sideloadly/3uTools -7. ⏭️ Probar descarga de capítulos -8. ⏭️ Verificar lectura offline +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 @@ -207,6 +225,6 @@ Si tienes problemas: 4. Verificar conectividad: `curl http://localhost:3001/api/health` --- -**Última actualización:** 2026-02-04 -**Versión:** 1.0.0 -**Estado:** ✅ Producción +**Última actualización:** 2026-02-04 16:42 CET +**Versión:** 2.0.0 +**Estado:** ✅ Producción (manga.cbcren.online con HTTPS)