Files
urieljareth f587a8baa2 Agrega scripts y runbooks: Cloudflare API, autostart Coolify, parche Chatwoot, deploy Solo Leveling + docs de casos
- scripts/Invoke-CloudflareApi.ps1: control de tunnel/DNS via API
- scripts/Install-CoolifyAutostart.ps1 + scripts/host/: autostart de LXC 102 + tunnel tras corte
- scripts/Apply-ChatwootEnterprisePatch.ps1: parche enterprise (autodetecta creds)
- Deploy-SoloLeveling.ps1: deploy build-on-server verificado
- docs/runbooks/cloudflare-tunnel.md y autostart-coolify.md
- docs/casos/chatwoot-enterprise-patch.md (credenciales redactadas)
- docs/AGENTS-coolify-apps.md + issues y reportes
- deploy_skill/references/coolify-4.1.2-notes.md: hallazgos verificados (seccion 7)
- package.json para verify-online.mjs del coolify-deploy skill
- .gitignore: excluye .claude/ y .opencode/ (config local de herramientas)
2026-07-18 11:31:31 -06:00

145 lines
5.2 KiB
Markdown

# Runbook: Nextcloud en Coolify
Servicio verificado: `hdcdpkm0jko3qqvn5683ercc`
Dominio: `https://nextcloudsuite.urieljareth.org`
## Estado de contenedores
```powershell
.\scripts\Invoke-ProxmoxSsh.ps1 -Command "pct exec 102 -- docker ps -a --format 'table {{.Names}}\t{{.Status}}\t{{.Ports}}' | grep -Ei 'nextcloud|hdcdpkm0'"
```
## Redeploy manual desde compose generado por Coolify
Si el endpoint API de Coolify no esta disponible o no hay token cargado:
```powershell
.\scripts\Invoke-ProxmoxSsh.ps1 -Command "pct exec 102 -- sh -lc 'cd /data/coolify/services/hdcdpkm0jko3qqvn5683ercc && docker compose up -d'"
```
## Fix HTTPS reverse proxy
No usar `sed` para editar `config.php`. Usar el script PHP del repo:
```powershell
scp -o StrictHostKeyChecking=no -i "C:\Users\Uriel Jareth\.openclaw\workspace\proxmox_key_win" .\scripts\fix-nextcloud-config.php root@192.168.0.200:/tmp/fix-nextcloud-config.php
.\scripts\Invoke-ProxmoxSsh.ps1 -Command "pct push 102 /tmp/fix-nextcloud-config.php /tmp/fix-nextcloud-config.php"
.\scripts\Invoke-ProxmoxSsh.ps1 -Command "pct exec 102 -- docker cp /tmp/fix-nextcloud-config.php nextcloud-hdcdpkm0jko3qqvn5683ercc:/tmp/fix-nextcloud-config.php"
.\scripts\Invoke-ProxmoxSsh.ps1 -Command "pct exec 102 -- docker exec nextcloud-hdcdpkm0jko3qqvn5683ercc php /tmp/fix-nextcloud-config.php /config/www/nextcloud/config/config.php nextcloudsuite.urieljareth.org nextcloud-db"
.\scripts\Invoke-ProxmoxSsh.ps1 -Command "pct exec 102 -- docker exec nextcloud-hdcdpkm0jko3qqvn5683ercc sh -lc 'chown abc:users /config/www/nextcloud/config/config.php && chmod 640 /config/www/nextcloud/config/config.php'"
```
Debe quedar:
```php
'overwriteprotocol' => 'https',
'overwritehost' => 'nextcloudsuite.urieljareth.org',
'overwrite.cli.url' => 'https://nextcloudsuite.urieljareth.org',
'dbhost' => 'nextcloud-db',
```
En el instalador web, el campo de host PostgreSQL debe ser `nextcloud-db`, no
`localhost`. `localhost` apunta al contenedor de Nextcloud, no al contenedor
PostgreSQL.
## Pruebas
```powershell
curl.exe -k -i -L --max-time 30 https://nextcloudsuite.urieljareth.org/status.php
curl.exe -k -sSI --max-time 30 https://nextcloudsuite.urieljareth.org/login
curl.exe -k -sSI --max-time 30 https://nextcloudsuite.urieljareth.org/remote.php/dav
```
## Error `permission denied for table oc_migrations`
Si el instalador muestra:
```text
SQLSTATE[42501]: Insufficient privilege: 7 ERROR: permission denied for table oc_migrations
```
primero verificar el estado real antes de resetear volumenes. En una instalacion
parcial, el formulario puede fallar mientras la base queda creada.
Comprobaciones seguras:
```powershell
curl.exe -k -sS --max-time 30 https://nextcloudsuite.urieljareth.org/status.php
.\scripts\Invoke-ProxmoxSsh.ps1 -Command "pct exec 102 -- docker exec nextcloud-hdcdpkm0jko3qqvn5683ercc sh -lc 'cd /app/www/public && s6-setuidgid abc php occ status'"
```
Verificar desde Nextcloud con el usuario real de `config.php`, sin imprimir la
password: conectar por PDO y ejecutar `select count(*) from oc_migrations`.
Si funciona, no reparar permisos: la instancia ya puede usar la tabla.
Estado verificado el 2026-05-31:
- `installed`: `true`
- `maintenance`: `false`
- `needsDbUpgrade`: `false`
- `dbhost`: `nextcloud-db`
- usuario activo de Nextcloud en PostgreSQL: `oc_admin`
- `oc_admin` puede leer `oc_migrations`
- `oc_users`: 1 usuario
Resultado verificado tras recuperacion:
- `status.php`: `200 OK`
- `installed`: `true`
- `maintenance`: `false`
- container Nextcloud: `running healthy`
- redirects HTTPS probados sin `Location: http://...`
## Si el contenedor esta healthy pero la UI sale vacia
Verificar primero desde fuera:
```powershell
curl.exe -k -sS --max-time 30 https://nextcloudsuite.urieljareth.org/status.php
curl.exe -k -sS -o NUL -w "status=%{http_code} total=%{time_total} starttransfer=%{time_starttransfer}`n" --max-time 30 https://nextcloudsuite.urieljareth.org/login
```
Verificar estado interno:
```powershell
.\scripts\Invoke-ProxmoxSsh.ps1 -Command "pct exec 102 -- docker exec nextcloud-hdcdpkm0jko3qqvn5683ercc php /app/www/public/occ status"
.\scripts\Invoke-ProxmoxSsh.ps1 -Command "pct exec 102 -- docker exec nextcloud-hdcdpkm0jko3qqvn5683ercc php /app/www/public/occ user:list"
```
Si el usuario existe pero no aparecen archivos, reindexar solo ese usuario:
```powershell
.\scripts\Invoke-ProxmoxSsh.ps1 -Command "pct exec 102 -- docker exec nextcloud-hdcdpkm0jko3qqvn5683ercc php /app/www/public/occ files:scan --path='urieljareth/files'"
```
Resultado verificado el 2026-06-10:
- `status.php`: `installed=true`, `maintenance=false`
- `/login`: `200 OK`, ~0.4s
- `urieljareth/files`: 143 archivos, 151 MB
- `files:scan`: 143 archivos, 0 errores
## PHP-FPM saturado
Los logs han mostrado:
```text
server reached pm.max_children setting (5), consider raising it
```
El override persistente esta en:
```text
/config/php/www2.conf
```
Ese cambio requiere recargar/reiniciar solo el contenedor Nextcloud para aplicar.
No requiere reiniciar `coolify-proxy`, Cloudflare ni otros proyectos.
## Pendiente tras reset de volumenes
Si el volumen de configuracion/base de datos fue eliminado, Nextcloud queda como
instancia fresca. Hay que completar instalacion inicial antes de usar la app de
escritorio.