Browse Source

Add SSH configuration options for enhanced connectivity

main
Bastian (BaM) 3 months ago
parent
commit
7637f748d1
  1. 2
      compose.yaml
  2. 9
      scripts/auto-boot-ollama-host.lua

2
compose.yaml

@ -11,6 +11,8 @@ services:
WOL_MAC: "${WOL_MAC}" WOL_MAC: "${WOL_MAC}"
WOL_BCAST: "${WOL_BCAST:-192.168.222.255}" # optional WOL_BCAST: "${WOL_BCAST:-192.168.222.255}" # optional
WOL_PORT: "${WOL_PORT:-9}" # optional WOL_PORT: "${WOL_PORT:-9}" # optional
SSH_PUBLIC_KEY: "${SSH_PUBLIC_KEY}"
SSH_PRIVATE_KEY: "${SSH_PRIVATE_KEY}"
restart: unless-stopped restart: unless-stopped
volumes: volumes:
- /etc/localtime:/etc/localtime:ro - /etc/localtime:/etc/localtime:ro

9
scripts/auto-boot-ollama-host.lua

@ -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

Loading…
Cancel
Save