path deployments

This commit is contained in:
Andras Bacsai 2023-05-16 15:27:47 +02:00
parent 28cf89627d
commit 8651d02651
5 changed files with 17 additions and 8 deletions

View File

@ -46,6 +46,9 @@ public function resources()
if (!$environment) {
return redirect()->route('dashboard');
}
return view('project.resources', ['project' => $project, 'environment' => $environment]);
return view('project.resources', [
'project' => $project,
'environment' => $environment
]);
}
}

View File

@ -73,7 +73,11 @@ public function mount()
}
public function submit()
{
$this->validate();
$this->application->save();
try {
$this->validate();
$this->application->save();
} catch (\Exception $e) {
return generalErrorHandler($e, $this);
}
}
}

View File

@ -383,9 +383,11 @@ private function set_labels_for_applications()
$path = $url->getPath();
$labels[] = 'traefik.enable=true';
if ($path === '/') {
$labels[] = "traefik.http.routers.container.rule=Host(`{$host}`) && PathPrefix(`{$path}`)";
$labels[] = "traefik.http.routers.{$this->application->uuid}.rule=Host(`{$host}`) && Path(`{$path}`)";
} else {
$labels[] = "traefik.http.routers.container.rule=Host(`{$host}`) && PathPrefix(`{$path}`)";
$labels[] = "traefik.http.routers.{$this->application->uuid}.rule=Host(`{$host}`) && PathPrefix(`{$path}`)";
$labels[] = "traefik.http.routers.{$this->application->uuid}.middlewares={$this->application->uuid}-stripprefix";
$labels[] = "traefik.http.middlewares.{$this->application->uuid}-stripprefix.stripprefix.prefixes={$path}";
}
}
return $labels;

View File

@ -33,7 +33,7 @@ function generalErrorHandler(\Throwable $e, $that = null, $isJson = false)
}
} catch (\Throwable $error) {
if ($that) {
$that->emit('error', $error->getMessage());
return $that->emit('error', $error->getMessage());
} elseif ($isJson) {
return response()->json([
'code' => $error->getCode(),

View File

@ -6,8 +6,8 @@
@if ($environment->applications->count() === 0)
<p>No resources yet.</p>
@endif
<div class="flex">
@foreach ($environment->applications as $application)
<div class="flex gap-2">
@foreach ($environment->applications->sortBy('name') as $application)
<a class="box"
href="{{ route('project.application.configuration', [$project->uuid, $environment->name, $application->uuid]) }}">
{{ $application->name }}