From 28322543bfaf2eb891d9e2ae9ef0cace8c79e545 Mon Sep 17 00:00:00 2001 From: usmannasir Date: Wed, 27 Dec 2023 17:41:04 +0500 Subject: [PATCH] n8n container --- plogical/DockerSites.py | 18 +++++++++++++----- .../websiteFunctions/CreateDockerSite.html | 3 ++- websiteFunctions/website.py | 19 ++----------------- 3 files changed, 17 insertions(+), 23 deletions(-) diff --git a/plogical/DockerSites.py b/plogical/DockerSites.py index 732b0afb4..0fd816b88 100644 --- a/plogical/DockerSites.py +++ b/plogical/DockerSites.py @@ -37,6 +37,8 @@ def run(self): self.DeployWPContainer() elif self.function_run == 'SubmitDockersiteCreation': self.SubmitDockersiteCreation() + elif self.function_run == 'DeployN8NContainer': + self.DeployN8NContainer() except BaseException as msg: @@ -399,8 +401,12 @@ def SubmitDockersiteCreation(self): ) dockersiteobj.save() - background = Docker_Sites('DeployWPContainer', f_data) - background.start() + if self.data['App'] == 'WordPress': + background = Docker_Sites('DeployWPContainer', f_data) + background.start() + elif self.data['App'] == 'n8n': + background = Docker_Sites('DeployN8NContainer', f_data) + background.start() except BaseException as msg: logging.writeToFile("Error Submit Docker site Creation ....... %s" % str(msg)) @@ -579,12 +585,13 @@ def DeployN8NContainer(self): services: '{self.data['ServiceName']}-db': image: docker.io/bitnami/postgresql:16 + user: root restart: always environment: # - POSTGRES_USER:root - - POSTGRESQL_USERNAME={self.data['MySQLPassword']} + - POSTGRESQL_USERNAME={self.data['MySQLDBNUser']} - POSTGRESQL_DATABASE={self.data['MySQLDBName']} - - POSTGRESQL_POSTGRES_PASSWORD={self.data['MySQLDBNUser']} + - POSTGRESQL_POSTGRES_PASSWORD={self.data['MySQLPassword']} - POSTGRESQL_PASSWORD={self.data['MySQLPassword']} volumes: # - "/home/docker/{self.data['finalURL']}/db:/var/lib/postgresql/data" @@ -592,6 +599,7 @@ def DeployN8NContainer(self): '{self.data['ServiceName']}': image: docker.n8n.io/n8nio/n8n + user: root restart: always environment: - DB_TYPE=postgresdb @@ -704,7 +712,7 @@ def Main(): # port, SitePath, CPUsSite, MemorySite, SiteName # finalURL, blogTitle, adminUser, adminPassword, adminEmail, htaccessPath, externalApp data = { - "JobID": '/home/cyberpanel/error-logs.txt', + "JobID": '/home/cyberpanel/hey.txt', "ComposePath": "/home/docker.cyberpanel.net/docker-compose.yml", "MySQLPath": '/home/docker.cyberpanel.net/public_html/sqldocker', "MySQLRootPass": 'testdbwp12345', diff --git a/websiteFunctions/templates/websiteFunctions/CreateDockerSite.html b/websiteFunctions/templates/websiteFunctions/CreateDockerSite.html index e897c9879..e9fe979c7 100644 --- a/websiteFunctions/templates/websiteFunctions/CreateDockerSite.html +++ b/websiteFunctions/templates/websiteFunctions/CreateDockerSite.html @@ -169,7 +169,8 @@

diff --git a/websiteFunctions/website.py b/websiteFunctions/website.py index 252701c01..440f0a331 100755 --- a/websiteFunctions/website.py +++ b/websiteFunctions/website.py @@ -6863,23 +6863,7 @@ def submitDockerSiteCreation(self, userID=None, data=None): data_ret = {'status': 0, 'createWebSiteStatus': 0, 'error_message': "Blacklisted domain."} json_data = json.dumps(data_ret) return HttpResponse(json_data) - # extraArgs = {} - # extraArgs['admin'] = admin - # extraArgs['domainName'] = data['domain'] - # extraArgs['home'] = data['home'] - # extraArgs['shopName'] = data['shopName'] - # extraArgs['firstName'] = data['firstName'] - # extraArgs['lastName'] = data['lastName'] - # extraArgs['databasePrefix'] = data['databasePrefix'] - # extraArgs['email'] = data['email'] - # extraArgs['password'] = data['passwordByPass'] - # extraArgs['tempStatusPath'] = "/home/cyberpanel/" + str(randint(1000, 9999)) - # - # if data['home'] == '0': - # extraArgs['path'] = data['path'] - # - # background = ApplicationInstaller('prestashop', extraArgs) - # background.start() + tempStatusPath = "/home/cyberpanel/" + str(randint(1000, 9999)) data = {} @@ -6896,6 +6880,7 @@ def submitDockerSiteCreation(self, userID=None, data=None): data['WPusername'] = WPusername data['WPpasswd'] = WPpasswd data['externalApp'] = "".join(re.findall("[a-zA-Z]+", Domain))[:5] + str(randint(1000, 9999)) + data['App'] = App background = Docker_Sites('SubmitDockersiteCreation', data) background.start()