Files
Proxmox-Coolify-Manager/docs/runbooks/nextcloud.md
T

99 lines
3.7 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://...`
## 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.