From 05f162f4e8ecd2691415229ceff55b0699569799 Mon Sep 17 00:00:00 2001 From: Andras Bacsai Date: Sun, 1 Oct 2023 20:29:35 +0200 Subject: [PATCH 01/11] version++ --- config/sentry.php | 2 +- config/version.php | 2 +- versions.json | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/config/sentry.php b/config/sentry.php index b2cf7844d..47aa02db2 100644 --- a/config/sentry.php +++ b/config/sentry.php @@ -7,7 +7,7 @@ return [ // The release version of your application // Example with dynamic git hash: trim(exec('git --git-dir ' . base_path('.git') . ' log --pretty="%h" -n1 HEAD')) - 'release' => '4.0.0-beta.56', + 'release' => '4.0.0-beta.57', // When left empty or `null` the Laravel environment will be used 'environment' => config('app.env'), diff --git a/config/version.php b/config/version.php index 3a4bcf65b..8ff3d53a5 100644 --- a/config/version.php +++ b/config/version.php @@ -1,3 +1,3 @@ Date: Sun, 1 Oct 2023 20:46:49 +0200 Subject: [PATCH 02/11] fix: show real volume names --- .../Livewire/Project/Shared/Storages/Show.php | 6 ----- app/Models/Service.php | 26 ++++++++++++++----- .../project/shared/storages/show.blade.php | 2 +- 3 files changed, 21 insertions(+), 13 deletions(-) diff --git a/app/Http/Livewire/Project/Shared/Storages/Show.php b/app/Http/Livewire/Project/Shared/Storages/Show.php index 46dd84aff..84593aef3 100644 --- a/app/Http/Livewire/Project/Shared/Storages/Show.php +++ b/app/Http/Livewire/Project/Shared/Storages/Show.php @@ -11,7 +11,6 @@ class Show extends Component public LocalPersistentVolume $storage; public bool $isReadOnly = false; public ?string $modalId = null; - public ?string $realName = null; protected $rules = [ 'storage.name' => 'required|string', @@ -26,11 +25,6 @@ class Show extends Component public function mount() { - if ($this->storage->resource_type === 'App\Models\ServiceApplication' || $this->storage->resource_type === 'App\Models\ServiceDatabase') { - $this->realName = "{$this->storage->service->service->uuid}_{$this->storage->name}"; - } else { - $this->realName = $this->storage->name; - } $this->modalId = new Cuid2(7); } diff --git a/app/Models/Service.php b/app/Models/Service.php index 883a2a784..cfbfeaf48 100644 --- a/app/Models/Service.php +++ b/app/Models/Service.php @@ -248,7 +248,7 @@ class Service extends BaseModel // Collect/create/update volumes if ($serviceVolumes->count() > 0) { - foreach ($serviceVolumes as $volume) { + $serviceVolumes = $serviceVolumes->map(function ($volume) use ($savedService, $topLevelVolumes) { $type = null; $source = null; $target = null; @@ -276,10 +276,10 @@ class Service extends BaseModel } if ($type->value() === 'bind') { if ($source->value() === "/var/run/docker.sock") { - continue; + return $volume; } if ($source->value() === '/tmp' || $source->value() === '/tmp/') { - continue; + return $volume; } LocalFileVolume::updateOrCreate( [ @@ -297,7 +297,17 @@ class Service extends BaseModel ] ); } else if ($type->value() === 'volume') { - $topLevelVolumes->put($source->value(), null); + $slug = Str::slug($source, '-'); + $name = "{$savedService->service->uuid}_{$slug}"; + if (is_string($volume)) { + $source = Str::of($volume)->before(':'); + $target = Str::of($volume)->after(':')->beforeLast(':'); + $source = $name; + $volume = "$source:$target"; + } else if(is_array($volume)) { + data_set($volume, 'source', $name); + } + $topLevelVolumes->put($name, null); LocalPersistentVolume::updateOrCreate( [ 'mount_path' => $target, @@ -305,7 +315,7 @@ class Service extends BaseModel 'resource_type' => get_class($savedService) ], [ - 'name' => Str::slug($source, '-'), + 'name' => $name, 'mount_path' => $target, 'resource_id' => $savedService->id, 'resource_type' => get_class($savedService) @@ -313,7 +323,11 @@ class Service extends BaseModel ); } $savedService->getFilesFromServer(); - } + ray($volume); + + return $volume; + }); + data_set($service, 'volumes', $serviceVolumes->toArray()); } // Add env_file with at least .env to the service diff --git a/resources/views/livewire/project/shared/storages/show.blade.php b/resources/views/livewire/project/shared/storages/show.blade.php index 578ce1607..a7da32f9c 100644 --- a/resources/views/livewire/project/shared/storages/show.blade.php +++ b/resources/views/livewire/project/shared/storages/show.blade.php @@ -12,7 +12,7 @@ @endonce
@if ($isReadOnly) - + @else From acd8541e6816f75135e1add91a449c7bad021e0c Mon Sep 17 00:00:00 2001 From: Alex Justesen Date: Sun, 1 Oct 2023 19:16:37 -0400 Subject: [PATCH 03/11] wee little spacing noticed some missing spacing during the onboarding process. --- resources/views/livewire/boarding/index.blade.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/resources/views/livewire/boarding/index.blade.php b/resources/views/livewire/boarding/index.blade.php index ac754217c..37ed1cfd8 100644 --- a/resources/views/livewire/boarding/index.blade.php +++ b/resources/views/livewire/boarding/index.blade.php @@ -40,7 +40,7 @@ Do you want to deploy your resources on your - or on a? + or on a ? Date: Mon, 2 Oct 2023 09:08:33 +0200 Subject: [PATCH 04/11] fix: only parse expose in dockerfiles if ports_exposes is empty --- app/Http/Livewire/Project/Application/General.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/Http/Livewire/Project/Application/General.php b/app/Http/Livewire/Project/Application/General.php index 6281f45dd..b9d65f504 100644 --- a/app/Http/Livewire/Project/Application/General.php +++ b/app/Http/Livewire/Project/Application/General.php @@ -127,7 +127,7 @@ class General extends Component } if (data_get($this->application, 'dockerfile')) { $port = get_port_from_dockerfile($this->application->dockerfile); - if ($port) { + if ($port && !$this->application->ports_exposes) { $this->application->ports_exposes = $port; } } From d523becb29367b083943667c4485ecb5ced037ff Mon Sep 17 00:00:00 2001 From: Andras Bacsai Date: Mon, 2 Oct 2023 09:08:41 +0200 Subject: [PATCH 05/11] fix: add uuid to volume names --- app/Http/Livewire/Project/Shared/Storages/Add.php | 4 +++- .../views/livewire/project/shared/storages/all.blade.php | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/app/Http/Livewire/Project/Shared/Storages/Add.php b/app/Http/Livewire/Project/Shared/Storages/Add.php index e7831f1cb..1edfe03a4 100644 --- a/app/Http/Livewire/Project/Shared/Storages/Add.php +++ b/app/Http/Livewire/Project/Shared/Storages/Add.php @@ -6,6 +6,7 @@ use Livewire\Component; class Add extends Component { + public $uuid; public $parameters; public string $name; public string $mount_path; @@ -31,8 +32,9 @@ class Add extends Component public function submit() { $this->validate(); + $name = $this->uuid . '-' . $this->name; $this->emitUp('submit', [ - 'name' => $this->name, + 'name' => $name, 'mount_path' => $this->mount_path, 'host_path' => $this->host_path, ]); diff --git a/resources/views/livewire/project/shared/storages/all.blade.php b/resources/views/livewire/project/shared/storages/all.blade.php index 22215f6a9..21f7a89ae 100644 --- a/resources/views/livewire/project/shared/storages/all.blade.php +++ b/resources/views/livewire/project/shared/storages/all.blade.php @@ -8,7 +8,7 @@ volume name, example: -pr-1" /> + Add - + @endif
Persistent storage to preserve data between deployments.
From 5d6ee04991c51f7ec7ecc659a0e963d9262eb986 Mon Sep 17 00:00:00 2001 From: Andras Bacsai Date: Mon, 2 Oct 2023 09:18:32 +0200 Subject: [PATCH 06/11] fix: new volumes for services should have - instead of _ --- app/Models/Service.php | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/app/Models/Service.php b/app/Models/Service.php index cfbfeaf48..05be5fef4 100644 --- a/app/Models/Service.php +++ b/app/Models/Service.php @@ -248,7 +248,7 @@ class Service extends BaseModel // Collect/create/update volumes if ($serviceVolumes->count() > 0) { - $serviceVolumes = $serviceVolumes->map(function ($volume) use ($savedService, $topLevelVolumes) { + $serviceVolumes = $serviceVolumes->map(function ($volume) use ($savedService, $topLevelVolumes, $isNew) { $type = null; $source = null; $target = null; @@ -298,7 +298,11 @@ class Service extends BaseModel ); } else if ($type->value() === 'volume') { $slug = Str::slug($source, '-'); - $name = "{$savedService->service->uuid}_{$slug}"; + if ($isNew) { + $name = "{$savedService->service->uuid}-{$slug}"; + } else { + $name = "{$savedService->service->uuid}_{$slug}"; + } if (is_string($volume)) { $source = Str::of($volume)->before(':'); $target = Str::of($volume)->after(':')->beforeLast(':'); @@ -323,8 +327,6 @@ class Service extends BaseModel ); } $savedService->getFilesFromServer(); - ray($volume); - return $volume; }); data_set($service, 'volumes', $serviceVolumes->toArray()); From fd9c13009fd91ec388e41202c4afaabe603744ae Mon Sep 17 00:00:00 2001 From: Andras Bacsai Date: Mon, 2 Oct 2023 09:37:55 +0200 Subject: [PATCH 07/11] fix: always pull helper image in dev --- app/Jobs/ApplicationDeploymentJob.php | 3 --- 1 file changed, 3 deletions(-) diff --git a/app/Jobs/ApplicationDeploymentJob.php b/app/Jobs/ApplicationDeploymentJob.php index f9ff54fd0..0726d66e5 100644 --- a/app/Jobs/ApplicationDeploymentJob.php +++ b/app/Jobs/ApplicationDeploymentJob.php @@ -379,9 +379,6 @@ class ApplicationDeploymentJob implements ShouldQueue, ShouldBeEncrypted private function prepare_builder_image() { $pull = "--pull=always"; - if (isDev()) { - $pull = "--pull=never"; - } $helperImage = config('coolify.helper_image'); $runCommand = "docker run {$pull} -d --network {$this->destination->network} -v /:/host --name {$this->deployment_uuid} --rm -v /var/run/docker.sock:/var/run/docker.sock {$helperImage}"; From 97027875bfc64d96a698c70ada10edf85001ae16 Mon Sep 17 00:00:00 2001 From: Andras Bacsai Date: Mon, 2 Oct 2023 13:38:16 +0200 Subject: [PATCH 08/11] feat: container logs --- app/Http/Livewire/Project/Shared/GetLogs.php | 40 +++++++++ app/Http/Livewire/Project/Shared/Logs.php | 53 ++++++++++++ .../components/applications/navbar.blade.php | 4 + .../components/databases/navbar.blade.php | 4 + .../components/services/navbar.blade.php | 4 + .../livewire/project/service/index.blade.php | 86 +++++++++++-------- .../livewire/project/service/show.blade.php | 7 +- .../project/shared/get-logs.blade.php | 18 ++++ .../livewire/project/shared/logs.blade.php | 41 +++++++++ routes/web.php | 7 ++ 10 files changed, 225 insertions(+), 39 deletions(-) create mode 100644 app/Http/Livewire/Project/Shared/GetLogs.php create mode 100644 app/Http/Livewire/Project/Shared/Logs.php create mode 100644 resources/views/livewire/project/shared/get-logs.blade.php create mode 100644 resources/views/livewire/project/shared/logs.blade.php diff --git a/app/Http/Livewire/Project/Shared/GetLogs.php b/app/Http/Livewire/Project/Shared/GetLogs.php new file mode 100644 index 000000000..aba2e2649 --- /dev/null +++ b/app/Http/Livewire/Project/Shared/GetLogs.php @@ -0,0 +1,40 @@ +outputs .= $output; + } + public function instantSave() + { + } + public function getLogs($refresh = false) + { + if ($this->container) { + $sshCommand = generateSshCommand($this->server, "docker logs -t {$this->container}"); + if ($refresh) { + $this->outputs = ''; + } + Process::run($sshCommand, function (string $type, string $output) { + $this->doSomethingWithThisChunkOfOutput($output); + }); + } + } + public function render() + { + return view('livewire.project.shared.get-logs'); + } +} diff --git a/app/Http/Livewire/Project/Shared/Logs.php b/app/Http/Livewire/Project/Shared/Logs.php new file mode 100644 index 000000000..69848a7c5 --- /dev/null +++ b/app/Http/Livewire/Project/Shared/Logs.php @@ -0,0 +1,53 @@ +parameters = get_route_parameters(); + $this->query = request()->query(); + if (data_get($this->parameters, 'application_uuid')) { + $this->type = 'application'; + $this->resource = Application::where('uuid', $this->parameters['application_uuid'])->firstOrFail(); + $this->status = $this->resource->status; + $this->server = $this->resource->destination->server; + $containers = getCurrentApplicationContainerStatus($this->server, $this->resource->id); + if ($containers->count() > 0) { + $this->container = data_get($containers[0], 'Names'); + } + } else if (data_get($this->parameters, 'database_uuid')) { + $this->type = 'database'; + $this->resource = StandalonePostgresql::where('uuid', $this->parameters['database_uuid'])->firstOrFail(); + $this->status = $this->resource->status; + $this->server = $this->resource->destination->server; + $this->container = $this->resource->uuid; + } else if (data_get($this->parameters, 'service_uuid')) { + $this->type = 'service'; + $this->resource = Service::where('uuid', $this->parameters['service_uuid'])->firstOrFail(); + $this->status = $this->resource->status; + $this->server = $this->resource->server; + $this->container = data_get($this->parameters, 'service_name') . '-' . $this->resource->uuid; + } + } + + public function render() + { + return view('livewire.project.shared.logs'); + } +} diff --git a/resources/views/components/applications/navbar.blade.php b/resources/views/components/applications/navbar.blade.php index 00a390826..b84b0bf13 100644 --- a/resources/views/components/applications/navbar.blade.php +++ b/resources/views/components/applications/navbar.blade.php @@ -7,6 +7,10 @@ href="{{ route('project.application.deployments', $parameters) }}"> + + +
diff --git a/resources/views/components/databases/navbar.blade.php b/resources/views/components/databases/navbar.blade.php index 9136220b1..6681565ba 100644 --- a/resources/views/components/databases/navbar.blade.php +++ b/resources/views/components/databases/navbar.blade.php @@ -3,6 +3,10 @@ href="{{ route('project.database.configuration', $parameters) }}"> + + + diff --git a/resources/views/components/services/navbar.blade.php b/resources/views/components/services/navbar.blade.php index 0bf49f3e3..43e16c3df 100644 --- a/resources/views/components/services/navbar.blade.php +++ b/resources/views/components/services/navbar.blade.php @@ -1,4 +1,8 @@ Save - Edit Compose File + Edit Compose + File
@endforeach @foreach ($databases as $database) - Str::of( $database->status)->contains(['exited']), 'border-l border-dashed border-success' => Str::of( $database->status)->contains(['running']), 'border-l border-dashed border-warning' => Str::of( $database->status)->contains(['restarting']), - 'flex flex-col justify-center box', - ]) - href="{{ route('project.service.show', [...$parameters, 'service_name' => $database->name]) }}"> - @if ($database->human_name) - {{ Str::headline($database->human_name) }} - @else - {{ Str::headline($database->name) }} - @endif - @if ($database->configuration_required) - (configuration required) - @endif - @if ($database->description) - {{ Str::limit($database->description, 60) }} - @endif -
{{ $database->status }}
-
+ 'flex gap-2 box group', + ])> + + @if ($database->human_name) + {{ Str::headline($database->human_name) }} + @else + {{ Str::headline($database->name) }} + @endif + @if ($database->configuration_required) + (configuration required) + @endif + @if ($database->description) + {{ Str::limit($database->description, 60) }} + @endif +
{{ $database->status }}
+
+ Logs +
@endforeach diff --git a/resources/views/livewire/project/service/show.blade.php b/resources/views/livewire/project/service/show.blade.php index e0ab934a2..8fcfc008a 100644 --- a/resources/views/livewire/project/service/show.blade.php +++ b/resources/views/livewire/project/service/show.blade.php @@ -11,6 +11,12 @@ Storages + @if (data_get($parameters, 'service_name')) + + + + @endif
@isset($serviceApplication) @@ -32,7 +38,6 @@ @isset($serviceDatabase)
-
diff --git a/resources/views/livewire/project/shared/get-logs.blade.php b/resources/views/livewire/project/shared/get-logs.blade.php new file mode 100644 index 000000000..0551fd5fe --- /dev/null +++ b/resources/views/livewire/project/shared/get-logs.blade.php @@ -0,0 +1,18 @@ +
+
+

Logs

+ @if ($streamLogs) + + @endif +
+
+ +
+
+
+ +
{{ $outputs }}
+
+
+
diff --git a/resources/views/livewire/project/shared/logs.blade.php b/resources/views/livewire/project/shared/logs.blade.php new file mode 100644 index 000000000..72c1d3a3f --- /dev/null +++ b/resources/views/livewire/project/shared/logs.blade.php @@ -0,0 +1,41 @@ + + @if ($type === 'application') +

Logs

+ +
+ @if (Str::of($status)->startsWith('running')) + + @else + Application is not running. + @endif +
+ @elseif ($type === 'database') +

Logs

+ +
+ @if (Str::of($status)->startsWith('running')) + + @else + Database is not running. + @endif +
+ @elseif ($type === 'service') + +
+ +
+ @if (Str::of($status)->startsWith('running')) + + @else + Service is not running. + @endif +
+
+ @endif + +
diff --git a/routes/web.php b/routes/web.php index 34adf01b2..8fe8bd1db 100644 --- a/routes/web.php +++ b/routes/web.php @@ -10,6 +10,7 @@ use App\Http\Livewire\Boarding\Index as BoardingIndex; use App\Http\Livewire\Project\Service\Index as ServiceIndex; use App\Http\Livewire\Project\Service\Show as ServiceShow; use App\Http\Livewire\Dashboard; +use App\Http\Livewire\Project\Shared\Logs; use App\Http\Livewire\Server\All; use App\Http\Livewire\Server\Show; use App\Http\Livewire\Waitlist\Index as WaitlistIndex; @@ -80,14 +81,20 @@ Route::middleware(['auth'])->group(function () { [ApplicationController::class, 'deployment'] )->name('project.application.deployment'); + Route::get('/project/{project_uuid}/{environment_name}/application/{application_uuid}/logs', Logs::class)->name('project.application.logs'); + // Databases Route::get('/project/{project_uuid}/{environment_name}/database/{database_uuid}', [DatabaseController::class, 'configuration'])->name('project.database.configuration'); Route::get('/project/{project_uuid}/{environment_name}/database/{database_uuid}/backups', [DatabaseController::class, 'backups'])->name('project.database.backups.all'); Route::get('/project/{project_uuid}/{environment_name}/database/{database_uuid}/backups/{backup_uuid}', [DatabaseController::class, 'executions'])->name('project.database.backups.executions'); + Route::get('/project/{project_uuid}/{environment_name}/database/{database_uuid}/logs', Logs::class)->name('project.database.logs'); + // Services Route::get('/project/{project_uuid}/{environment_name}/service/{service_uuid}', ServiceIndex::class)->name('project.service'); Route::get('/project/{project_uuid}/{environment_name}/service/{service_uuid}/{service_name}', ServiceShow::class)->name('project.service.show'); + Route::get('/project/{project_uuid}/{environment_name}/service/{service_uuid}/{service_name}/logs', Logs::class)->name('project.service.logs'); + }); Route::middleware(['auth'])->group(function () { From 3adc0bdd6ee1fc721d2fb23b96bd09cf72751868 Mon Sep 17 00:00:00 2001 From: Andras Bacsai Date: Mon, 2 Oct 2023 14:01:16 +0200 Subject: [PATCH 09/11] fix: only show last 1000 lines --- app/Http/Livewire/Project/Shared/GetLogs.php | 4 ++-- resources/views/livewire/project/shared/get-logs.blade.php | 7 ++++++- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/app/Http/Livewire/Project/Shared/GetLogs.php b/app/Http/Livewire/Project/Shared/GetLogs.php index aba2e2649..6c2ce37b5 100644 --- a/app/Http/Livewire/Project/Shared/GetLogs.php +++ b/app/Http/Livewire/Project/Shared/GetLogs.php @@ -13,7 +13,7 @@ class GetLogs extends Component public Server $server; public ?string $container = null; public ?bool $streamLogs = false; - + public int $numberOfLines = 1000; public function doSomethingWithThisChunkOfOutput($output) { $this->outputs .= $output; @@ -24,7 +24,7 @@ class GetLogs extends Component public function getLogs($refresh = false) { if ($this->container) { - $sshCommand = generateSshCommand($this->server, "docker logs -t {$this->container}"); + $sshCommand = generateSshCommand($this->server, "docker logs -n {$this->numberOfLines} -t {$this->container}"); if ($refresh) { $this->outputs = ''; } diff --git a/resources/views/livewire/project/shared/get-logs.blade.php b/resources/views/livewire/project/shared/get-logs.blade.php index 0551fd5fe..c1ca915a6 100644 --- a/resources/views/livewire/project/shared/get-logs.blade.php +++ b/resources/views/livewire/project/shared/get-logs.blade.php @@ -2,9 +2,14 @@

Logs

@if ($streamLogs) - + @endif
+ + + + Set +
From f863db7ea51ebe4b5e8266cad42215f6befaa36f Mon Sep 17 00:00:00 2001 From: Andras Bacsai Date: Mon, 2 Oct 2023 14:01:54 +0200 Subject: [PATCH 10/11] only 100 --- app/Http/Livewire/Project/Shared/GetLogs.php | 2 +- resources/views/livewire/project/shared/get-logs.blade.php | 3 +-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/app/Http/Livewire/Project/Shared/GetLogs.php b/app/Http/Livewire/Project/Shared/GetLogs.php index 6c2ce37b5..cd0ee98fd 100644 --- a/app/Http/Livewire/Project/Shared/GetLogs.php +++ b/app/Http/Livewire/Project/Shared/GetLogs.php @@ -13,7 +13,7 @@ class GetLogs extends Component public Server $server; public ?string $container = null; public ?bool $streamLogs = false; - public int $numberOfLines = 1000; + public int $numberOfLines = 100; public function doSomethingWithThisChunkOfOutput($output) { $this->outputs .= $output; diff --git a/resources/views/livewire/project/shared/get-logs.blade.php b/resources/views/livewire/project/shared/get-logs.blade.php index c1ca915a6..31f6e6bc3 100644 --- a/resources/views/livewire/project/shared/get-logs.blade.php +++ b/resources/views/livewire/project/shared/get-logs.blade.php @@ -5,10 +5,9 @@ @endif
-
- Set + Refresh
From ab5202515ef9881bd1a1adf8994f0590799baba5 Mon Sep 17 00:00:00 2001 From: Andras Bacsai Date: Mon, 2 Oct 2023 14:12:19 +0200 Subject: [PATCH 11/11] fix: service status --- app/Http/Livewire/Project/Service/Navbar.php | 1 - resources/views/livewire/project/shared/logs.blade.php | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/app/Http/Livewire/Project/Service/Navbar.php b/app/Http/Livewire/Project/Service/Navbar.php index e4980696c..3f7679c56 100644 --- a/app/Http/Livewire/Project/Service/Navbar.php +++ b/app/Http/Livewire/Project/Service/Navbar.php @@ -21,7 +21,6 @@ class Navbar extends Component } public function serviceStatusUpdated() { - ray('serviceStatusUpdated'); $this->check_status(); } public function check_status() diff --git a/resources/views/livewire/project/shared/logs.blade.php b/resources/views/livewire/project/shared/logs.blade.php index 72c1d3a3f..2fe2a74cb 100644 --- a/resources/views/livewire/project/shared/logs.blade.php +++ b/resources/views/livewire/project/shared/logs.blade.php @@ -29,7 +29,7 @@
- @if (Str::of($status)->startsWith('running')) + @if (serviceStatus($resource) === 'running') @else Service is not running.