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:
33
app/Console/Commands/CleanAttachmentsCommand.php
Normal file
33
app/Console/Commands/CleanAttachmentsCommand.php
Normal file
@@ -0,0 +1,33 @@
|
||||
<?php
|
||||
|
||||
namespace App\Console\Commands;
|
||||
|
||||
use App\Models\Email;
|
||||
use Illuminate\Console\Command;
|
||||
|
||||
class CleanAttachmentsCommand extends Command
|
||||
{
|
||||
/**
|
||||
* The name and signature of the console command.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $signature = 'attachments:clean';
|
||||
|
||||
/**
|
||||
* The console command description.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $description = 'Clean old email attachments from disk';
|
||||
|
||||
/**
|
||||
* Execute the console command.
|
||||
*/
|
||||
public function handle()
|
||||
{
|
||||
$this->info('Starting to clean attachments...');
|
||||
Email::deleteBulkAttachments();
|
||||
$this->info('Finished cleaning attachments.');
|
||||
}
|
||||
}
|
||||
33
app/Console/Commands/CleanMailboxCommand.php
Normal file
33
app/Console/Commands/CleanMailboxCommand.php
Normal file
@@ -0,0 +1,33 @@
|
||||
<?php
|
||||
|
||||
namespace App\Console\Commands;
|
||||
|
||||
use App\Models\Email;
|
||||
use Illuminate\Console\Command;
|
||||
|
||||
class CleanMailboxCommand extends Command
|
||||
{
|
||||
/**
|
||||
* The name and signature of the console command.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $signature = 'mailbox:clean';
|
||||
|
||||
/**
|
||||
* The console command description.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $description = 'Clean old messages from the IMAP mailbox';
|
||||
|
||||
/**
|
||||
* Execute the console command.
|
||||
*/
|
||||
public function handle()
|
||||
{
|
||||
$this->info('Starting mailbox cleanup...');
|
||||
$result = Email::cleanMailbox();
|
||||
$this->info($result);
|
||||
}
|
||||
}
|
||||
33
app/Console/Commands/FetchEmailsCommand.php
Normal file
33
app/Console/Commands/FetchEmailsCommand.php
Normal file
@@ -0,0 +1,33 @@
|
||||
<?php
|
||||
|
||||
namespace App\Console\Commands;
|
||||
|
||||
use App\Models\Email;
|
||||
use Illuminate\Console\Command;
|
||||
|
||||
class FetchEmailsCommand extends Command
|
||||
{
|
||||
/**
|
||||
* The name and signature of the console command.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $signature = 'emails:fetch';
|
||||
|
||||
/**
|
||||
* The console command description.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $description = 'Fetch, process, and store emails from the IMAP server';
|
||||
|
||||
/**
|
||||
* Execute the console command.
|
||||
*/
|
||||
public function handle()
|
||||
{
|
||||
$this->info('Starting to fetch emails from IMAP server...');
|
||||
Email::fetchProcessStoreEmail();
|
||||
$this->info('Finished fetching emails.');
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user