chore: remove unused file
This commit is contained in:
40
scripts/test_clean_db_dumps.py
Normal file
40
scripts/test_clean_db_dumps.py
Normal file
@@ -0,0 +1,40 @@
|
||||
import paramiko
|
||||
import sys
|
||||
|
||||
sys.stdout.reconfigure(encoding='utf-8')
|
||||
|
||||
# Authentik
|
||||
print("=== Backing up Authentik ===")
|
||||
ssh = paramiko.SSHClient()
|
||||
ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy())
|
||||
ssh.connect('140.44.4.11', username='root', key_filename=r'C:\Users\Snarf\.ssh\id_ed25519_snarfnet', timeout=10)
|
||||
cmd = "kubectl exec -n infra authentik-postgresql-0 -- sh -c 'PGPASSWORD=$(cat /opt/bitnami/postgresql/secrets/postgres-password) pg_dump -U postgres authentik' | gzip > /var/backups/authentik_clean.sql.gz"
|
||||
stdin, stdout, stderr = ssh.exec_command(cmd)
|
||||
err = stderr.read().decode().strip()
|
||||
if err: print("Authentik err:", err)
|
||||
_, out, _ = ssh.exec_command("ls -lh /var/backups/authentik_clean.sql.gz")
|
||||
print("Authentik size:", out.read().decode().strip())
|
||||
ssh.close()
|
||||
|
||||
# Spaceport (Gitea & Zabbix)
|
||||
print("=== Backing up Gitea & Zabbix ===")
|
||||
ssh = paramiko.SSHClient()
|
||||
ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy())
|
||||
ssh.connect('140.44.4.41', username='root', key_filename=r'C:\Users\Snarf\.ssh\id_ed25519_snarfnet', timeout=10)
|
||||
|
||||
cmd = "mkdir -p /var/backups && kubectl exec -n infrastructure gitea-postgresql-0 -- sh -c 'PGPASSWORD=$(cat /opt/bitnami/postgresql/secrets/password) pg_dump -U ugandanese baptiste' | gzip > /var/backups/gitea_clean.sql.gz"
|
||||
stdin, stdout, stderr = ssh.exec_command(cmd)
|
||||
err = stderr.read().decode().strip()
|
||||
if err: print("Gitea err:", err)
|
||||
_, out, _ = ssh.exec_command("ls -lh /var/backups/gitea_clean.sql.gz")
|
||||
print("Gitea size:", out.read().decode().strip())
|
||||
|
||||
cmd = "kubectl exec -n monitoring zabbix-postgresql-0 -- sh -c 'PGPASSWORD=zabbix pg_dump -U zabbix zabbix' | gzip > /var/backups/zabbix_clean.sql.gz"
|
||||
stdin, stdout, stderr = ssh.exec_command(cmd)
|
||||
err = stderr.read().decode().strip()
|
||||
if err: print("Zabbix err:", err)
|
||||
_, out, _ = ssh.exec_command("ls -lh /var/backups/zabbix_clean.sql.gz")
|
||||
print("Zabbix size:", out.read().decode().strip())
|
||||
|
||||
ssh.close()
|
||||
|
||||
Reference in New Issue
Block a user