feat: add homelab deployment configs, documentation, and automation scripts
This commit is contained in:
@@ -1,23 +1,23 @@
|
||||
import paramiko
|
||||
|
||||
ssh = paramiko.SSHClient()
|
||||
ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy())
|
||||
ssh.connect('140.44.4.71', username='snarf', key_filename=r'C:\Users\Snarf\.ssh\id_ed25519_snarfnet', timeout=10)
|
||||
c = paramiko.SSHClient()
|
||||
c.set_missing_host_key_policy(paramiko.AutoAddPolicy())
|
||||
c.connect('140.44.4.71', username='root', key_filename=r'C:\Users\Snarf\.ssh\id_ed25519_snarfnet', timeout=10)
|
||||
|
||||
py_script = """sudo python3 -c '
|
||||
import sqlite3
|
||||
conn = sqlite3.connect("/mnt/swarm_shared/legacy_volumes/gotify/gotify.db")
|
||||
py_script = """import sqlite3
|
||||
conn = sqlite3.connect('/mnt/swarm_shared/legacy_volumes/gotify/gotify.db')
|
||||
cur = conn.cursor()
|
||||
print("Applications:", cur.execute("SELECT id, name, description FROM applications").fetchall())
|
||||
print("Clients:", cur.execute("SELECT id, name FROM clients").fetchall())
|
||||
print("Messages count:", cur.execute("SELECT count(*) FROM messages").fetchone()[0])
|
||||
print("Recent messages:", cur.execute("SELECT id, title, message, date FROM messages ORDER BY id DESC LIMIT 5").fetchall())
|
||||
print("Users:", cur.execute("SELECT id, name, admin FROM users").fetchall())
|
||||
'"""
|
||||
print('=== APPLICATIONS ===')
|
||||
cols = [c[1] for c in cur.execute('PRAGMA table_info(applications)').fetchall()]
|
||||
print('Cols:', cols)
|
||||
for r in cur.execute('SELECT * FROM applications').fetchall():
|
||||
print(r)
|
||||
"""
|
||||
|
||||
_, out, err = ssh.exec_command(py_script)
|
||||
print(out.read().decode())
|
||||
print("ERR:", err.read().decode())
|
||||
|
||||
ssh.close()
|
||||
stdin, stdout, stderr = c.exec_command("cat > /tmp/inspect_gotify.py && python3 /tmp/inspect_gotify.py")
|
||||
stdin.write(py_script)
|
||||
stdin.close()
|
||||
print(stdout.read().decode())
|
||||
print(stderr.read().decode())
|
||||
|
||||
c.close()
|
||||
|
||||
Reference in New Issue
Block a user