bug fix in n8n deployment

This commit is contained in:
usmannasir 2025-12-26 14:24:13 +05:00
parent db35838f72
commit f9e600345f
1 changed files with 68 additions and 53 deletions

View File

@ -3248,7 +3248,16 @@ class CloudManager:
statusWriter.writeToFile(f"Error getting administrator: {str(e)} [404]")
return
# Step 1: Create the website
# Step 1: Check if website already exists, create only if not
existing_website = Websites.objects.filter(domain=domain_name).first()
if existing_website:
# Website already exists, skip creation
logging.writeToFile(f"[_install_n8n_with_website] Website {domain_name} already exists, skipping creation")
statusWriter.writeToFile(f'Website already exists, proceeding to N8N deployment...,20')
website = existing_website
else:
# Website doesn't exist, create it
statusWriter.writeToFile('Creating website...,10')
logging.writeToFile(f"[_install_n8n_with_website] Creating website for {domain_name}")
wm = WebsiteManager()
@ -3261,14 +3270,15 @@ class CloudManager:
statusWriter.writeToFile(f"Failed to create website: {result_data.get('error_message', 'Unknown error')} [404]")
return
# Wait for website creation to complete - no time limit
# Wait for website creation to complete - 10 minute timeout
creation_status_path = result_data.get('tempStatusPath')
logging.writeToFile(f"[_install_n8n_with_website] Website creation status path: {creation_status_path}")
if creation_status_path:
statusWriter.writeToFile('Waiting for website creation to complete (including SSL)...,15')
check_count = 0
while True:
max_checks = 600 # 10 minute timeout (600 seconds)
while check_count < max_checks:
try:
with open(creation_status_path, 'r') as f:
status = f.read()
@ -3286,6 +3296,11 @@ class CloudManager:
check_count += 1
time.sleep(1)
if check_count >= max_checks:
logging.writeToFile(f"[_install_n8n_with_website] Website creation timed out after 10 minutes")
statusWriter.writeToFile(f"Website creation timed out after 10 minutes [404]")
return
# Get the created website object
logging.writeToFile(f"[_install_n8n_with_website] Getting website object for {domain_name}")
try: