This commit is contained in:
Andras Bacsai
2023-11-22 15:18:49 +01:00
parent 3dd36a2271
commit 68f6ab5796
2 changed files with 80 additions and 1 deletions

View File

@@ -2,6 +2,8 @@
namespace App\Jobs;
use App\Models\Application;
use App\Models\ApplicationDeploymentQueue;
use App\Traits\ExecuteRemoteCommand;
use Illuminate\Bus\Queueable;
use Illuminate\Contracts\Queue\ShouldBeEncrypted;
@@ -23,7 +25,22 @@ class ApplicationDeploySimpleDockerfileJob implements ShouldQueue, ShouldBeEncry
{
$this->applicationDeploymentQueueId = $applicationDeploymentQueueId;
}
public function handle() {
public function handle()
{
ray('Deploying Simple Dockerfile');
$applicationDeploymentQueue = ApplicationDeploymentQueue::find($this->applicationDeploymentQueueId);
$application = Application::find($applicationDeploymentQueue->application_id);
$destination = $application->destination->getMorphClass()::where('id', $application->destination->id)->first();
$server = data_get($destination, 'server');
$commands = collect([]);
$commands->push(
[
'command' => 'echo "Starting deployment of simple dockerfile."',
],
[
'command' => 'ls -la',
]
);
$server->executeRemoteCommand(commands: $commands, logModel: $applicationDeploymentQueue);
}
}