feat: add homelab deployment configs, documentation, and automation scripts
This commit is contained in:
31
scripts/check_ha_proxy_js.py
Normal file
31
scripts/check_ha_proxy_js.py
Normal file
@@ -0,0 +1,31 @@
|
||||
import paramiko
|
||||
|
||||
c = paramiko.SSHClient()
|
||||
c.set_missing_host_key_policy(paramiko.AutoAddPolicy())
|
||||
c.connect('140.44.4.41', username='root', key_filename=r'C:\Users\Snarf\.ssh\id_ed25519_snarfnet', timeout=10)
|
||||
|
||||
def run(cmd):
|
||||
_, o, e = c.exec_command(cmd)
|
||||
return o.read().decode().strip()
|
||||
|
||||
pod = run('kubectl get pod -n infrastructure -l app.kubernetes.io/name=homepage-2-1744068158 -o jsonpath="{.items[0].metadata.name}"')
|
||||
py_cmd = """
|
||||
node -e '
|
||||
const fs = require("fs");
|
||||
const content = fs.readFileSync("/app/.next/server/pages/api/services/proxy.js", "utf8");
|
||||
const idx = content.indexOf("states/");
|
||||
if (idx !== -1) {
|
||||
console.log("Found states/ at", idx);
|
||||
console.log(content.slice(Math.max(0, idx - 500), idx + 1000));
|
||||
} else {
|
||||
const idx2 = content.indexOf("homeassistant");
|
||||
console.log("Found homeassistant at", idx2);
|
||||
console.log(content.slice(Math.max(0, idx2 - 500), idx2 + 1000));
|
||||
}
|
||||
'
|
||||
"""
|
||||
stdin, stdout, stderr = c.exec_command(f'kubectl exec -n infrastructure {pod} -- sh -c \'{py_cmd}\'')
|
||||
print(stdout.read().decode())
|
||||
print(stderr.read().decode())
|
||||
|
||||
c.close()
|
||||
Reference in New Issue
Block a user