Skip to content

Commit

Permalink
bug fix: mautic installer on ubuntu 22
Browse files Browse the repository at this point in the history
  • Loading branch information
usmannasir committed Oct 4, 2024
1 parent d1171a6 commit 9ad40d5
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 32 deletions.
72 changes: 41 additions & 31 deletions plogical/applicationInstaller.py
Original file line number Diff line number Diff line change
Expand Up @@ -123,45 +123,38 @@ def InstallNodeJS(self):
if result.find('npm <command>') > -1:
return 1

if ProcessUtilities.decideDistro() == ProcessUtilities.centos or ProcessUtilities.decideDistro() == ProcessUtilities.cent8:
nodeV = ProcessUtilities.fetch_latest_lts_version_for_node()
nodeV = ProcessUtilities.fetch_latest_lts_version_for_node()

if ACLManager.ISARM():
command = f'wget https://nodejs.org/dist/{nodeV}/node-{nodeV}-linux-arm64.tar.xz'
ProcessUtilities.executioner(command, 'root', True)

command = f'tar -xf node-{nodeV}-linux-arm64.tar.xz '
ProcessUtilities.executioner(command, 'root', True)
if ACLManager.ISARM():
command = f'wget https://nodejs.org/dist/{nodeV}/node-{nodeV}-linux-arm64.tar.xz'
ProcessUtilities.executioner(command, 'root', True)

command = f'cp node-{nodeV}-linux-arm64/bin/node /usr/bin/node'
ProcessUtilities.executioner(command, 'root', True)
command = f'tar -xf node-{nodeV}-linux-arm64.tar.xz '
ProcessUtilities.executioner(command, 'root', True)

command = 'curl -qL https://www.npmjs.com/install.sh | sh'
ProcessUtilities.executioner(command, 'root', True)
command = f'cp node-{nodeV}-linux-arm64/bin/node /usr/bin/node'
ProcessUtilities.executioner(command, 'root', True)

command = f'rm -rf node-{nodeV}-linux-arm64*'
ProcessUtilities.executioner(command, 'root', True)
else:
command = 'curl -qL https://www.npmjs.com/install.sh | sh'
ProcessUtilities.executioner(command, 'root', True)

command = f'wget https://nodejs.org/dist/{nodeV}/node-{nodeV}-linux-x64.tar.xz'
ProcessUtilities.executioner(command, 'root', True)
command = f'rm -rf node-{nodeV}-linux-arm64*'
ProcessUtilities.executioner(command, 'root', True)
else:

command = f'tar -xf node-{nodeV}-linux-x64.tar.xz'
ProcessUtilities.executioner(command, 'root', True)
command = f'wget https://nodejs.org/dist/{nodeV}/node-{nodeV}-linux-x64.tar.xz'
ProcessUtilities.executioner(command, 'root', True)

command = f'cp node-{nodeV}-linux-x64/bin/node /usr/bin/node'
ProcessUtilities.executioner(command, 'root', True)
command = f'tar -xf node-{nodeV}-linux-x64.tar.xz'
ProcessUtilities.executioner(command, 'root', True)

command = 'curl -qL https://www.npmjs.com/install.sh | sh'
ProcessUtilities.executioner(command, 'root', True)
command = f'cp node-{nodeV}-linux-x64/bin/node /usr/bin/node'
ProcessUtilities.executioner(command, 'root', True)

command = f'rm -rf node-{nodeV}-linux-x64*'
ProcessUtilities.executioner(command, 'root', True)
else:
#command = 'curl -fsSL <https://deb.nodesource.com/setup_20.x> | sudo -E bash -'
#ProcessUtilities.executioner(command, 'root', True)
command = 'curl -qL https://www.npmjs.com/install.sh | sh'
ProcessUtilities.executioner(command, 'root', True)

command = 'DEBIAN_FRONTEND=noninteractive apt-get install nodejs npm -y'
command = f'rm -rf node-{nodeV}-linux-x64*'
ProcessUtilities.executioner(command, 'root', True)

return 1
Expand Down Expand Up @@ -198,14 +191,26 @@ def installMautic(self):

phpPath = phpUtilities.GetPHPVersionFromFile(vhFile, domainName)

### basically for now php 8.0 is being checked
### basically for now php 8.1 is being checked

if not os.path.exists(phpPath):
statusFile = open(tempStatusPath, 'w')
statusFile.writelines('PHP 8.1 missing installing now..,20')
statusFile.close()
phpUtilities.InstallSaidPHP('81')

### if web is using apache then some missing extensions are required to install

finalConfPath = ApacheVhost.configBasePath + domainName + '.conf'
if os.path.exists(finalConfPath):

if ProcessUtilities.decideDistro() == ProcessUtilities.cent8 or ProcessUtilities.decideDistro() == ProcessUtilities.centos:
command = 'dnf install php7.?-bcmath php7.?-imap php8.?-bcmath php8.?-imap -y'
else:
command = 'DEBIAN_FRONTEND=noninteractive apt-get install php7.?-bcmath php7.?-imap php8.?-bcmath php8.?-imap -y'

ProcessUtilities.executioner(command)


FNULL = open(os.devnull, 'w')

Expand Down Expand Up @@ -362,10 +367,15 @@ def installMautic(self):

#os.remove(localDB)
command = f"systemctl restart {ApacheVhost.serviceName}"
ProcessUtilities.normalExecutioner(command)
ProcessUtilities.executioner(command)

installUtilities.reStartLiteSpeedSocket()

time.sleep(3)

command = f"systemctl restart {ApacheVhost.serviceName}"
ProcessUtilities.executioner(command)

statusFile = open(tempStatusPath, 'w')
statusFile.writelines("Successfully Installed. [200]")
statusFile.close()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ <h3 class="title-hero">
</h3>
<div class="example-box-wrapper">

<strong style="margin:2%; color: red">{% trans "Before installing Mautic, we will change the PHP version of the website to PHP 8.0, which is supported by Mautic." %}</strong>
<strong style="margin:2%; color: red">{% trans "Before installing Mautic, we will change the PHP version of the website to PHP 8.1, which is supported by Mautic." %}</strong>


<form style="margin-top:1%" name="websiteCreationForm" action="/" id="createPackages" class="form-horizontal bordered-row">
Expand Down

0 comments on commit 9ad40d5

Please sign in to comment.