fix: containerstatusjob
This commit is contained in:
parent
fabb97330a
commit
3eb628b773
@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
namespace App\Http\Livewire\Project\Service;
|
namespace App\Http\Livewire\Project\Service;
|
||||||
|
|
||||||
|
use App\Jobs\ContainerStatusJob;
|
||||||
use App\Models\Service;
|
use App\Models\Service;
|
||||||
use DanHarrin\LivewireRateLimiting\WithRateLimiting;
|
use DanHarrin\LivewireRateLimiting\WithRateLimiting;
|
||||||
use Livewire\Component;
|
use Livewire\Component;
|
||||||
@ -23,6 +24,7 @@ class Index extends Component
|
|||||||
public function manualRefreshStack() {
|
public function manualRefreshStack() {
|
||||||
try {
|
try {
|
||||||
$this->rateLimit(5);
|
$this->rateLimit(5);
|
||||||
|
dispatch_sync(new ContainerStatusJob($this->service->server));
|
||||||
$this->refreshStack();
|
$this->refreshStack();
|
||||||
} catch(\Throwable $e) {
|
} catch(\Throwable $e) {
|
||||||
return handleError($e, $this);
|
return handleError($e, $this);
|
||||||
|
@ -74,7 +74,7 @@ class ContainerStatusJob implements ShouldQueue, ShouldBeEncrypted
|
|||||||
$containers = format_docker_command_output_to_json($containers);
|
$containers = format_docker_command_output_to_json($containers);
|
||||||
$applications = $this->server->applications();
|
$applications = $this->server->applications();
|
||||||
$databases = $this->server->databases();
|
$databases = $this->server->databases();
|
||||||
$services = $this->server->services();
|
$services = $this->server->services()->get();
|
||||||
$previews = $this->server->previews();
|
$previews = $this->server->previews();
|
||||||
$this->server->proxyType();
|
$this->server->proxyType();
|
||||||
/// Check if proxy is running
|
/// Check if proxy is running
|
||||||
@ -170,7 +170,7 @@ class ContainerStatusJob implements ShouldQueue, ShouldBeEncrypted
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
$exitedServices = collect([]);
|
$exitedServices = collect([]);
|
||||||
foreach ($services->get() as $service) {
|
foreach ($services as $service) {
|
||||||
$apps = $service->applications()->get();
|
$apps = $service->applications()->get();
|
||||||
$dbs = $service->databases()->get();
|
$dbs = $service->databases()->get();
|
||||||
foreach ($apps as $app) {
|
foreach ($apps as $app) {
|
||||||
|
@ -5,6 +5,7 @@ namespace App\Models;
|
|||||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||||
use Illuminate\Database\Eloquent\Relations\HasMany;
|
use Illuminate\Database\Eloquent\Relations\HasMany;
|
||||||
use Illuminate\Support\Collection;
|
use Illuminate\Support\Collection;
|
||||||
|
use Illuminate\Support\Facades\Cache;
|
||||||
use Symfony\Component\Yaml\Yaml;
|
use Symfony\Component\Yaml\Yaml;
|
||||||
use Illuminate\Support\Str;
|
use Illuminate\Support\Str;
|
||||||
use Spatie\Url\Url;
|
use Spatie\Url\Url;
|
||||||
@ -47,6 +48,12 @@ class Service extends BaseModel
|
|||||||
return 'service';
|
return 'service';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function documentation()
|
||||||
|
{
|
||||||
|
$services = Cache::get('services', []);
|
||||||
|
$service = data_get($services, Str::of($this->name)->beforeLast('-')->value, []);
|
||||||
|
return data_get($service, 'documentation', 'https://coolify.io/docs');
|
||||||
|
}
|
||||||
public function applications()
|
public function applications()
|
||||||
{
|
{
|
||||||
return $this->hasMany(ServiceApplication::class);
|
return $this->hasMany(ServiceApplication::class);
|
||||||
@ -137,8 +144,6 @@ class Service extends BaseModel
|
|||||||
if (!$requiredFqdns) {
|
if (!$requiredFqdns) {
|
||||||
$requiredFqdns = collect([]);
|
$requiredFqdns = collect([]);
|
||||||
}
|
}
|
||||||
ray('parsing');
|
|
||||||
// ray()->clearAll();
|
|
||||||
if ($this->docker_compose_raw) {
|
if ($this->docker_compose_raw) {
|
||||||
try {
|
try {
|
||||||
$yaml = Yaml::parse($this->docker_compose_raw);
|
$yaml = Yaml::parse($this->docker_compose_raw);
|
||||||
@ -513,7 +518,6 @@ class Service extends BaseModel
|
|||||||
$number = 0;
|
$number = 0;
|
||||||
}
|
}
|
||||||
$fqdn = getFqdnWithoutPort(data_get($fqdns, $number, $fqdns->first()));
|
$fqdn = getFqdnWithoutPort(data_get($fqdns, $number, $fqdns->first()));
|
||||||
ray($fqdns);
|
|
||||||
$environments = collect(data_get($service, 'environment'));
|
$environments = collect(data_get($service, 'environment'));
|
||||||
$environments = $environments->map(function ($envValue) use ($value, $fqdn) {
|
$environments = $environments->map(function ($envValue) use ($value, $fqdn) {
|
||||||
$envValue = Str::of($envValue)->replace($value, $fqdn);
|
$envValue = Str::of($envValue)->replace($value, $fqdn);
|
||||||
|
@ -14,12 +14,6 @@ class ServiceApplication extends BaseModel
|
|||||||
{
|
{
|
||||||
return 'service';
|
return 'service';
|
||||||
}
|
}
|
||||||
public function documentation()
|
|
||||||
{
|
|
||||||
$services = Cache::get('services', []);
|
|
||||||
$service = data_get($services, $this->name, []);
|
|
||||||
return data_get($service, 'documentation', 'https://coolify.io/docs');
|
|
||||||
}
|
|
||||||
public function service()
|
public function service()
|
||||||
{
|
{
|
||||||
return $this->belongsTo(Service::class);
|
return $this->belongsTo(Service::class);
|
||||||
|
@ -14,10 +14,6 @@ class ServiceDatabase extends BaseModel
|
|||||||
{
|
{
|
||||||
return 'service';
|
return 'service';
|
||||||
}
|
}
|
||||||
public function documentation()
|
|
||||||
{
|
|
||||||
return data_get(Yaml::parse($this->service->docker_compose_raw), "services.{$this->name}.documentation", 'https://coolify.io/docs');
|
|
||||||
}
|
|
||||||
public function service()
|
public function service()
|
||||||
{
|
{
|
||||||
return $this->belongsTo(Service::class);
|
return $this->belongsTo(Service::class);
|
||||||
|
@ -8,7 +8,6 @@
|
|||||||
@endif
|
@endif
|
||||||
<x-forms.button type="submit">Save</x-forms.button>
|
<x-forms.button type="submit">Save</x-forms.button>
|
||||||
<x-forms.button isError wire:click='delete'>Delete</x-forms.button>
|
<x-forms.button isError wire:click='delete'>Delete</x-forms.button>
|
||||||
<a target="_blank" href="{{ $application->documentation() }}">Documentation <x-external-link /></a>
|
|
||||||
</div>
|
</div>
|
||||||
<div class="flex flex-col gap-2">
|
<div class="flex flex-col gap-2">
|
||||||
<div class="flex gap-2">
|
<div class="flex gap-2">
|
||||||
|
@ -7,7 +7,6 @@
|
|||||||
<h2>{{ Str::headline($database->name) }}</h2>
|
<h2>{{ Str::headline($database->name) }}</h2>
|
||||||
@endif
|
@endif
|
||||||
<x-forms.button type="submit">Save</x-forms.button>
|
<x-forms.button type="submit">Save</x-forms.button>
|
||||||
<a target="_blank" href="{{ $database->documentation() }}">Documentation <x-external-link /></a>
|
|
||||||
</div>
|
</div>
|
||||||
<div class="flex flex-col gap-2">
|
<div class="flex flex-col gap-2">
|
||||||
<div class="flex gap-2">
|
<div class="flex gap-2">
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
<livewire:project.service.navbar :service="$service" :parameters="$parameters" :query="$query" />
|
<livewire:project.service.navbar :service="$service" :parameters="$parameters" :query="$query" />
|
||||||
<div class="flex h-full pt-6">
|
<div class="flex h-full pt-6">
|
||||||
<div class="flex flex-col gap-4 min-w-fit">
|
<div class="flex flex-col gap-4 min-w-fit">
|
||||||
|
<a target="_blank" href="{{ $service->documentation() }}">Documentation <x-external-link /></a>
|
||||||
<a :class="activeTab === 'service-stack' && 'text-white'"
|
<a :class="activeTab === 'service-stack' && 'text-white'"
|
||||||
@click.prevent="activeTab = 'service-stack'; window.location.hash = 'service-stack'"
|
@click.prevent="activeTab = 'service-stack'; window.location.hash = 'service-stack'"
|
||||||
href="#">Service Stack</a>
|
href="#">Service Stack</a>
|
||||||
@ -21,6 +22,7 @@
|
|||||||
<div class="flex gap-2">
|
<div class="flex gap-2">
|
||||||
<h2 class="pb-4">Configuration </h2>
|
<h2 class="pb-4">Configuration </h2>
|
||||||
<x-forms.button type="submit">Save</x-forms.button>
|
<x-forms.button type="submit">Save</x-forms.button>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
<div class="flex gap-2">
|
<div class="flex gap-2">
|
||||||
<x-forms.input id="service.name" required label="Service Name"
|
<x-forms.input id="service.name" required label="Service Name"
|
||||||
@ -40,7 +42,7 @@
|
|||||||
'border-l border-dashed border-success' => Str::of(
|
'border-l border-dashed border-success' => Str::of(
|
||||||
$application->status)->contains(['running']),
|
$application->status)->contains(['running']),
|
||||||
'border-l border-dashed border-warning' => Str::of(
|
'border-l border-dashed border-warning' => Str::of(
|
||||||
$application->status)->contains(['restarting']),
|
$application->status)->contains(['starting']),
|
||||||
'flex flex-col justify-center box',
|
'flex flex-col justify-center box',
|
||||||
])
|
])
|
||||||
href="{{ route('project.service.show', [...$parameters, 'service_name' => $application->name]) }}">
|
href="{{ route('project.service.show', [...$parameters, 'service_name' => $application->name]) }}">
|
||||||
|
Loading…
x
Reference in New Issue
Block a user