|
|
@ -17,6 +17,8 @@ local CONTAINER_NAME = getenv("CONTAINER_NAME", "paperless-ai") |
|
|
local SINCE = getenv("SINCE", "0s") |
|
|
local SINCE = getenv("SINCE", "0s") |
|
|
local OLLAMA_HOST = getenv("OLLAMA_HOST", "192.168.222.12") |
|
|
local OLLAMA_HOST = getenv("OLLAMA_HOST", "192.168.222.12") |
|
|
local OLLAMA_PORT = tonumber(getenv("OLLAMA_PORT", "11434")) |
|
|
local OLLAMA_PORT = tonumber(getenv("OLLAMA_PORT", "11434")) |
|
|
|
|
|
local SSH_PORT = tonumber(getenv("SSH_PORT", "22")) |
|
|
|
|
|
local SSH_IDENTITY_FILE = getenv("SSH_IDENTITY_FILE", "/root/.ssh/id") -- e.g. "/path/to/id_rsa" |
|
|
local ERROR_PATTERN = getenv( |
|
|
local ERROR_PATTERN = getenv( |
|
|
"ERROR_PATTERN", |
|
|
"ERROR_PATTERN", |
|
|
("connect EHOSTUNREACH %s:%d"):format(OLLAMA_HOST, OLLAMA_PORT) |
|
|
("connect EHOSTUNREACH %s:%d"):format(OLLAMA_HOST, OLLAMA_PORT) |
|
|
@ -61,9 +63,6 @@ local function send_wol(mac_str, bcast_ip, port) |
|
|
return ok ~= nil, err |
|
|
return ok ~= nil, err |
|
|
end |
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
-- Kept for reference; not used to keep parity with your minimal bash |
|
|
-- Kept for reference; not used to keep parity with your minimal bash |
|
|
-- local function port_is_up(host, port, timeout_sec) |
|
|
-- local function port_is_up(host, port, timeout_sec) |
|
|
-- local deadline = socket.gettime() + (timeout_sec or 1) |
|
|
-- local deadline = socket.gettime() + (timeout_sec or 1) |
|
|
@ -103,6 +102,10 @@ local function main() |
|
|
-- else |
|
|
-- else |
|
|
-- log("Timeout waiting for Ollama.") |
|
|
-- log("Timeout waiting for Ollama.") |
|
|
-- end |
|
|
-- end |
|
|
|
|
|
|
|
|
|
|
|
if port_is_up(OLLAMA_HOST, SSH_PORT, 60) then |
|
|
|
|
|
log("SSH is reachable. Starting ollama service...") |
|
|
|
|
|
--ssh("wsl.exe -d Debian -- sudo systemctl enable --now ollama && sudo systemctl start ollama", "micro", OLLAMA_HOST, SSH_PORT, SSH_IDENTITY_FILE) |
|
|
end |
|
|
end |
|
|
end |
|
|
end |
|
|
|
|
|
|
|
|
|