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

@@ -2,8 +2,8 @@
namespace Database\Factories;
use App\Models\TicketResponse;
use App\Models\Ticket;
use App\Models\TicketResponse;
use App\Models\User;
use Illuminate\Database\Eloquent\Factories\Factory;

View File

@@ -12,7 +12,7 @@ return new class extends Migration
$table->longText('html')->nullable()->change();
$table->longText('text')->nullable()->change();
});
}
public function down()

View File

@@ -11,7 +11,7 @@ return new class extends Migration
Schema::table(config('mails.database.tables.events', 'mail_events'), function (Blueprint $table) {
$table->longText('link')->nullable()->change();
});
}
public function down()

View File

@@ -1,8 +1,8 @@
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreateActivityLogTable extends Migration
{

View File

@@ -1,8 +1,8 @@
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class AddEventColumnToActivityLogTable extends Migration
{

View File

@@ -1,8 +1,8 @@
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class AddBatchUuidColumnToActivityLogTable extends Migration
{

View File

@@ -2,8 +2,8 @@
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
@@ -18,7 +18,7 @@ return new class extends Migration
try {
// MySQL automatically names check constraints in different ways,
// so we attempt a generic drop and ignore failures.
DB::statement("ALTER TABLE `payment_providers` DROP CHECK `payment_providers.configuration`;");
DB::statement('ALTER TABLE `payment_providers` DROP CHECK `payment_providers.configuration`;');
} catch (\Throwable $e) {
// ignore if constraint does not exist
}
@@ -37,7 +37,7 @@ return new class extends Migration
AND pg_get_constraintdef(pg_constraint.oid) LIKE '%configuration%json%';
");
if (!empty($constraint->conname)) {
if (! empty($constraint->conname)) {
DB::statement("ALTER TABLE payment_providers DROP CONSTRAINT {$constraint->conname};");
}
} catch (\Throwable $e) {

View File

@@ -34,4 +34,4 @@ return new class extends Migration
$table->unique('username', 'usernames_username_unique');
});
}
};
};

View File

@@ -2,9 +2,9 @@
namespace Database\Seeders;
use stdClass;
use App\Models\Meta;
use Illuminate\Database\Seeder;
use stdClass;
class MetaSeeder extends Seeder
{

View File

@@ -28,15 +28,15 @@ class PaymentProviderSeeder extends Seeder
'secret_key' => env('STRIPE_SECRET') ?: 'sk_test_placeholder',
'publishable_key' => env('STRIPE_PUBLISHABLE_KEY') ?: 'pk_test_placeholder',
'webhook_secret' => env('STRIPE_WEBHOOK_SECRET') ?: 'whsec_placeholder',
'webhook_url' => env('APP_URL', 'https://example.com') . '/webhook/stripe',
'success_url' => env('APP_URL', 'https://example.com') . '/payment/success',
'cancel_url' => env('APP_URL', 'https://example.com') . '/payment/cancel',
'webhook_url' => env('APP_URL', 'https://example.com').'/webhook/stripe',
'success_url' => env('APP_URL', 'https://example.com').'/payment/success',
'cancel_url' => env('APP_URL', 'https://example.com').'/payment/cancel',
'currency' => env('CASHIER_CURRENCY', 'USD'),
],
'supports_recurring' => true,
'supports_one_time' => true,
'supported_currencies' => [
'USD' => 'US Dollar'
'USD' => 'US Dollar',
],
'fee_structure' => [
'fixed_fee' => '0.50',
@@ -56,14 +56,14 @@ class PaymentProviderSeeder extends Seeder
'api_key' => env('LEMON_SQUEEZY_API_KEY', 'lsk_...'),
'store_id' => env('LEMON_SQUEEZY_STORE_ID', '...'),
'webhook_secret' => env('LEMON_SQUEEZY_WEBHOOK_SECRET', 'whsec_...'),
'webhook_url' => env('APP_URL') . '/webhook/lemon-squeezy',
'success_url' => env('APP_URL') . '/payment/success',
'cancel_url' => env('APP_URL') . '/payment/cancel',
'webhook_url' => env('APP_URL').'/webhook/lemon-squeezy',
'success_url' => env('APP_URL').'/payment/success',
'cancel_url' => env('APP_URL').'/payment/cancel',
],
'supports_recurring' => true,
'supports_one_time' => true,
'supported_currencies' => [
'USD' => 'US Dollar'
'USD' => 'US Dollar',
],
'fee_structure' => [
'fixed_fee' => '0.50',
@@ -86,9 +86,9 @@ class PaymentProviderSeeder extends Seeder
'sandbox_api_key' => env('POLAR_SANDBOX_API_KEY', 'pol_test_...'),
'sandbox_webhook_secret' => env('POLAR_SANDBOX_WEBHOOK_SECRET', 'whsec_test_...'),
'access_token' => env('POLAR_ACCESS_TOKEN', 'polar_...'),
'webhook_url' => env('APP_URL') . '/webhook/polar',
'success_url' => env('APP_URL') . '/payment/success',
'cancel_url' => env('APP_URL') . '/payment/cancel',
'webhook_url' => env('APP_URL').'/webhook/polar',
'success_url' => env('APP_URL').'/payment/success',
'cancel_url' => env('APP_URL').'/payment/cancel',
],
'supports_recurring' => true,
'supports_one_time' => true,
@@ -115,9 +115,9 @@ class PaymentProviderSeeder extends Seeder
'sandbox_merchant_api_key' => env('OXAPAY_SANDBOX_MERCHANT_API_KEY', 'merchant_sb_...'),
'payout_api_key' => env('OXAPAY_PAYOUT_API_KEY', 'payout_...'),
'sandbox_payout_api_key' => env('OXAPAY_SANDBOX_PAYOUT_API_KEY', 'payout_sb_...'),
'callback_url' => env('OXAPAY_CALLBACK_URL', env('APP_URL') . '/webhook/oxapay'),
'success_url' => env('APP_URL') . '/payment/success',
'cancel_url' => env('APP_URL') . '/payment/cancel',
'callback_url' => env('OXAPAY_CALLBACK_URL', env('APP_URL').'/webhook/oxapay'),
'success_url' => env('APP_URL').'/payment/success',
'cancel_url' => env('APP_URL').'/payment/cancel',
'sandbox' => env('OXAPAY_SANDBOX', true),
'currency' => env('OXAPAY_CURRENCY', 'USD'), // string
'lifetime' => env('OXAPAY_LIFETIME', 30), // integer · min: 15 · max: 2880
@@ -157,9 +157,9 @@ class PaymentProviderSeeder extends Seeder
'exchange_rate_provider' => env('CRYPTO_EXCHANGE_RATE_PROVIDER', 'coingecko'),
'coingecko_api_key' => env('COINGECKO_API_KEY'),
'blockchair_api_key' => env('BLOCKCHAIR_API_KEY'),
'webhook_url' => env('APP_URL') . '/webhook/crypto',
'success_url' => env('APP_URL') . '/payment/success',
'cancel_url' => env('APP_URL') . '/payment/cancel',
'webhook_url' => env('APP_URL').'/webhook/crypto',
'success_url' => env('APP_URL').'/payment/success',
'cancel_url' => env('APP_URL').'/payment/cancel',
'supported_wallets' => [
'btc' => ['bitcoin', 'lightning'],
'eth' => ['ethereum', 'erc20'],
@@ -227,6 +227,7 @@ class PaymentProviderSeeder extends Seeder
}
} catch (\Exception $e) {
$this->command->error("❌ Error seeding provider {$providerData['name']}: {$e->getMessage()}");
continue;
}
}