Implement Keystone environment deployments
This commit is contained in:
68
resources/js/pages/services/Edit.vue
Normal file
68
resources/js/pages/services/Edit.vue
Normal file
@@ -0,0 +1,68 @@
|
||||
<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';
|
||||
|
||||
const props = defineProps({
|
||||
server: { type: Object, required: true },
|
||||
service: { type: Object, required: true },
|
||||
});
|
||||
|
||||
const form = useForm({
|
||||
name: props.service.name,
|
||||
desired_replicas: props.service.desired_replicas,
|
||||
default_cpu_limit: props.service.default_cpu_limit,
|
||||
default_memory_limit_mb: props.service.default_memory_limit_mb,
|
||||
});
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<Head :title="`Edit ${service.name}`" />
|
||||
|
||||
<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: '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 }))"
|
||||
>
|
||||
<h2 class="text-3xl font-bold tracking-tight">Edit {{ service.name }}</h2>
|
||||
|
||||
<div class="grid gap-2">
|
||||
<Label for="name">Name</Label>
|
||||
<Input id="name" v-model="form.name" type="text" required />
|
||||
<InputError :message="form.errors.name" />
|
||||
</div>
|
||||
|
||||
<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" />
|
||||
<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" />
|
||||
<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" />
|
||||
<InputError :message="form.errors.default_memory_limit_mb" />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="flex justify-end">
|
||||
<Button type="submit" :disabled="form.processing">Save</Button>
|
||||
</div>
|
||||
</form>
|
||||
</AppLayout>
|
||||
</template>
|
||||
84
resources/js/pages/services/Show.vue
Normal file
84
resources/js/pages/services/Show.vue
Normal file
@@ -0,0 +1,84 @@
|
||||
<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';
|
||||
|
||||
const props = defineProps({
|
||||
server: { type: Object, required: true },
|
||||
service: { type: Object, required: true },
|
||||
});
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<Head :title="service.name" />
|
||||
|
||||
<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 },
|
||||
]"
|
||||
>
|
||||
<div class="flex h-full flex-1 flex-col gap-4 p-4">
|
||||
<div class="flex flex-wrap items-center justify-between gap-3">
|
||||
<div>
|
||||
<div class="flex items-center gap-2">
|
||||
<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>
|
||||
</div>
|
||||
<Button
|
||||
:as="Link"
|
||||
variant="secondary"
|
||||
:href="route('services.edit', { organisation: $page.props.organisation.id, server: server.id, service: service.id })"
|
||||
>
|
||||
<PencilIcon class="size-4" />
|
||||
Edit
|
||||
</Button>
|
||||
</div>
|
||||
|
||||
<div class="grid gap-4 lg:grid-cols-3">
|
||||
<Card>
|
||||
<CardHeader>
|
||||
<CardTitle>Replicas</CardTitle>
|
||||
<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 class="font-medium">{{ replica.container_name }}</div>
|
||||
<div class="text-muted-foreground">{{ replica.status }} · {{ replica.health_status }}</div>
|
||||
</div>
|
||||
</CardContent>
|
||||
</Card>
|
||||
|
||||
<Card>
|
||||
<CardHeader>
|
||||
<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 class="font-medium">{{ slice.name }}</div>
|
||||
<div class="text-muted-foreground">{{ slice.type }}</div>
|
||||
</div>
|
||||
</CardContent>
|
||||
</Card>
|
||||
|
||||
<Card>
|
||||
<CardHeader>
|
||||
<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>
|
||||
</CardContent>
|
||||
</Card>
|
||||
</div>
|
||||
</div>
|
||||
</AppLayout>
|
||||
</template>
|
||||
102
resources/js/pages/services/updates/Create.vue
Normal file
102
resources/js/pages/services/updates/Create.vue
Normal file
@@ -0,0 +1,102 @@
|
||||
<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';
|
||||
|
||||
const props = defineProps({
|
||||
server: {
|
||||
type: Object,
|
||||
required: true,
|
||||
},
|
||||
service: {
|
||||
type: Object,
|
||||
required: true,
|
||||
},
|
||||
backupAvailable: {
|
||||
type: Boolean,
|
||||
required: true,
|
||||
},
|
||||
});
|
||||
|
||||
const form = useForm({
|
||||
image_digest: props.service.available_image_digest ?? props.service.current_image_digest ?? '',
|
||||
backup_requested: false,
|
||||
});
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<Head :title="`Update ${service.name}`" />
|
||||
|
||||
<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,
|
||||
},
|
||||
{
|
||||
title: 'Update',
|
||||
},
|
||||
]"
|
||||
>
|
||||
<div class="flex h-full flex-1 flex-col gap-4 p-4">
|
||||
<Card>
|
||||
<CardHeader>
|
||||
<div class="flex items-center gap-3">
|
||||
<AlertTriangleIcon class="size-5 text-amber-600" />
|
||||
<CardTitle>Stateful service update</CardTitle>
|
||||
</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>
|
||||
|
||||
<div class="grid gap-2">
|
||||
<Label for="image_digest">Image digest</Label>
|
||||
<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" />
|
||||
Run configured backup first
|
||||
</label>
|
||||
|
||||
<div class="flex justify-end">
|
||||
<Button
|
||||
:disabled="form.processing"
|
||||
@click="
|
||||
form.post(
|
||||
route('service-updates.store', {
|
||||
organisation: $page.props.organisation.id,
|
||||
server: server.id,
|
||||
service: service.id,
|
||||
}),
|
||||
)
|
||||
"
|
||||
>
|
||||
Create update operation
|
||||
</Button>
|
||||
</div>
|
||||
</CardContent>
|
||||
</Card>
|
||||
</div>
|
||||
</AppLayout>
|
||||
</template>
|
||||
Reference in New Issue
Block a user