This commit is contained in:
Bozhidar 2024-05-11 12:43:00 +03:00
parent 33ec3b9b21
commit f3e898fa0c
5 changed files with 66 additions and 5 deletions

View file

@ -0,0 +1,18 @@
<?php
namespace Modules\Email;
use App\ModulePostInstall;
class PostInstall extends ModulePostInstall
{
public $supportLog = true;
public function run()
{
$installDockerShellFile = base_path('Modules/Email/shell-scripts/install-docker.sh');
shell_exec("chmod +x $installDockerShellFile");
shell_exec("bash $installDockerShellFile >> $this->logFile &");
}
}

View file

@ -0,0 +1,14 @@
netstat -aln | awk '
$6 == "LISTEN" {
if ($4 ~ "[.:][0-9]+$") {
split($4, a, /[:.]/);
port = a[length(a)];
p[port] = 1
}
}
END {
for (i = 3000; i < 65000 && p[i]; i++){};
if (i == 65000) {exit 1};
print i
}
'

View file

@ -0,0 +1,20 @@
sudo apt-get update -y
sudo apt-get install ca-certificates curl -y
sudo install -m 0755 -d /etc/apt/keyrings
sudo curl -fsSL https://download.docker.com/linux/ubuntu/gpg -o /etc/apt/keyrings/docker.asc
sudo chmod a+r /etc/apt/keyrings/docker.asc
# Add the repository to Apt sources:
echo \
"deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.asc] https://download.docker.com/linux/ubuntu \
$(. /etc/os-release && echo "$VERSION_CODENAME") stable" | \
sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
sudo apt-get update
sudo apt-get install docker-compose docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin -y
echo "Done!"

View file

@ -233,15 +233,13 @@ class Backup extends Model
}
}
// Export Phyre Panel ENV
$getEnv = Dotenv::createArrayBacked(base_path())->load();
$backupStructure = [
'database'=>$database,
'env'=>$getEnv,
'config'=>PhyreConfig::getAll()
];
file_put_contents($backupTempPath.'/backup.json', json_encode($backupStructure, JSON_PRETTY_PRINT));
$shellFileContent .= 'echo "Backup Phyre Panel ENV"'. PHP_EOL;
$shellFileContent .= 'cp '.base_path().'/.env '.$backupTempPath.'/.env'. PHP_EOL;
$shellFileContent .= 'echo "Backup Phyre Panel Config"'. PHP_EOL;
$shellFileContent .= 'cp '.base_path().'/phyre-config.ini '.$backupTempPath.'/phyre-config.ini'. PHP_EOL;
// Export Phyre Panel Hosting Subscription
$findHostingSubscription = HostingSubscription::all();

View file

@ -18,4 +18,15 @@ class PhyreConfig
return $default;
}
public static function getAll()
{
// Parse without sections
$configIni = base_path() . "/phyre-config.ini";
if (file_exists($configIni)) {
$iniArray = parse_ini_file($configIni);
return $iniArray;
}
return [];
}
}