From 4e52f492b9479749241ed15a51f6b8f3eb1344a3 Mon Sep 17 00:00:00 2001 From: usmannasir Date: Fri, 5 Jan 2024 10:13:13 +0500 Subject: [PATCH] docker install on almalinux --- plogical/DockerSites.py | 24 +++++++++++++++++++++--- 1 file changed, 21 insertions(+), 3 deletions(-) diff --git a/plogical/DockerSites.py b/plogical/DockerSites.py index eaebc0dca..9e09218d6 100644 --- a/plogical/DockerSites.py +++ b/plogical/DockerSites.py @@ -47,7 +47,6 @@ def run(self): def InstallDocker(self): if ProcessUtilities.decideDistro() == ProcessUtilities.centos or ProcessUtilities.decideDistro() == ProcessUtilities.cent8: - #command = 'sudo curl -L "https://github.com/docker/compose/releases/download/v2.17.2/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose' command = 'dnf config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo' @@ -66,7 +65,7 @@ def InstallDocker(self): else: return 0, ReturnCode - command = 'sudo systemctl enable docker' + command = 'systemctl enable docker' ReturnCode = ProcessUtilities.executioner(command) if ReturnCode: @@ -74,7 +73,23 @@ def InstallDocker(self): else: return 0, ReturnCode - command = 'sudo systemctl start docker' + command = 'systemctl start docker' + ReturnCode = ProcessUtilities.executioner(command) + + if ReturnCode: + pass + else: + return 0, ReturnCode + + command = 'curl -L "https://github.com/docker/compose/releases/download/v2.17.2/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose' + ReturnCode = ProcessUtilities.executioner(command) + + if ReturnCode: + pass + else: + return 0, ReturnCode + + command = 'chmod +x /usr/local/bin/docker-compose' ReturnCode = ProcessUtilities.executioner(command) if ReturnCode: @@ -238,6 +253,9 @@ def DeployWPContainer(self): command = f"docker-compose -f {self.data['ComposePath']} -p '{self.data['SiteName']}' up -d" result, message = ProcessUtilities.outputExecutioner(command, None, None, None, 1) + if os.path.exists(ProcessUtilities.debugPath): + logging.writeToFile(message) + if result == 0: logging.statusWriter(self.JobID, f'Error {str(message)} . [404]') return 0