import paramiko import time def upgrade_uptime_kuma(): print("\n=======================================================") print("[*] Upgrading Uptime Kuma to 2.5.9 on Aerodrome (140.44.4.11)...") print("=======================================================") 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) # Get container name _, out, _ = ssh.exec_command("kubectl get deployment uptime-kuma-2-1756668961 -n monitoring -o jsonpath='{.spec.template.spec.containers[0].name}'") c_name = out.read().decode().strip() print(f"[*] Container name: {c_name}") # Update image cmd_up = f"kubectl set image deployment/uptime-kuma-2-1756668961 {c_name}=louislam/uptime-kuma:2.5.9 -n monitoring" print(f"[*] Running: {cmd_up}") ssh.exec_command(cmd_up) # Rollout status stdin, stdout, stderr = ssh.exec_command("kubectl rollout status deployment/uptime-kuma-2-1756668961 -n monitoring --timeout=180s") print(stdout.read().decode().strip()) _, out, _ = ssh.exec_command("kubectl get pods -n monitoring -l app.kubernetes.io/name=uptime-kuma -o wide") print(out.read().decode().strip()) ssh.close() def upgrade_semaphore(): print("\n=======================================================") print("[*] Upgrading Semaphore UI to v2.19.17 on Spaceport (140.44.4.41)...") print("=======================================================") 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) # Get container name _, out, _ = ssh.exec_command("kubectl get deployment semaphore -n infrastructure -o jsonpath='{.spec.template.spec.containers[0].name}'") c_name = out.read().decode().strip() print(f"[*] Container name: {c_name}") # Update image cmd_up = f"kubectl set image deployment/semaphore {c_name}=semaphoreui/semaphore:v2.19.17 -n infrastructure" print(f"[*] Running: {cmd_up}") ssh.exec_command(cmd_up) # Rollout status stdin, stdout, stderr = ssh.exec_command("kubectl rollout status deployment/semaphore -n infrastructure --timeout=180s") print(stdout.read().decode().strip()) _, out, _ = ssh.exec_command("kubectl get pods -n infrastructure -l app.kubernetes.io/name=semaphore -o wide") print(out.read().decode().strip()) ssh.close() if __name__ == '__main__': upgrade_uptime_kuma() upgrade_semaphore()