Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
bobimicroweber committed Apr 23, 2024
1 parent fec0b9d commit 59756d1
Show file tree
Hide file tree
Showing 2 changed files with 53 additions and 0 deletions.
37 changes: 37 additions & 0 deletions web/app/Installers/Server/Applications/DovecotInstaller.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
<?php

namespace App\Installers\Server\Applications;

class DovecotInstaller
{
public $rubyVersions = [];

public $logFilePath = '/var/log/phyre/dovecot-installer.log';

public function setLogFilePath($path)
{
$this->logFilePath = $path;
}

public function install()
{

$commands = [];
$commands[] = 'echo "Installing dovecot..."';
$commands[] = 'apt-get install -y dovecot-core dovecot-imapd dovecot-pop3d dovecot-lmtpd';

$shellFileContent = '';
foreach ($commands as $command) {
$shellFileContent .= $command . PHP_EOL;
}

$shellFileContent .= 'echo "All packages installed successfully!"' . PHP_EOL;
$shellFileContent .= 'echo "DONE!"' . PHP_EOL;
$shellFileContent .= 'rm -f /tmp/dovecot-installer.sh';

file_put_contents('/tmp/dovecot-installer.sh', $shellFileContent);

shell_exec('bash /tmp/dovecot-installer.sh >> ' . $this->logFilePath . ' &');

}
}
16 changes: 16 additions & 0 deletions web/app/Livewire/Installer.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
namespace App\Livewire;

use App\Filament\Enums\ServerApplicationType;
use App\Installers\Server\Applications\DovecotInstaller;
use App\Installers\Server\Applications\NodeJsInstaller;
use App\Installers\Server\Applications\PHPInstaller;
use App\Installers\Server\Applications\PythonInstaller;
Expand Down Expand Up @@ -245,6 +246,21 @@ public function form(Form $form): Form
}),

Wizard\Step::make('Step 3')
->description('Configure your email server')
->schema([



])->afterValidation(function () {

$dovecotInstaller = new DovecotInstaller();
$dovecotInstaller->setLogFilePath(storage_path($this->install_log_file_path));
$dovecotInstaller->install();

dd(storage_path($this->install_log_file_path));
}),

Wizard\Step::make('Step 4')
->description('Finish installation')
->schema([

Expand Down

0 comments on commit 59756d1

Please sign in to comment.