Fix styling
This commit is contained in:
committed by
github-actions[bot]
parent
41fb6a1fc9
commit
d86274cc37
@@ -8,9 +8,13 @@ use Livewire\Component;
|
||||
class Advanced extends Component
|
||||
{
|
||||
public Application $application;
|
||||
|
||||
public bool $is_force_https_enabled;
|
||||
|
||||
public bool $is_gzip_enabled;
|
||||
|
||||
public bool $is_stripprefix_enabled;
|
||||
|
||||
protected $rules = [
|
||||
'application.settings.is_git_submodules_enabled' => 'boolean|required',
|
||||
'application.settings.is_git_lfs_enabled' => 'boolean|required',
|
||||
@@ -31,18 +35,21 @@ class Advanced extends Component
|
||||
'application.settings.is_raw_compose_deployment_enabled' => 'boolean|required',
|
||||
'application.settings.connect_to_docker_network' => 'boolean|required',
|
||||
];
|
||||
|
||||
public function mount()
|
||||
{
|
||||
$this->is_force_https_enabled = $this->application->isForceHttpsEnabled();
|
||||
$this->is_gzip_enabled = $this->application->isGzipEnabled();
|
||||
$this->is_stripprefix_enabled = $this->application->isStripprefixEnabled();
|
||||
}
|
||||
|
||||
public function instantSave()
|
||||
{
|
||||
if ($this->application->isLogDrainEnabled()) {
|
||||
if (!$this->application->destination->server->isLogDrainEnabled()) {
|
||||
if (! $this->application->destination->server->isLogDrainEnabled()) {
|
||||
$this->application->settings->is_log_drain_enabled = false;
|
||||
$this->dispatch('error', 'Log drain is not enabled on this server.');
|
||||
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -67,6 +74,7 @@ class Advanced extends Component
|
||||
$this->dispatch('success', 'Settings saved.');
|
||||
$this->dispatch('configurationChanged');
|
||||
}
|
||||
|
||||
public function submit()
|
||||
{
|
||||
if ($this->application->settings->gpu_count && $this->application->settings->gpu_device_ids) {
|
||||
@@ -74,11 +82,13 @@ class Advanced extends Component
|
||||
$this->application->settings->gpu_count = null;
|
||||
$this->application->settings->gpu_device_ids = null;
|
||||
$this->application->settings->save();
|
||||
|
||||
return;
|
||||
}
|
||||
$this->application->settings->save();
|
||||
$this->dispatch('success', 'Settings saved.');
|
||||
}
|
||||
|
||||
public function saveCustomName()
|
||||
{
|
||||
if (isset($this->application->settings->custom_internal_name)) {
|
||||
@@ -89,6 +99,7 @@ class Advanced extends Component
|
||||
$this->application->settings->save();
|
||||
$this->dispatch('success', 'Custom name saved.');
|
||||
}
|
||||
|
||||
public function render()
|
||||
{
|
||||
return view('livewire.project.application.advanced');
|
||||
|
||||
@@ -9,21 +9,23 @@ use Livewire\Component;
|
||||
class Configuration extends Component
|
||||
{
|
||||
public Application $application;
|
||||
|
||||
public $servers;
|
||||
|
||||
protected $listeners = ['buildPackUpdated' => '$refresh'];
|
||||
|
||||
public function mount()
|
||||
{
|
||||
$project = currentTeam()->load(['projects'])->projects->where('uuid', request()->route('project_uuid'))->first();
|
||||
if (!$project) {
|
||||
if (! $project) {
|
||||
return redirect()->route('dashboard');
|
||||
}
|
||||
$environment = $project->load(['environments'])->environments->where('name', request()->route('environment_name'))->first()->load(['applications']);
|
||||
if (!$environment) {
|
||||
if (! $environment) {
|
||||
return redirect()->route('dashboard');
|
||||
}
|
||||
$application = $environment->applications->where('uuid', request()->route('application_uuid'))->first();
|
||||
if (!$application) {
|
||||
if (! $application) {
|
||||
return redirect()->route('dashboard');
|
||||
}
|
||||
$this->application = $application;
|
||||
@@ -33,6 +35,7 @@ class Configuration extends Component
|
||||
return $server->id != $mainServer->id;
|
||||
});
|
||||
}
|
||||
|
||||
public function render()
|
||||
{
|
||||
return view('livewire.project.application.configuration');
|
||||
|
||||
@@ -9,27 +9,37 @@ use Livewire\Component;
|
||||
class Index extends Component
|
||||
{
|
||||
public Application $application;
|
||||
|
||||
public ?Collection $deployments;
|
||||
|
||||
public int $deployments_count = 0;
|
||||
|
||||
public string $current_url;
|
||||
|
||||
public int $skip = 0;
|
||||
|
||||
public int $default_take = 40;
|
||||
|
||||
public bool $show_next = false;
|
||||
|
||||
public bool $show_prev = false;
|
||||
|
||||
public ?string $pull_request_id = null;
|
||||
|
||||
protected $queryString = ['pull_request_id'];
|
||||
|
||||
public function mount()
|
||||
{
|
||||
$project = currentTeam()->load(['projects'])->projects->where('uuid', request()->route('project_uuid'))->first();
|
||||
if (!$project) {
|
||||
if (! $project) {
|
||||
return redirect()->route('dashboard');
|
||||
}
|
||||
$environment = $project->load(['environments'])->environments->where('name', request()->route('environment_name'))->first()->load(['applications']);
|
||||
if (!$environment) {
|
||||
if (! $environment) {
|
||||
return redirect()->route('dashboard');
|
||||
}
|
||||
$application = $environment->applications->where('uuid', request()->route('application_uuid'))->first();
|
||||
if (!$application) {
|
||||
if (! $application) {
|
||||
return redirect()->route('dashboard');
|
||||
}
|
||||
['deployments' => $deployments, 'count' => $count] = $application->deployments(0, 40);
|
||||
@@ -40,12 +50,14 @@ class Index extends Component
|
||||
$this->show_pull_request_only();
|
||||
$this->show_more();
|
||||
}
|
||||
|
||||
private function show_pull_request_only()
|
||||
{
|
||||
if ($this->pull_request_id) {
|
||||
$this->deployments = $this->deployments->where('pull_request_id', $this->pull_request_id);
|
||||
}
|
||||
}
|
||||
|
||||
private function show_more()
|
||||
{
|
||||
if ($this->deployments->count() !== 0) {
|
||||
@@ -53,6 +65,7 @@ class Index extends Component
|
||||
if ($this->deployments->count() < $this->default_take) {
|
||||
$this->show_next = false;
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -61,6 +74,7 @@ class Index extends Component
|
||||
{
|
||||
$this->load_deployments();
|
||||
}
|
||||
|
||||
public function previous_page(?int $take = null)
|
||||
{
|
||||
if ($take) {
|
||||
@@ -73,6 +87,7 @@ class Index extends Component
|
||||
}
|
||||
$this->load_deployments();
|
||||
}
|
||||
|
||||
public function next_page(?int $take = null)
|
||||
{
|
||||
if ($take) {
|
||||
@@ -81,6 +96,7 @@ class Index extends Component
|
||||
$this->show_prev = true;
|
||||
$this->load_deployments();
|
||||
}
|
||||
|
||||
public function load_deployments()
|
||||
{
|
||||
['deployments' => $deployments, 'count' => $count] = $this->application->deployments($this->skip, $this->default_take);
|
||||
@@ -89,6 +105,7 @@ class Index extends Component
|
||||
$this->show_pull_request_only();
|
||||
$this->show_more();
|
||||
}
|
||||
|
||||
public function render()
|
||||
{
|
||||
return view('livewire.project.application.deployment.index');
|
||||
|
||||
@@ -9,24 +9,29 @@ use Livewire\Component;
|
||||
class Show extends Component
|
||||
{
|
||||
public Application $application;
|
||||
|
||||
public ApplicationDeploymentQueue $application_deployment_queue;
|
||||
|
||||
public string $deployment_uuid;
|
||||
|
||||
public $isKeepAliveOn = true;
|
||||
|
||||
protected $listeners = ['refreshQueue'];
|
||||
|
||||
public function mount() {
|
||||
public function mount()
|
||||
{
|
||||
$deploymentUuid = request()->route('deployment_uuid');
|
||||
|
||||
$project = currentTeam()->load(['projects'])->projects->where('uuid', request()->route('project_uuid'))->first();
|
||||
if (!$project) {
|
||||
if (! $project) {
|
||||
return redirect()->route('dashboard');
|
||||
}
|
||||
$environment = $project->load(['environments'])->environments->where('name', request()->route('environment_name'))->first()->load(['applications']);
|
||||
if (!$environment) {
|
||||
if (! $environment) {
|
||||
return redirect()->route('dashboard');
|
||||
}
|
||||
$application = $environment->applications->where('uuid', request()->route('application_uuid'))->first();
|
||||
if (!$application) {
|
||||
if (! $application) {
|
||||
return redirect()->route('dashboard');
|
||||
}
|
||||
// $activity = Activity::where('properties->type_uuid', '=', $deploymentUuid)->first();
|
||||
@@ -38,7 +43,7 @@ class Show extends Component
|
||||
// ]);
|
||||
// }
|
||||
$application_deployment_queue = ApplicationDeploymentQueue::where('deployment_uuid', $deploymentUuid)->first();
|
||||
if (!$application_deployment_queue) {
|
||||
if (! $application_deployment_queue) {
|
||||
return redirect()->route('project.application.deployment.index', [
|
||||
'project_uuid' => $project->uuid,
|
||||
'environment_name' => $environment->name,
|
||||
@@ -63,6 +68,7 @@ class Show extends Component
|
||||
$this->isKeepAliveOn = false;
|
||||
}
|
||||
}
|
||||
|
||||
public function render()
|
||||
{
|
||||
return view('livewire.project.application.deployment.show');
|
||||
|
||||
@@ -12,10 +12,15 @@ use Livewire\Component;
|
||||
class DeploymentNavbar extends Component
|
||||
{
|
||||
public ApplicationDeploymentQueue $application_deployment_queue;
|
||||
|
||||
public Application $application;
|
||||
|
||||
public Server $server;
|
||||
|
||||
public bool $is_debug_enabled = false;
|
||||
|
||||
protected $listeners = ['deploymentFinished'];
|
||||
|
||||
public function mount()
|
||||
{
|
||||
$this->application = Application::find($this->application_deployment_queue->application_id);
|
||||
@@ -30,20 +35,23 @@ class DeploymentNavbar extends Component
|
||||
|
||||
public function show_debug()
|
||||
{
|
||||
$this->application->settings->is_debug_enabled = !$this->application->settings->is_debug_enabled;
|
||||
$this->application->settings->is_debug_enabled = ! $this->application->settings->is_debug_enabled;
|
||||
$this->application->settings->save();
|
||||
$this->is_debug_enabled = $this->application->settings->is_debug_enabled;
|
||||
$this->dispatch('refreshQueue');
|
||||
}
|
||||
|
||||
public function force_start()
|
||||
{
|
||||
try {
|
||||
force_start_deployment($this->application_deployment_queue);
|
||||
} catch (\Throwable $e) {
|
||||
ray($e);
|
||||
|
||||
return handleError($e, $this);
|
||||
}
|
||||
}
|
||||
|
||||
public function cancel()
|
||||
{
|
||||
try {
|
||||
@@ -55,7 +63,7 @@ class DeploymentNavbar extends Component
|
||||
|
||||
$new_log_entry = [
|
||||
'command' => $kill_command,
|
||||
'output' => "Deployment cancelled by user.",
|
||||
'output' => 'Deployment cancelled by user.',
|
||||
'type' => 'stderr',
|
||||
'order' => count($previous_logs) + 1,
|
||||
'timestamp' => Carbon::now('UTC'),
|
||||
@@ -69,6 +77,7 @@ class DeploymentNavbar extends Component
|
||||
instant_remote_process([$kill_command], $server);
|
||||
} catch (\Throwable $e) {
|
||||
ray($e);
|
||||
|
||||
return handleError($e, $this);
|
||||
} finally {
|
||||
$this->application_deployment_queue->update([
|
||||
|
||||
@@ -14,30 +14,44 @@ class General extends Component
|
||||
public string $applicationId;
|
||||
|
||||
public Application $application;
|
||||
|
||||
public Collection $services;
|
||||
|
||||
public string $name;
|
||||
|
||||
public ?string $fqdn = null;
|
||||
|
||||
public string $git_repository;
|
||||
|
||||
public string $git_branch;
|
||||
|
||||
public ?string $git_commit_sha = null;
|
||||
|
||||
public string $build_pack;
|
||||
|
||||
public ?string $ports_exposes = null;
|
||||
|
||||
public bool $is_container_label_escape_enabled = true;
|
||||
|
||||
public $customLabels;
|
||||
|
||||
public bool $labelsChanged = false;
|
||||
|
||||
public bool $initLoadingCompose = false;
|
||||
|
||||
public ?string $initialDockerComposeLocation = null;
|
||||
|
||||
public ?string $initialDockerComposePrLocation = null;
|
||||
|
||||
public null|Collection $parsedServices;
|
||||
public ?Collection $parsedServices;
|
||||
|
||||
public $parsedServiceDomains = [];
|
||||
|
||||
protected $listeners = [
|
||||
'resetDefaultLabels',
|
||||
'configurationChanged' => '$refresh'
|
||||
'configurationChanged' => '$refresh',
|
||||
];
|
||||
|
||||
protected $rules = [
|
||||
'application.name' => 'required',
|
||||
'application.description' => 'nullable',
|
||||
@@ -78,6 +92,7 @@ class General extends Component
|
||||
'application.settings.is_container_label_escape_enabled' => 'boolean|required',
|
||||
'application.watch_paths' => 'nullable',
|
||||
];
|
||||
|
||||
protected $validationAttributes = [
|
||||
'application.name' => 'name',
|
||||
'application.description' => 'description',
|
||||
@@ -114,12 +129,14 @@ class General extends Component
|
||||
'application.settings.is_container_label_escape_enabled' => 'Is container label escape enabled',
|
||||
'application.watch_paths' => 'Watch paths',
|
||||
];
|
||||
|
||||
public function mount()
|
||||
{
|
||||
try {
|
||||
$this->parsedServices = $this->application->parseCompose();
|
||||
if (is_null($this->parsedServices) || empty($this->parsedServices)) {
|
||||
$this->dispatch('error', "Failed to parse your docker-compose file. Please check the syntax and try again.");
|
||||
$this->dispatch('error', 'Failed to parse your docker-compose file. Please check the syntax and try again.');
|
||||
|
||||
return;
|
||||
}
|
||||
} catch (\Throwable $e) {
|
||||
@@ -133,13 +150,13 @@ class General extends Component
|
||||
$this->ports_exposes = $this->application->ports_exposes;
|
||||
$this->is_container_label_escape_enabled = $this->application->settings->is_container_label_escape_enabled;
|
||||
$this->customLabels = $this->application->parseContainerLabels();
|
||||
if (!$this->customLabels && $this->application->destination->server->proxyType() !== 'NONE') {
|
||||
$this->customLabels = str(implode("|", generateLabelsApplication($this->application)))->replace("|", "\n");
|
||||
if (! $this->customLabels && $this->application->destination->server->proxyType() !== 'NONE') {
|
||||
$this->customLabels = str(implode('|', generateLabelsApplication($this->application)))->replace('|', "\n");
|
||||
$this->application->custom_labels = base64_encode($this->customLabels);
|
||||
$this->application->save();
|
||||
}
|
||||
$this->initialDockerComposeLocation = $this->application->docker_compose_location;
|
||||
if ($this->application->build_pack === 'dockercompose' && !$this->application->docker_compose_raw) {
|
||||
if ($this->application->build_pack === 'dockercompose' && ! $this->application->docker_compose_raw) {
|
||||
$this->initLoadingCompose = true;
|
||||
$this->dispatch('info', 'Loading docker compose file.');
|
||||
}
|
||||
@@ -148,6 +165,7 @@ class General extends Component
|
||||
$this->dispatch('configurationChanged');
|
||||
}
|
||||
}
|
||||
|
||||
public function instantSave()
|
||||
{
|
||||
$this->application->settings->save();
|
||||
@@ -157,6 +175,7 @@ class General extends Component
|
||||
$this->resetDefaultLabels(false);
|
||||
}
|
||||
}
|
||||
|
||||
public function loadComposeFile($isInit = false)
|
||||
{
|
||||
try {
|
||||
@@ -165,7 +184,8 @@ class General extends Component
|
||||
}
|
||||
['parsedServices' => $this->parsedServices, 'initialDockerComposeLocation' => $this->initialDockerComposeLocation, 'initialDockerComposePrLocation' => $this->initialDockerComposePrLocation] = $this->application->loadComposeFile($isInit);
|
||||
if (is_null($this->parsedServices)) {
|
||||
$this->dispatch('error', "Failed to parse your docker-compose file. Please check the syntax and try again.");
|
||||
$this->dispatch('error', 'Failed to parse your docker-compose file. Please check the syntax and try again.');
|
||||
|
||||
return;
|
||||
}
|
||||
$compose = $this->application->parseCompose();
|
||||
@@ -184,13 +204,13 @@ class General extends Component
|
||||
[
|
||||
'mount_path' => $target,
|
||||
'resource_id' => $this->application->id,
|
||||
'resource_type' => get_class($this->application)
|
||||
'resource_type' => get_class($this->application),
|
||||
],
|
||||
[
|
||||
'fs_path' => $source,
|
||||
'mount_path' => $target,
|
||||
'resource_id' => $this->application->id,
|
||||
'resource_type' => get_class($this->application)
|
||||
'resource_type' => get_class($this->application),
|
||||
]
|
||||
);
|
||||
}
|
||||
@@ -203,11 +223,13 @@ class General extends Component
|
||||
$this->application->docker_compose_location = $this->initialDockerComposeLocation;
|
||||
$this->application->docker_compose_pr_location = $this->initialDockerComposePrLocation;
|
||||
$this->application->save();
|
||||
|
||||
return handleError($e, $this);
|
||||
} finally {
|
||||
$this->initLoadingCompose = false;
|
||||
}
|
||||
}
|
||||
|
||||
public function generateDomain(string $serviceName)
|
||||
{
|
||||
$uuid = new Cuid2(7);
|
||||
@@ -219,14 +241,17 @@ class General extends Component
|
||||
if ($this->application->build_pack === 'dockercompose') {
|
||||
$this->loadComposeFile();
|
||||
}
|
||||
|
||||
return $domain;
|
||||
}
|
||||
|
||||
public function updatedApplicationBaseDirectory()
|
||||
{
|
||||
if ($this->application->build_pack === 'dockercompose') {
|
||||
$this->loadComposeFile();
|
||||
}
|
||||
}
|
||||
|
||||
public function updatedApplicationFqdn()
|
||||
{
|
||||
$this->application->fqdn = str($this->application->fqdn)->replaceEnd(',', '')->trim();
|
||||
@@ -237,6 +262,7 @@ class General extends Component
|
||||
$this->application->fqdn = $this->application->fqdn->unique()->implode(',');
|
||||
$this->resetDefaultLabels();
|
||||
}
|
||||
|
||||
public function updatedApplicationBuildPack()
|
||||
{
|
||||
if ($this->application->build_pack !== 'nixpacks') {
|
||||
@@ -257,6 +283,7 @@ class General extends Component
|
||||
$this->submit();
|
||||
$this->dispatch('buildPackUpdated');
|
||||
}
|
||||
|
||||
public function getWildcardDomain()
|
||||
{
|
||||
$server = data_get($this->application, 'destination.server');
|
||||
@@ -268,9 +295,10 @@ class General extends Component
|
||||
$this->dispatch('success', 'Wildcard domain generated.');
|
||||
}
|
||||
}
|
||||
|
||||
public function resetDefaultLabels()
|
||||
{
|
||||
$this->customLabels = str(implode("|", generateLabelsApplication($this->application)))->replace("|", "\n");
|
||||
$this->customLabels = str(implode('|', generateLabelsApplication($this->application)))->replace('|', "\n");
|
||||
$this->ports_exposes = $this->application->ports_exposes;
|
||||
$this->is_container_label_escape_enabled = $this->application->settings->is_container_label_escape_enabled;
|
||||
$this->application->custom_labels = base64_encode($this->customLabels);
|
||||
@@ -286,8 +314,8 @@ class General extends Component
|
||||
$domains = str($this->application->fqdn)->trim()->explode(',');
|
||||
if ($this->application->additional_servers->count() === 0) {
|
||||
foreach ($domains as $domain) {
|
||||
if (!validate_dns_entry($domain, $this->application->destination->server)) {
|
||||
$showToaster && $this->dispatch('error', "Validating DNS failed.", "Make sure you have added the DNS records correctly.<br><br>$domain->{$this->application->destination->server->ip}<br><br>Check this <a target='_blank' class='underline dark:text-white' href='https://coolify.io/docs/knowledge-base/dns-configuration'>documentation</a> for further help.");
|
||||
if (! validate_dns_entry($domain, $this->application->destination->server)) {
|
||||
$showToaster && $this->dispatch('error', 'Validating DNS failed.', "Make sure you have added the DNS records correctly.<br><br>$domain->{$this->application->destination->server->ip}<br><br>Check this <a target='_blank' class='underline dark:text-white' href='https://coolify.io/docs/knowledge-base/dns-configuration'>documentation</a> for further help.");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -295,6 +323,7 @@ class General extends Component
|
||||
$this->application->fqdn = $domains->implode(',');
|
||||
}
|
||||
}
|
||||
|
||||
public function submit($showToaster = true)
|
||||
{
|
||||
try {
|
||||
@@ -309,8 +338,8 @@ class General extends Component
|
||||
|
||||
$this->application->save();
|
||||
|
||||
if (!$this->customLabels && $this->application->destination->server->proxyType() !== 'NONE') {
|
||||
$this->customLabels = str(implode("|", generateLabelsApplication($this->application)))->replace("|", "\n");
|
||||
if (! $this->customLabels && $this->application->destination->server->proxyType() !== 'NONE') {
|
||||
$this->customLabels = str(implode('|', generateLabelsApplication($this->application)))->replace('|', "\n");
|
||||
$this->application->custom_labels = base64_encode($this->customLabels);
|
||||
$this->application->save();
|
||||
}
|
||||
@@ -336,7 +365,7 @@ class General extends Component
|
||||
}
|
||||
if (data_get($this->application, 'dockerfile')) {
|
||||
$port = get_port_from_dockerfile($this->application->dockerfile);
|
||||
if ($port && !$this->application->ports_exposes) {
|
||||
if ($port && ! $this->application->ports_exposes) {
|
||||
$this->application->ports_exposes = $port;
|
||||
}
|
||||
}
|
||||
@@ -351,8 +380,8 @@ class General extends Component
|
||||
foreach ($this->parsedServiceDomains as $serviceName => $service) {
|
||||
$domain = data_get($service, 'domain');
|
||||
if ($domain) {
|
||||
if (!validate_dns_entry($domain, $this->application->destination->server)) {
|
||||
$showToaster && $this->dispatch('error', "Validating DNS failed.", "Make sure you have added the DNS records correctly.<br><br>$domain->{$this->application->destination->server->ip}<br><br>Check this <a target='_blank' class='underline dark:text-white' href='https://coolify.io/docs/knowledge-base/dns-configuration'>documentation</a> for further help.");
|
||||
if (! validate_dns_entry($domain, $this->application->destination->server)) {
|
||||
$showToaster && $this->dispatch('error', 'Validating DNS failed.', "Make sure you have added the DNS records correctly.<br><br>$domain->{$this->application->destination->server->ip}<br><br>Check this <a target='_blank' class='underline dark:text-white' href='https://coolify.io/docs/knowledge-base/dns-configuration'>documentation</a> for further help.");
|
||||
}
|
||||
check_domain_usage(resource: $this->application);
|
||||
}
|
||||
|
||||
@@ -14,25 +14,31 @@ use Visus\Cuid2\Cuid2;
|
||||
class Heading extends Component
|
||||
{
|
||||
public Application $application;
|
||||
|
||||
public ?string $lastDeploymentInfo = null;
|
||||
|
||||
public ?string $lastDeploymentLink = null;
|
||||
|
||||
public array $parameters;
|
||||
|
||||
protected string $deploymentUuid;
|
||||
|
||||
public function getListeners()
|
||||
{
|
||||
$teamId = auth()->user()->currentTeam()->id;
|
||||
|
||||
return [
|
||||
"echo-private:team.{$teamId},ApplicationStatusChanged" => 'check_status',
|
||||
"compose_loaded" => '$refresh',
|
||||
"update_links" => '$refresh',
|
||||
'compose_loaded' => '$refresh',
|
||||
'update_links' => '$refresh',
|
||||
];
|
||||
}
|
||||
|
||||
public function mount()
|
||||
{
|
||||
$this->parameters = get_route_parameters();
|
||||
$lastDeployment = $this->application->get_last_successful_deployment();
|
||||
$this->lastDeploymentInfo = data_get_str($lastDeployment, 'commit')->limit(7) . ' ' . data_get($lastDeployment, 'commit_message');
|
||||
$this->lastDeploymentInfo = data_get_str($lastDeployment, 'commit')->limit(7).' '.data_get($lastDeployment, 'commit_message');
|
||||
$this->lastDeploymentLink = $this->application->gitCommitLink(data_get($lastDeployment, 'commit'));
|
||||
}
|
||||
|
||||
@@ -45,7 +51,9 @@ class Heading extends Component
|
||||
dispatch(new ServerStatusJob($this->application->destination->server));
|
||||
}
|
||||
|
||||
if ($showNotification) $this->dispatch('success', "Success", "Application status updated.");
|
||||
if ($showNotification) {
|
||||
$this->dispatch('success', 'Success', 'Application status updated.');
|
||||
}
|
||||
// Removed because it caused flickering
|
||||
// $this->dispatch('configurationChanged');
|
||||
}
|
||||
@@ -59,18 +67,22 @@ class Heading extends Component
|
||||
{
|
||||
if ($this->application->build_pack === 'dockercompose' && is_null($this->application->docker_compose_raw)) {
|
||||
$this->dispatch('error', 'Failed to deploy', 'Please load a Compose file first.');
|
||||
|
||||
return;
|
||||
}
|
||||
if ($this->application->destination->server->isSwarm() && str($this->application->docker_registry_image_name)->isEmpty()) {
|
||||
$this->dispatch('error', 'Failed to deploy.', 'To deploy to a Swarm cluster you must set a Docker image name first.');
|
||||
|
||||
return;
|
||||
}
|
||||
if (data_get($this->application, 'settings.is_build_server_enabled') && str($this->application->docker_registry_image_name)->isEmpty()) {
|
||||
$this->dispatch('error', 'Failed to deploy.', 'To use a build server, you must first set a Docker image.<br>More information here: <a target="_blank" class="underline" href="https://coolify.io/docs/knowledge-base/server/build-server">documentation</a>');
|
||||
|
||||
return;
|
||||
}
|
||||
if ($this->application->additional_servers->count() > 0 && str($this->application->docker_registry_image_name)->isEmpty()) {
|
||||
$this->dispatch('error', 'Failed to deploy.', 'Before deploying to multiple servers, you must first set a Docker image in the General tab.<br>More information here: <a target="_blank" class="underline" href="https://coolify.io/docs/knowledge-base/server/multiple-servers">documentation</a>');
|
||||
|
||||
return;
|
||||
}
|
||||
$this->setDeploymentUuid();
|
||||
@@ -79,6 +91,7 @@ class Heading extends Component
|
||||
deployment_uuid: $this->deploymentUuid,
|
||||
force_rebuild: $force_rebuild,
|
||||
);
|
||||
|
||||
return redirect()->route('project.application.deployment.show', [
|
||||
'project_uuid' => $this->parameters['project_uuid'],
|
||||
'application_uuid' => $this->parameters['application_uuid'],
|
||||
@@ -100,16 +113,18 @@ class Heading extends Component
|
||||
$this->application->save();
|
||||
if ($this->application->additional_servers->count() > 0) {
|
||||
$this->application->additional_servers->each(function ($server) {
|
||||
$server->pivot->status = "exited:unhealthy";
|
||||
$server->pivot->status = 'exited:unhealthy';
|
||||
$server->pivot->save();
|
||||
});
|
||||
}
|
||||
ApplicationStatusChanged::dispatch(data_get($this->application, 'environment.project.team.id'));
|
||||
}
|
||||
|
||||
public function restart()
|
||||
{
|
||||
if ($this->application->additional_servers->count() > 0 && str($this->application->docker_registry_image_name)->isEmpty()) {
|
||||
$this->dispatch('error', 'Failed to deploy', 'Before deploying to multiple servers, you must first set a Docker image in the General tab.<br>More information here: <a target="_blank" class="underline" href="https://coolify.io/docs/knowledge-base/server/multiple-servers">documentation</a>');
|
||||
|
||||
return;
|
||||
}
|
||||
$this->setDeploymentUuid();
|
||||
@@ -118,6 +133,7 @@ class Heading extends Component
|
||||
deployment_uuid: $this->deploymentUuid,
|
||||
restart_only: true,
|
||||
);
|
||||
|
||||
return redirect()->route('project.application.deployment.show', [
|
||||
'project_uuid' => $this->parameters['project_uuid'],
|
||||
'application_uuid' => $this->parameters['application_uuid'],
|
||||
|
||||
@@ -10,10 +10,13 @@ use Spatie\Url\Url;
|
||||
class Form extends Component
|
||||
{
|
||||
public Application $application;
|
||||
|
||||
public string $preview_url_template;
|
||||
|
||||
protected $rules = [
|
||||
'application.preview_url_template' => 'required',
|
||||
];
|
||||
|
||||
protected $validationAttributes = [
|
||||
'application.preview_url_template' => 'preview url template',
|
||||
];
|
||||
|
||||
@@ -13,14 +13,19 @@ use Visus\Cuid2\Cuid2;
|
||||
class Previews extends Component
|
||||
{
|
||||
public Application $application;
|
||||
|
||||
public string $deployment_uuid;
|
||||
|
||||
public array $parameters;
|
||||
|
||||
public Collection $pull_requests;
|
||||
|
||||
public int $rate_limit_remaining;
|
||||
|
||||
protected $rules = [
|
||||
'application.previews.*.fqdn' => 'string|nullable',
|
||||
];
|
||||
|
||||
public function mount()
|
||||
{
|
||||
$this->pull_requests = collect();
|
||||
@@ -35,9 +40,11 @@ class Previews extends Component
|
||||
$this->pull_requests = $data->sortBy('number')->values();
|
||||
} catch (\Throwable $e) {
|
||||
$this->rate_limit_remaining = 0;
|
||||
|
||||
return handleError($e, $this);
|
||||
}
|
||||
}
|
||||
|
||||
public function save_preview($preview_id)
|
||||
{
|
||||
try {
|
||||
@@ -47,14 +54,14 @@ class Previews extends Component
|
||||
$preview->fqdn = str($preview->fqdn)->replaceEnd(',', '')->trim();
|
||||
$preview->fqdn = str($preview->fqdn)->replaceStart(',', '')->trim();
|
||||
$preview->fqdn = str($preview->fqdn)->trim()->lower();
|
||||
if (!validate_dns_entry($preview->fqdn, $this->application->destination->server)) {
|
||||
$this->dispatch('error', "Validating DNS failed.", "Make sure you have added the DNS records correctly.<br><br>$preview->fqdn->{$this->application->destination->server->ip}<br><br>Check this <a target='_blank' class='underline dark:text-white' href='https://coolify.io/docs/knowledge-base/dns-configuration'>documentation</a> for further help.");
|
||||
if (! validate_dns_entry($preview->fqdn, $this->application->destination->server)) {
|
||||
$this->dispatch('error', 'Validating DNS failed.', "Make sure you have added the DNS records correctly.<br><br>$preview->fqdn->{$this->application->destination->server->ip}<br><br>Check this <a target='_blank' class='underline dark:text-white' href='https://coolify.io/docs/knowledge-base/dns-configuration'>documentation</a> for further help.");
|
||||
$success = false;
|
||||
}
|
||||
check_domain_usage(resource: $this->application, domain: $preview->fqdn);
|
||||
}
|
||||
|
||||
if (!$preview) {
|
||||
if (! $preview) {
|
||||
throw new \Exception('Preview not found');
|
||||
}
|
||||
$success && $preview->save();
|
||||
@@ -63,11 +70,13 @@ class Previews extends Component
|
||||
return handleError($e, $this);
|
||||
}
|
||||
}
|
||||
|
||||
public function generate_preview($preview_id)
|
||||
{
|
||||
$preview = $this->application->previews->find($preview_id);
|
||||
if (!$preview) {
|
||||
if (! $preview) {
|
||||
$this->dispatch('error', 'Preview not found.');
|
||||
|
||||
return;
|
||||
}
|
||||
$fqdn = generateFqdn($this->application->destination->server, $this->application->uuid);
|
||||
@@ -85,13 +94,14 @@ class Previews extends Component
|
||||
$preview->save();
|
||||
$this->dispatch('success', 'Domain generated.');
|
||||
}
|
||||
public function add(int $pull_request_id, string|null $pull_request_html_url = null)
|
||||
|
||||
public function add(int $pull_request_id, ?string $pull_request_html_url = null)
|
||||
{
|
||||
try {
|
||||
if ($this->application->build_pack === 'dockercompose') {
|
||||
$this->setDeploymentUuid();
|
||||
$found = ApplicationPreview::where('application_id', $this->application->id)->where('pull_request_id', $pull_request_id)->first();
|
||||
if (!$found && !is_null($pull_request_html_url)) {
|
||||
if (! $found && ! is_null($pull_request_html_url)) {
|
||||
$found = ApplicationPreview::create([
|
||||
'application_id' => $this->application->id,
|
||||
'pull_request_id' => $pull_request_id,
|
||||
@@ -104,7 +114,7 @@ class Previews extends Component
|
||||
} else {
|
||||
$this->setDeploymentUuid();
|
||||
$found = ApplicationPreview::where('application_id', $this->application->id)->where('pull_request_id', $pull_request_id)->first();
|
||||
if (!$found && !is_null($pull_request_html_url)) {
|
||||
if (! $found && ! is_null($pull_request_html_url)) {
|
||||
$found = ApplicationPreview::create([
|
||||
'application_id' => $this->application->id,
|
||||
'pull_request_id' => $pull_request_id,
|
||||
@@ -120,16 +130,17 @@ class Previews extends Component
|
||||
return handleError($e, $this);
|
||||
}
|
||||
}
|
||||
public function deploy(int $pull_request_id, string|null $pull_request_html_url = null)
|
||||
|
||||
public function deploy(int $pull_request_id, ?string $pull_request_html_url = null)
|
||||
{
|
||||
try {
|
||||
$this->setDeploymentUuid();
|
||||
$found = ApplicationPreview::where('application_id', $this->application->id)->where('pull_request_id', $pull_request_id)->first();
|
||||
if (!$found && !is_null($pull_request_html_url)) {
|
||||
if (! $found && ! is_null($pull_request_html_url)) {
|
||||
ApplicationPreview::create([
|
||||
'application_id' => $this->application->id,
|
||||
'pull_request_id' => $pull_request_id,
|
||||
'pull_request_html_url' => $pull_request_html_url
|
||||
'pull_request_html_url' => $pull_request_html_url,
|
||||
]);
|
||||
}
|
||||
queue_application_deployment(
|
||||
@@ -139,6 +150,7 @@ class Previews extends Component
|
||||
pull_request_id: $pull_request_id,
|
||||
git_type: $found->git_type ?? null,
|
||||
);
|
||||
|
||||
return redirect()->route('project.application.deployment.show', [
|
||||
'project_uuid' => $this->parameters['project_uuid'],
|
||||
'application_uuid' => $this->parameters['application_uuid'],
|
||||
|
||||
@@ -10,12 +10,16 @@ use Visus\Cuid2\Cuid2;
|
||||
class PreviewsCompose extends Component
|
||||
{
|
||||
public $service;
|
||||
|
||||
public $serviceName;
|
||||
|
||||
public ApplicationPreview $preview;
|
||||
|
||||
public function render()
|
||||
{
|
||||
return view('livewire.project.application.previews-compose');
|
||||
}
|
||||
|
||||
public function save()
|
||||
{
|
||||
$domain = data_get($this->service, 'domain');
|
||||
@@ -27,6 +31,7 @@ class PreviewsCompose extends Component
|
||||
$this->dispatch('update_links');
|
||||
$this->dispatch('success', 'Domain saved.');
|
||||
}
|
||||
|
||||
public function generate()
|
||||
{
|
||||
$domains = collect(json_decode($this->preview->application->docker_compose_domains)) ?? collect();
|
||||
|
||||
@@ -10,14 +10,18 @@ use Visus\Cuid2\Cuid2;
|
||||
class Rollback extends Component
|
||||
{
|
||||
public Application $application;
|
||||
|
||||
public $images = [];
|
||||
public string|null $current;
|
||||
|
||||
public ?string $current;
|
||||
|
||||
public array $parameters;
|
||||
|
||||
public function mount()
|
||||
{
|
||||
$this->parameters = get_route_parameters();
|
||||
}
|
||||
|
||||
public function rollbackImage($commit)
|
||||
{
|
||||
$deployment_uuid = new Cuid2(7);
|
||||
@@ -29,6 +33,7 @@ class Rollback extends Component
|
||||
rollback: true,
|
||||
force_rebuild: false,
|
||||
);
|
||||
|
||||
return redirect()->route('project.application.deployment.show', [
|
||||
'project_uuid' => $this->parameters['project_uuid'],
|
||||
'application_uuid' => $this->parameters['application_uuid'],
|
||||
@@ -45,7 +50,7 @@ class Rollback extends Component
|
||||
$output = instant_remote_process([
|
||||
"docker inspect --format='{{.Config.Image}}' {$this->application->uuid}",
|
||||
], $this->application->destination->server, throwError: false);
|
||||
$current_tag = Str::of($output)->trim()->explode(":");
|
||||
$current_tag = Str::of($output)->trim()->explode(':');
|
||||
$this->current = data_get($current_tag, 1);
|
||||
|
||||
$output = instant_remote_process([
|
||||
@@ -58,6 +63,7 @@ class Rollback extends Component
|
||||
if ($item[1] === $this->current) {
|
||||
// $is_current = true;
|
||||
}
|
||||
|
||||
return [
|
||||
'tag' => $item[1],
|
||||
'created_at' => $item[2],
|
||||
@@ -66,6 +72,7 @@ class Rollback extends Component
|
||||
})->toArray();
|
||||
}
|
||||
$showToast && $this->dispatch('success', 'Images loaded.');
|
||||
|
||||
return [];
|
||||
} catch (\Throwable $e) {
|
||||
return handleError($e, $this);
|
||||
|
||||
@@ -9,13 +9,17 @@ use Livewire\Component;
|
||||
class Source extends Component
|
||||
{
|
||||
public $applicationId;
|
||||
|
||||
public Application $application;
|
||||
|
||||
public $private_keys;
|
||||
|
||||
protected $rules = [
|
||||
'application.git_repository' => 'required',
|
||||
'application.git_branch' => 'required',
|
||||
'application.git_commit_sha' => 'nullable',
|
||||
];
|
||||
|
||||
protected $validationAttributes = [
|
||||
'application.git_repository' => 'repository',
|
||||
'application.git_branch' => 'branch',
|
||||
@@ -45,7 +49,7 @@ class Source extends Component
|
||||
public function submit()
|
||||
{
|
||||
$this->validate();
|
||||
if (!$this->application->git_commit_sha) {
|
||||
if (! $this->application->git_commit_sha) {
|
||||
$this->application->git_commit_sha = 'HEAD';
|
||||
}
|
||||
$this->application->save();
|
||||
|
||||
@@ -8,6 +8,7 @@ use Livewire\Component;
|
||||
class Swarm extends Component
|
||||
{
|
||||
public Application $application;
|
||||
|
||||
public string $swarm_placement_constraints = '';
|
||||
|
||||
protected $rules = [
|
||||
@@ -15,12 +16,16 @@ class Swarm extends Component
|
||||
'application.swarm_placement_constraints' => 'nullable',
|
||||
'application.settings.is_swarm_only_worker_nodes' => 'required',
|
||||
];
|
||||
public function mount() {
|
||||
|
||||
public function mount()
|
||||
{
|
||||
if ($this->application->swarm_placement_constraints) {
|
||||
$this->swarm_placement_constraints = base64_decode($this->application->swarm_placement_constraints);
|
||||
}
|
||||
}
|
||||
public function instantSave() {
|
||||
|
||||
public function instantSave()
|
||||
{
|
||||
try {
|
||||
$this->validate();
|
||||
$this->application->settings->save();
|
||||
@@ -29,7 +34,9 @@ class Swarm extends Component
|
||||
return handleError($e, $this);
|
||||
}
|
||||
}
|
||||
public function submit() {
|
||||
|
||||
public function submit()
|
||||
{
|
||||
try {
|
||||
$this->validate();
|
||||
if ($this->swarm_placement_constraints) {
|
||||
@@ -44,6 +51,7 @@ class Swarm extends Component
|
||||
return handleError($e, $this);
|
||||
}
|
||||
}
|
||||
|
||||
public function render()
|
||||
{
|
||||
return view('livewire.project.application.swarm');
|
||||
|
||||
Reference in New Issue
Block a user