feat: Prepare Zemailnator for Dokploy deployment

- Add highly optimized Dockerfile with Nginx and PHP-FPM 8.4
- Add docker-compose.yml configured with Redis and MariaDB 10.11
- Implement entrypoint.sh and supervisord.conf for background workers
- Refactor legacy IMAP scripts into scheduled Artisan Commands
- Secure app by removing old routes with hardcoded basic auth credentials
- Configure email attachments to use Laravel Storage instead of insecure public/tmp
This commit is contained in:
idevakk
2026-02-28 23:17:39 +05:30
parent bf5b797cd8
commit c312ec3325
78 changed files with 750 additions and 360 deletions

View File

@@ -13,7 +13,6 @@ use Filament\Schemas\Components\Section;
use Filament\Schemas\Schema;
use Filament\Support\Icons\Heroicon;
use Inerba\DbConfig\AbstractPageSettings;
use Symfony\Component\Mailer\Transport\Smtp\EsmtpTransport;
class ImapSettings extends AbstractPageSettings
{
@@ -145,7 +144,7 @@ class ImapSettings extends AbstractPageSettings
$fields = ['host', 'port', 'username', 'password', 'encryption', 'validate_cert', 'protocol'];
foreach ($fields as $field) {
$key = $sectionName . '.' . $field;
$key = $sectionName.'.'.$field;
// Try different data structure approaches
$value = null;
@@ -186,8 +185,8 @@ class ImapSettings extends AbstractPageSettings
return [
'section' => ucfirst($sectionName),
'success' => false,
'message' => "Missing required fields: " . $missingFields->join(', '),
'details' => null
'message' => 'Missing required fields: '.$missingFields->join(', '),
'details' => null,
];
}
@@ -198,7 +197,7 @@ class ImapSettings extends AbstractPageSettings
'section' => ucfirst($sectionName),
'success' => false,
'message' => 'IMAP extension is not loaded in your web server. Please check your Herd PHP configuration or restart your server.',
'details' => null
'details' => null,
];
}
@@ -210,7 +209,7 @@ class ImapSettings extends AbstractPageSettings
'password' => $config['password'],
'encryption' => $config['encryption'] ?? 'none',
'validate_cert' => $config['validate_cert'] ?? false,
'protocol' => $config['protocol'] ?? 'imap'
'protocol' => $config['protocol'] ?? 'imap',
];
// Test connection using the existing ZEmail::connectMailBox method
@@ -224,8 +223,8 @@ class ImapSettings extends AbstractPageSettings
'host' => $config['host'],
'port' => $config['port'],
'encryption' => $config['encryption'] ?? 'none',
'protocol' => $config['protocol'] ?? 'imap'
]
'protocol' => $config['protocol'] ?? 'imap',
],
];
} catch (\Exception $e) {
@@ -244,13 +243,12 @@ class ImapSettings extends AbstractPageSettings
'host' => $config['host'] ?? null,
'port' => $config['port'] ?? null,
'encryption' => $config['encryption'] ?? 'none',
'protocol' => $config['protocol'] ?? 'imap'
]
'protocol' => $config['protocol'] ?? 'imap',
],
];
}
}
/**
* Send appropriate notification based on test results.
*/
@@ -294,6 +292,7 @@ class ImapSettings extends AbstractPageSettings
$details[] = "{$result['section']}: {$result['details']['messages']} messages";
}
}
return implode(' | ', $details);
}
@@ -306,6 +305,7 @@ class ImapSettings extends AbstractPageSettings
foreach ($results as $result) {
$details[] = "{$result['section']}: {$result['message']}";
}
return implode(' | ', $details);
}
@@ -319,6 +319,7 @@ class ImapSettings extends AbstractPageSettings
$status = $result['success'] ? '✅' : '❌';
$details[] = "{$status} {$result['section']}";
}
return implode(' | ', $details);
}
}