49 lines
1.5 KiB
Python
49 lines
1.5 KiB
Python
import paramiko
|
|
|
|
ssh = paramiko.SSHClient()
|
|
ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy())
|
|
ssh.connect('161.97.93.156', username='carlos', password='Innova1978+*?', timeout=10)
|
|
|
|
php_code = """<?php
|
|
require __DIR__ . '/vendor/autoload.php';
|
|
$app = require_once __DIR__ . '/bootstrap/app.php';
|
|
$kernel = $app->make(Illuminate\\Contracts\\Console\\Kernel::class);
|
|
$kernel->bootstrap();
|
|
|
|
$application = App\\Models\\Application::where('uuid', 'bfmnoga3lb0ckomhdmxe0rco')->first();
|
|
if (!$application) {
|
|
echo "Application bfmnoga3lb0ckomhdmxe0rco not found!\\n";
|
|
exit(1);
|
|
}
|
|
|
|
$uuid = (string) Illuminate\\Support\\Str::uuid();
|
|
echo "Found app: " . $application->name . "\\n";
|
|
echo "Triggering deployment with UUID: $uuid\\n";
|
|
|
|
$result = queue_application_deployment(
|
|
application: $application,
|
|
deployment_uuid: $uuid,
|
|
force_rebuild: true
|
|
);
|
|
|
|
echo "Deployment Result:\\n";
|
|
print_r($result);
|
|
"""
|
|
|
|
sftp = ssh.open_sftp()
|
|
with sftp.file("/tmp/trigger_deploy.php", "w") as f:
|
|
f.write(php_code)
|
|
sftp.close()
|
|
|
|
# Copy to coolify container and execute
|
|
ssh.exec_command("docker cp /tmp/trigger_deploy.php coolify:/var/www/html/trigger_deploy.php")
|
|
stdin, stdout, stderr = ssh.exec_command("docker exec coolify php /var/www/html/trigger_deploy.php")
|
|
print("OUT:\n", stdout.read().decode('utf-8', errors='replace'))
|
|
print("ERR:\n", stderr.read().decode('utf-8', errors='replace'))
|
|
|
|
# Cleanup
|
|
ssh.exec_command("docker exec coolify rm -f /var/www/html/trigger_deploy.php")
|
|
ssh.exec_command("rm -f /tmp/trigger_deploy.php")
|
|
|
|
ssh.close()
|