Initial Ladill Hosting app with Gitea deploy pipeline.
Deploy Ladill Hosting / deploy (push) Failing after 17s
Deploy Ladill Hosting / deploy (push) Failing after 17s
Shared web hosting extracted from the platform monolith, with CI deploy to /var/www/ladill-hosting matching Bird/Domains/Email. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -0,0 +1,58 @@
|
||||
<?php
|
||||
|
||||
namespace App\Services\Mail;
|
||||
|
||||
use App\Models\EmailServer;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
|
||||
class MailServerNfsService
|
||||
{
|
||||
public function __construct(
|
||||
private MailServerSshExecutor $ssh,
|
||||
private EmailServerPoolService $pool,
|
||||
) {}
|
||||
|
||||
/**
|
||||
* Allow pool extension IPs on the primary NFS export.
|
||||
*/
|
||||
public function refreshPrimaryExports(EmailServer $primary): void
|
||||
{
|
||||
$primary = $primary->poolRoot();
|
||||
|
||||
if (! $primary->isPrimary() || ! $this->ssh->canConnect($primary)) {
|
||||
return;
|
||||
}
|
||||
|
||||
$clientIps = $this->pool->poolMembers($primary)
|
||||
->filter(fn (EmailServer $m) => $m->isExtension())
|
||||
->pluck('ip_address')
|
||||
->filter()
|
||||
->unique()
|
||||
->values()
|
||||
->all();
|
||||
|
||||
if ($clientIps === []) {
|
||||
return;
|
||||
}
|
||||
|
||||
$script = resource_path('infrastructure/scripts/nfs-refresh-exports.sh');
|
||||
$replacements = [
|
||||
'__VMAIL_ROOT__' => rtrim((string) ($primary->pool_vmail_root ?: config('infrastructure.mail_stack.vmail_root', '/var/vmail')), '/'),
|
||||
'__NEW_CLIENTS__' => implode(' ', $clientIps),
|
||||
];
|
||||
|
||||
try {
|
||||
$this->ssh->uploadAndRunScript(
|
||||
$primary,
|
||||
'/tmp/ladill-nfs-refresh-exports.sh',
|
||||
$script,
|
||||
$replacements,
|
||||
);
|
||||
} catch (\Throwable $e) {
|
||||
Log::warning('Failed to refresh NFS exports on primary mail server', [
|
||||
'primary_id' => $primary->id,
|
||||
'error' => $e->getMessage(),
|
||||
]);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user