mirror of
https://github.com/vitodeploy/vito.git
synced 2025-07-02 14:36:17 +00:00
Add workers to servers (#547)
This commit is contained in:
@ -2,16 +2,16 @@
|
||||
|
||||
namespace Database\Factories;
|
||||
|
||||
use App\Enums\QueueStatus;
|
||||
use App\Models\Queue;
|
||||
use App\Enums\WorkerStatus;
|
||||
use App\Models\Worker;
|
||||
use Illuminate\Database\Eloquent\Factories\Factory;
|
||||
|
||||
/**
|
||||
* @extends Factory<\App\Models\Queue>
|
||||
* @extends Factory<Worker>
|
||||
*/
|
||||
class QueueFactory extends Factory
|
||||
class WorkerFactory extends Factory
|
||||
{
|
||||
protected $model = Queue::class;
|
||||
protected $model = Worker::class;
|
||||
|
||||
public function definition(): array
|
||||
{
|
||||
@ -23,7 +23,7 @@ public function definition(): array
|
||||
'numprocs' => 1,
|
||||
'redirect_stderr' => 1,
|
||||
'stdout_logfile' => 'file.log',
|
||||
'status' => QueueStatus::CREATING,
|
||||
'status' => WorkerStatus::CREATING,
|
||||
];
|
||||
}
|
||||
}
|
@ -0,0 +1,21 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
public function up(): void
|
||||
{
|
||||
Schema::rename('queues', 'workers');
|
||||
Schema::table('workers', function (Blueprint $table): void {
|
||||
$table->unsignedInteger('site_id')->nullable()->change();
|
||||
});
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
Schema::rename('workers', 'queues');
|
||||
}
|
||||
};
|
@ -2,15 +2,15 @@
|
||||
|
||||
namespace Database\Seeders;
|
||||
|
||||
use App\Enums\QueueStatus;
|
||||
use App\Enums\SiteType;
|
||||
use App\Enums\SslStatus;
|
||||
use App\Enums\SslType;
|
||||
use App\Models\Queue;
|
||||
use App\Enums\WorkerStatus;
|
||||
use App\Models\Server;
|
||||
use App\Models\Site;
|
||||
use App\Models\SourceControl;
|
||||
use App\Models\Ssl;
|
||||
use App\Models\Worker;
|
||||
use Illuminate\Database\Eloquent\Builder;
|
||||
use Illuminate\Database\Seeder;
|
||||
|
||||
@ -36,10 +36,10 @@ public function run(): void
|
||||
'aliases' => ['www.'.$server->project->name.'.com'],
|
||||
]);
|
||||
$app->tags()->attach($server->tags()->first());
|
||||
Queue::factory()->create([
|
||||
Worker::factory()->create([
|
||||
'site_id' => $app->id,
|
||||
'command' => 'php artisan queue:work',
|
||||
'status' => QueueStatus::RUNNING,
|
||||
'status' => WorkerStatus::RUNNING,
|
||||
]);
|
||||
Ssl::factory()->create([
|
||||
'site_id' => $app->id,
|
||||
|
Reference in New Issue
Block a user