This commit is contained in:
Andras Bacsai 2023-06-30 22:41:00 +02:00
parent bfe55c12a7
commit 4fc8821cba
3 changed files with 0 additions and 89 deletions

View File

@ -42,14 +42,6 @@ public function deploy(bool $force_rebuild = false)
'environment_name' => $this->parameters['environment_name'],
]);
}
public function force_deploy_with_debug()
{
if ($this->application->settings->is_debug_enabled == false) {
$this->application->settings->is_debug_enabled = true;
$this->application->settings->save();
}
$this->deploy();
}
public function force_deploy_without_cache()
{
$this->deploy(force_rebuild: true);

View File

@ -1,78 +0,0 @@
<?php
namespace App\Http\Livewire\Project\Application;
use App\Jobs\ApplicationContainerStatusJob;
use App\Models\Application;
use Livewire\Component;
use Visus\Cuid2\Cuid2;
class Deploy extends Component
{
public string $applicationId;
public $activity;
public $status;
public Application $application;
public $destination;
public array $parameters;
protected string $deploymentUuid;
protected array $command = [];
protected $source;
protected $listeners = [
'applicationStatusChanged',
];
public function mount()
{
$this->parameters = getRouteParameters();
$this->application = Application::where('id', $this->applicationId)->first();
$this->destination = $this->application->destination->getMorphClass()::where('id', $this->application->destination->id)->first();
}
public function applicationStatusChanged()
{
$this->application->refresh();
}
protected function setDeploymentUuid()
{
$this->deploymentUuid = new Cuid2(7);
$this->parameters['deployment_uuid'] = $this->deploymentUuid;
}
public function deploy(bool $force = false, bool|null $debug = null)
{
if ($debug && !$this->application->settings->is_debug_enabled) {
$this->application->settings->is_debug_enabled = true;
$this->application->settings->save();
}
$this->setDeploymentUuid();
queue_application_deployment(
application_id: $this->application->id,
deployment_uuid: $this->deploymentUuid,
force_rebuild: $force,
);
return redirect()->route('project.application.deployment', [
'project_uuid' => $this->parameters['project_uuid'],
'application_uuid' => $this->parameters['application_uuid'],
'deployment_uuid' => $this->deploymentUuid,
'environment_name' => $this->parameters['environment_name'],
]);
}
public function stop()
{
instant_remote_process(["docker rm -f {$this->application->uuid}"], $this->application->destination->server);
$this->application->status = 'stopped';
$this->application->save();
$this->emit('applicationStatusChanged');
}
public function pollStatus()
{
dispatch(new ApplicationContainerStatusJob(
application: $this->application,
container_name: generate_container_name($this->application->uuid),
));
}
}

View File

@ -68,9 +68,6 @@
<div class="flex flex-col">
<x-forms.checkbox instantSave id="is_static" label="Is it a static site?"
helper="If your application is a static site or the final build assets should be served as a static site, enable this." />
<x-forms.checkbox helper="More logs will be visible during a deployment." instantSave id="is_debug_enabled"
label="Debug" />
<x-forms.checkbox
helper="Your application will be available only on https if your domain starts with https://..."
instantSave id="is_force_https_enabled" label="Force Https" />