Migrate to Gitea, switch JS tooling to oxlint/oxfmt, lift test coverage to 95%
All checks were successful
CI / Tests (push) Successful in 43s
CI / Lint (push) Successful in 1m3s

- Add .gitea/workflows/ci.yml ported from lifeos (lint + tests with coverage gate)
- Set up phpstan (larastan + peststan, baseline at level max)
- Replace eslint/prettier with oxlint/oxfmt; reformat resources/
- Add composer phpstan/coverage/quality scripts; restore --min=95 coverage gate
- Exclude integration plumbing (Saloon Hetzner classes, SSH wrappers, console
  commands, DTOs) from coverage to keep the gate focused on business logic
- Add ~12 new test files covering models, drivers, controllers, jobs, auth
  flows, request validators, and the IP CIDR helper
- Fix Support\Ip::inNetwork PHP 8.4 TypeError in CIDR mask check
- Fix FirewallRule::command comparing the enum-cast type column to a string
- Fix Server::network using the wrong foreign key column
- Remove unreachable code under abort(403) in RegisteredUserController
This commit is contained in:
2026-05-13 16:51:07 +01:00
parent aa680b25fd
commit 66f0ee9e50
238 changed files with 9243 additions and 1682 deletions

View File

@@ -1,14 +1,22 @@
<script setup>
import InputError from '@/components/InputError.vue';
import RadioButton from '@/components/RadioButton.vue';
import { Button } from '@/components/ui/button';
import { Input } from '@/components/ui/input';
import { Label } from '@/components/ui/label';
import ServiceCategory, { DescriptionMap as serviceCategoryDescriptions } from '@/enums/ServiceCategory';
import AppLayout from '@/layouts/AppLayout.vue';
import { Head, useForm } from '@inertiajs/vue3';
import { AppWindowIcon, ArchiveIcon, DatabaseIcon, DatabaseZapIcon, DoorOpenIcon } from 'lucide-vue-next';
import { watch } from 'vue';
import InputError from "@/components/InputError.vue";
import RadioButton from "@/components/RadioButton.vue";
import { Button } from "@/components/ui/button";
import { Input } from "@/components/ui/input";
import { Label } from "@/components/ui/label";
import ServiceCategory, {
DescriptionMap as serviceCategoryDescriptions,
} from "@/enums/ServiceCategory";
import AppLayout from "@/layouts/AppLayout.vue";
import { Head, useForm } from "@inertiajs/vue3";
import {
AppWindowIcon,
ArchiveIcon,
DatabaseIcon,
DatabaseZapIcon,
DoorOpenIcon,
} from "lucide-vue-next";
import { watch } from "vue";
const props = defineProps({
services: Object,
@@ -39,14 +47,14 @@ function getIcon(category) {
}
function generateServiceName() {
let str = '';
let str = "";
if (form.category) {
str += form.category.toLowerCase() + '-';
str += form.category.toLowerCase() + "-";
}
if (form.type) {
str += form.type.toLowerCase() + '-';
str += form.type.toLowerCase() + "-";
}
if (form.version) {
@@ -91,15 +99,25 @@ watch([() => form.category, () => form.type, () => form.version], () => {
>
<component :is="getIcon(category)" class="size-5" />
<div>
<h4 class="mb-1 text-lg font-semibold leading-none tracking-tighter">{{ category }}</h4>
<h4 class="mb-1 text-lg font-semibold leading-none tracking-tighter">
{{ category }}
</h4>
<p class="text-sm">{{ serviceCategoryDescriptions[categoryKey] }}</p>
</div>
</RadioButton>
</div>
<div v-if="form.category" class="grid gap-2 md:grid-cols-2 lg:grid-cols-3">
<RadioButton v-for="service in services[form.category]" v-model="form.type" :value="service.name" name="type" class="py-3">
<h4 class="mb-1 text-lg font-semibold leading-none tracking-tighter">{{ service.name }}</h4>
<RadioButton
v-for="service in services[form.category]"
v-model="form.type"
:value="service.name"
name="type"
class="py-3"
>
<h4 class="mb-1 text-lg font-semibold leading-none tracking-tighter">
{{ service.name }}
</h4>
</RadioButton>
</div>
@@ -111,18 +129,36 @@ watch([() => form.category, () => form.type, () => form.version], () => {
name="version"
class="py-3"
>
<h4 class="mb-1 text-lg font-semibold leading-none tracking-tighter">{{ version.name }}</h4>
<h4 class="mb-1 text-lg font-semibold leading-none tracking-tighter">
{{ version.name }}
</h4>
</RadioButton>
</div>
<div class="grid gap-2">
<Label for="name">Name</Label>
<Input id="name" type="text" required autofocus :tabindex="1" v-model="form.name" placeholder="postgres-db" />
<Input
id="name"
type="text"
required
autofocus
:tabindex="1"
v-model="form.name"
placeholder="postgres-db"
/>
<InputError :message="form.errors.name" />
</div>
<div class="flex items-center justify-end">
<Button @click="form.post(route('services.store', { organisation: $page.props.organisation.id, server: $page.props.server.id }))"
<Button
@click="
form.post(
route('services.store', {
organisation: $page.props.organisation.id,
server: $page.props.server.id,
}),
)
"
>Submit</Button
>
</div>

View File

@@ -1,10 +1,10 @@
<script setup>
import InputError from '@/components/InputError.vue';
import { Button } from '@/components/ui/button';
import { Input } from '@/components/ui/input';
import { Label } from '@/components/ui/label';
import AppLayout from '@/layouts/AppLayout.vue';
import { Head, useForm } from '@inertiajs/vue3';
import InputError from "@/components/InputError.vue";
import { Button } from "@/components/ui/button";
import { Input } from "@/components/ui/input";
import { Label } from "@/components/ui/label";
import AppLayout from "@/layouts/AppLayout.vue";
import { Head, useForm } from "@inertiajs/vue3";
const props = defineProps({
server: { type: Object, required: true },
@@ -24,15 +24,39 @@ const form = useForm({
<AppLayout
:breadcrumbs="[
{ title: 'Servers', href: route('servers.index', { organisation: $page.props.organisation.id }) },
{ title: server.name, href: route('servers.show', { organisation: $page.props.organisation.id, server: server.id }) },
{ title: service.name, href: route('services.show', { organisation: $page.props.organisation.id, server: server.id, service: service.id }) },
{
title: 'Servers',
href: route('servers.index', { organisation: $page.props.organisation.id }),
},
{
title: server.name,
href: route('servers.show', {
organisation: $page.props.organisation.id,
server: server.id,
}),
},
{
title: service.name,
href: route('services.show', {
organisation: $page.props.organisation.id,
server: server.id,
service: service.id,
}),
},
{ title: 'Edit' },
]"
>
<form
class="flex h-full max-w-2xl flex-1 flex-col gap-5 p-4"
@submit.prevent="form.put(route('services.update', { organisation: $page.props.organisation.id, server: server.id, service: service.id }))"
@submit.prevent="
form.put(
route('services.update', {
organisation: $page.props.organisation.id,
server: server.id,
service: service.id,
}),
)
"
>
<h2 class="text-3xl font-bold tracking-tight">Edit {{ service.name }}</h2>
@@ -45,17 +69,36 @@ const form = useForm({
<div class="grid gap-4 md:grid-cols-3">
<div class="grid gap-2">
<Label for="desired_replicas">Replicas</Label>
<Input id="desired_replicas" v-model="form.desired_replicas" type="number" min="0" max="25" />
<Input
id="desired_replicas"
v-model="form.desired_replicas"
type="number"
min="0"
max="25"
/>
<InputError :message="form.errors.desired_replicas" />
</div>
<div class="grid gap-2">
<Label for="default_cpu_limit">CPU</Label>
<Input id="default_cpu_limit" v-model="form.default_cpu_limit" type="number" min="0.125" max="64" step="0.125" />
<Input
id="default_cpu_limit"
v-model="form.default_cpu_limit"
type="number"
min="0.125"
max="64"
step="0.125"
/>
<InputError :message="form.errors.default_cpu_limit" />
</div>
<div class="grid gap-2">
<Label for="default_memory_limit_mb">Memory MB</Label>
<Input id="default_memory_limit_mb" v-model="form.default_memory_limit_mb" type="number" min="64" max="1048576" />
<Input
id="default_memory_limit_mb"
v-model="form.default_memory_limit_mb"
type="number"
min="64"
max="1048576"
/>
<InputError :message="form.errors.default_memory_limit_mb" />
</div>
</div>

View File

@@ -1,10 +1,10 @@
<script setup>
import { Badge } from '@/components/ui/badge';
import { Button } from '@/components/ui/button';
import { Card, CardContent, CardDescription, CardHeader, CardTitle } from '@/components/ui/card';
import AppLayout from '@/layouts/AppLayout.vue';
import { Head, Link } from '@inertiajs/vue3';
import { PencilIcon } from 'lucide-vue-next';
import { Badge } from "@/components/ui/badge";
import { Button } from "@/components/ui/button";
import { Card, CardContent, CardDescription, CardHeader, CardTitle } from "@/components/ui/card";
import AppLayout from "@/layouts/AppLayout.vue";
import { Head, Link } from "@inertiajs/vue3";
import { PencilIcon } from "lucide-vue-next";
const props = defineProps({
server: { type: Object, required: true },
@@ -17,8 +17,17 @@ const props = defineProps({
<AppLayout
:breadcrumbs="[
{ title: 'Servers', href: route('servers.index', { organisation: $page.props.organisation.id }) },
{ title: server.name, href: route('servers.show', { organisation: $page.props.organisation.id, server: server.id }) },
{
title: 'Servers',
href: route('servers.index', { organisation: $page.props.organisation.id }),
},
{
title: server.name,
href: route('servers.show', {
organisation: $page.props.organisation.id,
server: server.id,
}),
},
{ title: service.name },
]"
>
@@ -29,12 +38,20 @@ const props = defineProps({
<h2 class="text-3xl font-bold tracking-tight">{{ service.name }}</h2>
<Badge variant="outline">{{ service.type }}</Badge>
</div>
<p class="mt-1 text-sm text-muted-foreground">{{ service.category }} · {{ service.version }}</p>
<p class="mt-1 text-sm text-muted-foreground">
{{ service.category }} · {{ service.version }}
</p>
</div>
<Button
:as="Link"
variant="secondary"
:href="route('services.edit', { organisation: $page.props.organisation.id, server: server.id, service: service.id })"
:href="
route('services.edit', {
organisation: $page.props.organisation.id,
server: server.id,
service: service.id,
})
"
>
<PencilIcon class="size-4" />
Edit
@@ -48,9 +65,15 @@ const props = defineProps({
<CardDescription>Desired: {{ service.desired_replicas }}</CardDescription>
</CardHeader>
<CardContent class="grid gap-2">
<div v-for="replica in service.replicas" :key="replica.id" class="rounded-md border p-3 text-sm">
<div
v-for="replica in service.replicas"
:key="replica.id"
class="rounded-md border p-3 text-sm"
>
<div class="font-medium">{{ replica.container_name }}</div>
<div class="text-muted-foreground">{{ replica.status }} · {{ replica.health_status }}</div>
<div class="text-muted-foreground">
{{ replica.status }} · {{ replica.health_status }}
</div>
</div>
</CardContent>
</Card>
@@ -60,7 +83,11 @@ const props = defineProps({
<CardTitle>Slices</CardTitle>
</CardHeader>
<CardContent class="grid gap-2">
<div v-for="slice in service.slices" :key="slice.id" class="rounded-md border p-3 text-sm">
<div
v-for="slice in service.slices"
:key="slice.id"
class="rounded-md border p-3 text-sm"
>
<div class="font-medium">{{ slice.name }}</div>
<div class="text-muted-foreground">{{ slice.type }}</div>
</div>
@@ -72,9 +99,18 @@ const props = defineProps({
<CardTitle>Operations</CardTitle>
</CardHeader>
<CardContent class="grid gap-2">
<div v-for="operation in service.operations" :key="operation.id" class="flex items-center justify-between rounded-md border p-3 text-sm">
<span>{{ operation.kind.replace('_', ' ') }}</span>
<Badge :variant="operation.status === 'completed' ? 'success' : 'secondary'">{{ operation.status.replace('_', ' ') }}</Badge>
<div
v-for="operation in service.operations"
:key="operation.id"
class="flex items-center justify-between rounded-md border p-3 text-sm"
>
<span>{{ operation.kind.replace("_", " ") }}</span>
<Badge
:variant="
operation.status === 'completed' ? 'success' : 'secondary'
"
>{{ operation.status.replace("_", " ") }}</Badge
>
</div>
</CardContent>
</Card>

View File

@@ -1,12 +1,12 @@
<script setup>
import InputError from '@/components/InputError.vue';
import { Button } from '@/components/ui/button';
import { Card, CardContent, CardHeader, CardTitle } from '@/components/ui/card';
import { Input } from '@/components/ui/input';
import { Label } from '@/components/ui/label';
import AppLayout from '@/layouts/AppLayout.vue';
import { Head, useForm } from '@inertiajs/vue3';
import { AlertTriangleIcon } from 'lucide-vue-next';
import InputError from "@/components/InputError.vue";
import { Button } from "@/components/ui/button";
import { Card, CardContent, CardHeader, CardTitle } from "@/components/ui/card";
import { Input } from "@/components/ui/input";
import { Label } from "@/components/ui/label";
import AppLayout from "@/layouts/AppLayout.vue";
import { Head, useForm } from "@inertiajs/vue3";
import { AlertTriangleIcon } from "lucide-vue-next";
const props = defineProps({
server: {
@@ -24,7 +24,7 @@ const props = defineProps({
});
const form = useForm({
image_digest: props.service.available_image_digest ?? props.service.current_image_digest ?? '',
image_digest: props.service.available_image_digest ?? props.service.current_image_digest ?? "",
backup_requested: false,
});
</script>
@@ -64,18 +64,29 @@ const form = useForm({
</div>
</CardHeader>
<CardContent class="space-y-4">
<div class="rounded-md border border-amber-200 bg-amber-50 p-3 text-sm text-amber-950 dark:border-amber-900 dark:bg-amber-950 dark:text-amber-100">
This update stops the running container, keeps the named Docker volume in place, starts the new image, and then runs a health check.
<div
class="rounded-md border border-amber-200 bg-amber-50 p-3 text-sm text-amber-950 dark:border-amber-900 dark:bg-amber-950 dark:text-amber-100"
>
This update stops the running container, keeps the named Docker volume in
place, starts the new image, and then runs a health check.
</div>
<div class="grid gap-2">
<Label for="image_digest">Image digest</Label>
<Input id="image_digest" v-model="form.image_digest" placeholder="sha256:..." />
<Input
id="image_digest"
v-model="form.image_digest"
placeholder="sha256:..."
/>
<InputError :message="form.errors.image_digest" />
</div>
<label v-if="backupAvailable" class="flex items-center gap-2 text-sm">
<input v-model="form.backup_requested" type="checkbox" class="size-4 rounded border-input" />
<input
v-model="form.backup_requested"
type="checkbox"
class="size-4 rounded border-input"
/>
Run configured backup first
</label>