Compare commits

..
Author SHA1 Message Date
hermes 9ac790f8f3 feat: pull del modelo respeta HTTPS_PROXY
Tu red no llega al registry de Ollama (R2/Cloudflare). Si hay proxy
definido en HTTPS_PROXY, se pasa al contenedor en el pull (doc oficial
de Ollama para Docker). Sin proxy, el mensaje de error explica como
definirlo y relanzar.
2026-09-12 20:58:42 +02:00
4 changed files with 44 additions and 116 deletions

No files matched your search

+11 -29
View File
@@ -125,41 +125,23 @@ Warn ' Descargando modelo (llama3.2:3b, ~2 GB)...'
# Si el usuario define $env:HTTPS_PROXY, Ollama lo usa para el pull (doc oficial):
$ProxyEnv = @()
if ($env:HTTPS_PROXY) { $ProxyEnv = @('-e', "HTTPS_PROXY=$env:HTTPS_PROXY", '-e', "HTTP_PROXY=$env:HTTP_PROXY") }
# --- Modelo: HF primero (CDN propio, rapido) y registry de Ollama como ultimo recurso ---
$Gguf = Join-Path $ScriptDir 'llama3.2-3b-q4.gguf'
$HfUrls = @(
'https://huggingface.co/bartowski/Llama-3.2-3B-Instruct-GGUF/resolve/main/Llama-3.2-3B-Instruct-Q4_K_M.gguf',
'https://huggingface.co/unsloth/Llama-3.2-3B-Instruct-GGUF/resolve/main/Llama-3.2-3B-Instruct-Q4_K_M.gguf'
)
foreach ($Url in $HfUrls) {
Info 'Descargando modelo de IA (llama3.2:3b, ~2 GB)...'
curl.exe -sL --retry 3 --max-time 1800 -o "$Gguf" $Url
if ($LASTEXITCODE -eq 0 -and (Test-Path $Gguf) -and (Get-Item $Gguf).Length -gt 1900000000) { break }
Warn "Mirror no accesible, probando el siguiente..."
Remove-Item "$Gguf" -Force -ErrorAction SilentlyContinue
}
if ((Test-Path $Gguf) -and (Get-Item $Gguf).Length -gt 1900000000) {
Info 'Importando modelo en Ollama...'
docker cp "$Gguf" d0a1-hermes-ollama:/root/.ollama/import.gguf
docker exec d0a1-hermes-ollama sh -c 'echo FROM /root/.ollama/import.gguf > /tmp/mf && ollama create llama3.2:3b -f /tmp/mf'
$CreateOk = ($LASTEXITCODE -eq 0)
docker exec d0a1-hermes-ollama rm -f /root/.ollama/import.gguf | Out-Null
Remove-Item "$Gguf" -Force -ErrorAction SilentlyContinue
$PullOk = $CreateOk
if (-not $CreateOk) { Err 'Fallo al importar el modelo desde el GGUF.' }
} else {
# Ultimo recurso: pull directo (1 intento, ya sin esperar 3 rondas)
Warn 'HuggingFace no accesible. Probando el registry de Ollama (ultimo recurso)...'
$PullOk = $false
foreach ($Attempt in 1..3) {
if ($Attempt -gt 1) { Warn "Reintento $Attempt de 3..." }
docker exec @ProxyEnv d0a1-hermes-ollama ollama pull llama3.2:3b
if ($LASTEXITCODE -eq 0) { $PullOk = $true }
if ($LASTEXITCODE -eq 0) { $PullOk = $true; break }
Warn 'Descarga interrumpida (red). Reintentando en 5 s...'
Start-Sleep -Seconds 5
}
if (-not $PullOk) {
Err 'No se pudo descargar el modelo (ni HuggingFace ni registry).'
Err 'Fallo la descarga del modelo tras 3 intentos.'
if (-not $env:HTTPS_PROXY) {
Write-Host ' Tu red bloquea ambos. Si tienes proxy/VPN:'
Write-Host ' $env:HTTPS_PROXY = "http://127.0.0.1:7890" # (puerto de tu proxy)'
Write-Host ' Tu red no llega al registry de Ollama. Si tienes proxy/VPN, lanzalo y:'
Write-Host ' $env:HTTPS_PROXY = "http://127.0.0.1:7890" # (ajusta al puerto de tu proxy)'
Write-Host ' .\deploy.ps1 vps'
}
Write-Host ' O reintenta a mano:'
Write-Host ' docker exec d0a1-hermes-ollama ollama pull llama3.2:3b'
exit 1
}
Ok "Ollama corriendo en http://localhost:${OllamaPort}"
+11 -29
View File
@@ -125,41 +125,23 @@ Warn ' Descargando modelo (llama3.2:3b, ~2 GB)...'
# Si el usuario define $env:HTTPS_PROXY, Ollama lo usa para el pull (doc oficial):
$ProxyEnv = @()
if ($env:HTTPS_PROXY) { $ProxyEnv = @('-e', "HTTPS_PROXY=$env:HTTPS_PROXY", '-e', "HTTP_PROXY=$env:HTTP_PROXY") }
# --- Modelo: HF primero (CDN propio, rapido) y registry de Ollama como ultimo recurso ---
$Gguf = Join-Path $ScriptDir 'llama3.2-3b-q4.gguf'
$HfUrls = @(
'https://huggingface.co/bartowski/Llama-3.2-3B-Instruct-GGUF/resolve/main/Llama-3.2-3B-Instruct-Q4_K_M.gguf',
'https://huggingface.co/unsloth/Llama-3.2-3B-Instruct-GGUF/resolve/main/Llama-3.2-3B-Instruct-Q4_K_M.gguf'
)
foreach ($Url in $HfUrls) {
Info 'Descargando modelo de IA (llama3.2:3b, ~2 GB)...'
curl.exe -sL --retry 3 --max-time 1800 -o "$Gguf" $Url
if ($LASTEXITCODE -eq 0 -and (Test-Path $Gguf) -and (Get-Item $Gguf).Length -gt 1900000000) { break }
Warn "Mirror no accesible, probando el siguiente..."
Remove-Item "$Gguf" -Force -ErrorAction SilentlyContinue
}
if ((Test-Path $Gguf) -and (Get-Item $Gguf).Length -gt 1900000000) {
Info 'Importando modelo en Ollama...'
docker cp "$Gguf" d0a1-openclaw-ollama:/root/.ollama/import.gguf
docker exec d0a1-openclaw-ollama sh -c 'echo FROM /root/.ollama/import.gguf > /tmp/mf && ollama create llama3.2:3b -f /tmp/mf'
$CreateOk = ($LASTEXITCODE -eq 0)
docker exec d0a1-openclaw-ollama rm -f /root/.ollama/import.gguf | Out-Null
Remove-Item "$Gguf" -Force -ErrorAction SilentlyContinue
$PullOk = $CreateOk
if (-not $CreateOk) { Err 'Fallo al importar el modelo desde el GGUF.' }
} else {
# Ultimo recurso: pull directo (1 intento, ya sin esperar 3 rondas)
Warn 'HuggingFace no accesible. Probando el registry de Ollama (ultimo recurso)...'
$PullOk = $false
foreach ($Attempt in 1..3) {
if ($Attempt -gt 1) { Warn "Reintento $Attempt de 3..." }
docker exec @ProxyEnv d0a1-openclaw-ollama ollama pull llama3.2:3b
if ($LASTEXITCODE -eq 0) { $PullOk = $true }
if ($LASTEXITCODE -eq 0) { $PullOk = $true; break }
Warn 'Descarga interrumpida (red). Reintentando en 5 s...'
Start-Sleep -Seconds 5
}
if (-not $PullOk) {
Err 'No se pudo descargar el modelo (ni HuggingFace ni registry).'
Err 'Fallo la descarga del modelo tras 3 intentos.'
if (-not $env:HTTPS_PROXY) {
Write-Host ' Tu red bloquea ambos. Si tienes proxy/VPN:'
Write-Host ' $env:HTTPS_PROXY = "http://127.0.0.1:7890" # (puerto de tu proxy)'
Write-Host ' Tu red no llega al registry de Ollama. Si tienes proxy/VPN, lanzalo y:'
Write-Host ' $env:HTTPS_PROXY = "http://127.0.0.1:7890" # (ajusta al puerto de tu proxy)'
Write-Host ' .\deploy.ps1 vps'
}
Write-Host ' O reintenta a mano:'
Write-Host ' docker exec d0a1-openclaw-ollama ollama pull llama3.2:3b'
exit 1
}
Ok "Ollama corriendo en http://localhost:${OllamaPort}"
+11 -29
View File
@@ -142,41 +142,23 @@ while ($true) {
# Si el usuario define $env:HTTPS_PROXY, Ollama lo usa para el pull (doc oficial):
$ProxyEnv = @()
if ($env:HTTPS_PROXY) { $ProxyEnv = @('-e', "HTTPS_PROXY=$env:HTTPS_PROXY", '-e', "HTTP_PROXY=$env:HTTP_PROXY") }
# --- Modelo: HF primero (CDN propio, rapido) y registry de Ollama como ultimo recurso ---
$Gguf = Join-Path $ScriptDir 'llama3.2-3b-q4.gguf'
$HfUrls = @(
'https://huggingface.co/bartowski/Llama-3.2-3B-Instruct-GGUF/resolve/main/Llama-3.2-3B-Instruct-Q4_K_M.gguf',
'https://huggingface.co/unsloth/Llama-3.2-3B-Instruct-GGUF/resolve/main/Llama-3.2-3B-Instruct-Q4_K_M.gguf'
)
foreach ($Url in $HfUrls) {
Info 'Descargando modelo de IA (llama3.2:3b, ~2 GB)...'
curl.exe -sL --retry 3 --max-time 1800 -o "$Gguf" $Url
if ($LASTEXITCODE -eq 0 -and (Test-Path $Gguf) -and (Get-Item $Gguf).Length -gt 1900000000) { break }
Warn "Mirror no accesible, probando el siguiente..."
Remove-Item "$Gguf" -Force -ErrorAction SilentlyContinue
}
if ((Test-Path $Gguf) -and (Get-Item $Gguf).Length -gt 1900000000) {
Info 'Importando modelo en Ollama...'
docker cp "$Gguf" d0a1-ollama:/root/.ollama/import.gguf
docker exec d0a1-ollama sh -c 'echo FROM /root/.ollama/import.gguf > /tmp/mf && ollama create llama3.2:3b -f /tmp/mf'
$CreateOk = ($LASTEXITCODE -eq 0)
docker exec d0a1-ollama rm -f /root/.ollama/import.gguf | Out-Null
Remove-Item "$Gguf" -Force -ErrorAction SilentlyContinue
$PullOk = $CreateOk
if (-not $CreateOk) { Err 'Fallo al importar el modelo desde el GGUF.' }
} else {
# Ultimo recurso: pull directo (1 intento, ya sin esperar 3 rondas)
Warn 'HuggingFace no accesible. Probando el registry de Ollama (ultimo recurso)...'
$PullOk = $false
foreach ($Attempt in 1..3) {
if ($Attempt -gt 1) { Warn "Reintento $Attempt de 3..." }
docker exec @ProxyEnv d0a1-ollama ollama pull llama3.2:3b
if ($LASTEXITCODE -eq 0) { $PullOk = $true }
if ($LASTEXITCODE -eq 0) { $PullOk = $true; break }
Warn 'Descarga interrumpida (red). Reintentando en 5 s...'
Start-Sleep -Seconds 5
}
if (-not $PullOk) {
Err 'No se pudo descargar el modelo (ni HuggingFace ni registry).'
Err 'Fallo la descarga del modelo tras 3 intentos.'
if (-not $env:HTTPS_PROXY) {
Write-Host ' Tu red bloquea ambos. Si tienes proxy/VPN:'
Write-Host ' $env:HTTPS_PROXY = "http://127.0.0.1:7890" # (puerto de tu proxy)'
Write-Host ' Tu red no llega al registry de Ollama. Si tienes proxy/VPN, lanzalo y:'
Write-Host ' $env:HTTPS_PROXY = "http://127.0.0.1:7890" # (ajusta al puerto de tu proxy)'
Write-Host ' .\deploy.ps1 vps'
}
Write-Host ' O reintenta a mano:'
Write-Host ' docker exec d0a1-ollama ollama pull llama3.2:3b'
exit 1
}
+11 -29
View File
@@ -178,41 +178,23 @@ while ($true) {
# Si el usuario define $env:HTTPS_PROXY, Ollama lo usa para el pull (doc oficial):
$ProxyEnv = @()
if ($env:HTTPS_PROXY) { $ProxyEnv = @('-e', "HTTPS_PROXY=$env:HTTPS_PROXY", '-e', "HTTP_PROXY=$env:HTTP_PROXY") }
# --- Modelo: HF primero (CDN propio, rapido) y registry de Ollama como ultimo recurso ---
$Gguf = Join-Path $ScriptDir 'llama3.2-3b-q4.gguf'
$HfUrls = @(
'https://huggingface.co/bartowski/Llama-3.2-3B-Instruct-GGUF/resolve/main/Llama-3.2-3B-Instruct-Q4_K_M.gguf',
'https://huggingface.co/unsloth/Llama-3.2-3B-Instruct-GGUF/resolve/main/Llama-3.2-3B-Instruct-Q4_K_M.gguf'
)
foreach ($Url in $HfUrls) {
Info 'Descargando modelo de IA (llama3.2:3b, ~2 GB)...'
curl.exe -sL --retry 3 --max-time 1800 -o "$Gguf" $Url
if ($LASTEXITCODE -eq 0 -and (Test-Path $Gguf) -and (Get-Item $Gguf).Length -gt 1900000000) { break }
Warn "Mirror no accesible, probando el siguiente..."
Remove-Item "$Gguf" -Force -ErrorAction SilentlyContinue
}
if ((Test-Path $Gguf) -and (Get-Item $Gguf).Length -gt 1900000000) {
Info 'Importando modelo en Ollama...'
docker cp "$Gguf" d0a1-wp-ollama:/root/.ollama/import.gguf
docker exec d0a1-wp-ollama sh -c 'echo FROM /root/.ollama/import.gguf > /tmp/mf && ollama create llama3.2:3b -f /tmp/mf'
$CreateOk = ($LASTEXITCODE -eq 0)
docker exec d0a1-wp-ollama rm -f /root/.ollama/import.gguf | Out-Null
Remove-Item "$Gguf" -Force -ErrorAction SilentlyContinue
$PullOk = $CreateOk
if (-not $CreateOk) { Err 'Fallo al importar el modelo desde el GGUF.' }
} else {
# Ultimo recurso: pull directo (1 intento, ya sin esperar 3 rondas)
Warn 'HuggingFace no accesible. Probando el registry de Ollama (ultimo recurso)...'
$PullOk = $false
foreach ($Attempt in 1..3) {
if ($Attempt -gt 1) { Warn "Reintento $Attempt de 3..." }
docker exec @ProxyEnv d0a1-wp-ollama ollama pull llama3.2:3b
if ($LASTEXITCODE -eq 0) { $PullOk = $true }
if ($LASTEXITCODE -eq 0) { $PullOk = $true; break }
Warn 'Descarga interrumpida (red). Reintentando en 5 s...'
Start-Sleep -Seconds 5
}
if (-not $PullOk) {
Err 'No se pudo descargar el modelo (ni HuggingFace ni registry).'
Err 'Fallo la descarga del modelo tras 3 intentos.'
if (-not $env:HTTPS_PROXY) {
Write-Host ' Tu red bloquea ambos. Si tienes proxy/VPN:'
Write-Host ' $env:HTTPS_PROXY = "http://127.0.0.1:7890" # (puerto de tu proxy)'
Write-Host ' Tu red no llega al registry de Ollama. Si tienes proxy/VPN, lanzalo y:'
Write-Host ' $env:HTTPS_PROXY = "http://127.0.0.1:7890" # (ajusta al puerto de tu proxy)'
Write-Host ' .\deploy.ps1 vps'
}
Write-Host ' O reintenta a mano:'
Write-Host ' docker exec d0a1-wp-ollama ollama pull llama3.2:3b'
exit 1
}