mirror of
https://github.com/usmannasir/cyberpanel.git
synced 2025-11-10 15:26:13 +01:00
bug fix: n8n reporting
This commit is contained in:
@@ -958,9 +958,6 @@ services:
|
|||||||
command = f"docker ps -a --filter name={self.data['ServiceName']} --format '{{{{.Status}}}}'"
|
command = f"docker ps -a --filter name={self.data['ServiceName']} --format '{{{{.Status}}}}'"
|
||||||
result, status = ProcessUtilities.outputExecutioner(command, None, None, None, 1)
|
result, status = ProcessUtilities.outputExecutioner(command, None, None, None, 1)
|
||||||
|
|
||||||
# if result == 0:
|
|
||||||
# raise DockerDeploymentError(f"Failed to check container status: {status}")
|
|
||||||
|
|
||||||
# Accept unhealthy status as well
|
# Accept unhealthy status as well
|
||||||
if "exited" in status:
|
if "exited" in status:
|
||||||
# Get container logs
|
# Get container logs
|
||||||
@@ -996,13 +993,14 @@ services:
|
|||||||
if not db_ready:
|
if not db_ready:
|
||||||
raise DockerDeploymentError("Database failed to become ready within timeout period")
|
raise DockerDeploymentError("Database failed to become ready within timeout period")
|
||||||
|
|
||||||
# Verify database connection from n8n container
|
# Simple check that n8n container is running
|
||||||
command = f"docker exec {n8n_container_name} node -e \"const pg = require('pg'); const client = new pg.Client({{ user: 'postgres', password: '{self.data['MySQLPassword']}', host: '{self.data['ServiceName']}-db', port: 5432, database: '{self.data['MySQLDBName']}' }}); client.connect().then(() => {{ console.log('Connected successfully'); process.exit(0); }}).catch(err => {{ console.error(err); process.exit(1); }});\""
|
command = f"docker inspect --format='{{{{.State.Status}}}}' {n8n_container_name}"
|
||||||
result, output = ProcessUtilities.outputExecutioner(command, None, None, None, 1)
|
result, n8n_status = ProcessUtilities.outputExecutioner(command, None, None, None, 1)
|
||||||
|
|
||||||
if "Connected successfully" not in output:
|
if n8n_status not in ['running', 'starting', 'unhealthy']:
|
||||||
raise DockerDeploymentError(f"Failed to verify database connection: {output}")
|
raise DockerDeploymentError(f"n8n container is in {n8n_status} state")
|
||||||
|
|
||||||
|
logging.writeToFile(f'Deployment monitoring completed successfully. n8n status: {n8n_status}, database ready: {db_ready}')
|
||||||
return True
|
return True
|
||||||
|
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
|
|||||||
Reference in New Issue
Block a user