chore(ops): harden deployment and runtime setup
This commit is contained in:
parent
1d7e7c41c9
commit
c35bd5877e
30 changed files with 534 additions and 61 deletions
|
|
@ -1,5 +1,6 @@
|
|||
import type { Metadata } from "next";
|
||||
import AdminLoginForm from "@/components/admin/AdminLoginForm";
|
||||
import { adminConfigurationStatus } from "@/lib/runtime/config";
|
||||
|
||||
export const metadata: Metadata = {
|
||||
title: "Admin Login | Funktechnik Schubert",
|
||||
|
|
@ -9,5 +10,5 @@ export const metadata: Metadata = {
|
|||
export default async function AdminLoginPage({ searchParams }: { searchParams: Promise<{ next?: string }> }) {
|
||||
const params = await searchParams;
|
||||
const nextPath = params.next?.startsWith("/admin") ? params.next : "/admin";
|
||||
return <AdminLoginForm nextPath={nextPath} />;
|
||||
return <AdminLoginForm nextPath={nextPath} adminConfigured={adminConfigurationStatus() === "configured"} />;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,9 +1,17 @@
|
|||
import { redirect } from "next/navigation";
|
||||
import AdminShell from "@/components/admin/AdminShell";
|
||||
import { requireAdminSession } from "@/lib/admin/auth";
|
||||
import { adminConfigurationStatus, appVersion, checkStorage, dataDirectory, isDockerEnvironment, olympusStatus, smtpStatus, uploadDirectory } from "@/lib/runtime/config";
|
||||
|
||||
export default async function AdminSystemPage() {
|
||||
if (!await requireAdminSession()) redirect("/admin/login");
|
||||
let storage = "ok";
|
||||
|
||||
try {
|
||||
await checkStorage();
|
||||
} catch {
|
||||
storage = "error";
|
||||
}
|
||||
|
||||
return (
|
||||
<AdminShell>
|
||||
|
|
@ -11,26 +19,28 @@ export default async function AdminSystemPage() {
|
|||
<p className="eyebrow">Betrieb</p>
|
||||
<h1>System</h1>
|
||||
</div>
|
||||
<div className="admin-detail-grid">
|
||||
<section className="admin-card">
|
||||
<h2>Technik</h2>
|
||||
<ul className="list">
|
||||
<li>Next.js 16 App Router</li>
|
||||
<li>TypeScript strict</li>
|
||||
<li>HttpOnly Admin-Session</li>
|
||||
<li>Lokale Foundation-Datenablage in JSON-Dateien</li>
|
||||
</ul>
|
||||
</section>
|
||||
<section className="admin-card">
|
||||
<h2>Vorbereitet</h2>
|
||||
<ul className="list">
|
||||
<li>Olympus-Integration bleibt deaktiviert</li>
|
||||
<li>SMTP-Konfiguration ohne Versandlogik</li>
|
||||
<li>Medien-Upload mit Dateityp- und Größenprüfung</li>
|
||||
<li>SEO- und Inhaltsverwaltung als Admin-Grundlage</li>
|
||||
</ul>
|
||||
</section>
|
||||
</div>
|
||||
<section className="admin-card">
|
||||
<h2>Runtime Informationen</h2>
|
||||
<dl className="system-list">
|
||||
<div><dt>Version</dt><dd>{appVersion}</dd></div>
|
||||
<div><dt>Node Version</dt><dd>{process.version}</dd></div>
|
||||
<div><dt>Docker Environment</dt><dd>{isDockerEnvironment() ? "ja" : "nein"}</dd></div>
|
||||
<div><dt>Storage Status</dt><dd>{storage}</dd></div>
|
||||
<div><dt>Data Directory</dt><dd>{dataDirectory}</dd></div>
|
||||
<div><dt>Upload Directory</dt><dd>{uploadDirectory}</dd></div>
|
||||
<div><dt>Admin Konfiguration</dt><dd>{adminConfigurationStatus()}</dd></div>
|
||||
<div><dt>Olympus Verbindung</dt><dd>{olympusStatus()}</dd></div>
|
||||
<div><dt>SMTP</dt><dd>{smtpStatus()}</dd></div>
|
||||
</dl>
|
||||
</section>
|
||||
<section className="admin-card">
|
||||
<h2>Betriebsregeln</h2>
|
||||
<ul className="list">
|
||||
<li>Runtime-Daten liegen unter <code>data/</code> und werden nicht versioniert.</li>
|
||||
<li>Uploads liegen unter <code>public/uploads/images/</code> und werden nicht versioniert.</li>
|
||||
<li>Olympus- und SMTP-Integration sind vorbereitet, aber nicht aktiv implementiert.</li>
|
||||
</ul>
|
||||
</section>
|
||||
</AdminShell>
|
||||
);
|
||||
}
|
||||
|
|
|
|||
20
app/api/health/route.ts
Normal file
20
app/api/health/route.ts
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
import { NextResponse } from "next/server";
|
||||
import { adminConfigurationStatus, appVersion, checkStorage } from "@/lib/runtime/config";
|
||||
|
||||
export async function GET() {
|
||||
let storage = "ok";
|
||||
|
||||
try {
|
||||
await checkStorage();
|
||||
} catch {
|
||||
storage = "error";
|
||||
}
|
||||
|
||||
return NextResponse.json({
|
||||
status: storage === "ok" ? "ok" : "error",
|
||||
version: appVersion,
|
||||
storage,
|
||||
admin: adminConfigurationStatus(),
|
||||
timestamp: new Date().toISOString(),
|
||||
});
|
||||
}
|
||||
19
app/error.tsx
Normal file
19
app/error.tsx
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
"use client";
|
||||
|
||||
import Link from "next/link";
|
||||
|
||||
export default function ErrorPage({ reset }: { error: Error & { digest?: string }; reset: () => void }) {
|
||||
return (
|
||||
<section className="error-page">
|
||||
<div className="error-card">
|
||||
<p className="eyebrow">500</p>
|
||||
<h1>Die Seite konnte nicht geladen werden</h1>
|
||||
<p className="lead">Es ist ein technischer Fehler aufgetreten. Bitte versuchen Sie es erneut.</p>
|
||||
<div className="actions">
|
||||
<button className="button" type="button" onClick={reset}>Erneut versuchen</button>
|
||||
<Link className="button light" href="/">Zur Startseite</Link>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
);
|
||||
}
|
||||
18
app/global-error.tsx
Normal file
18
app/global-error.tsx
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
"use client";
|
||||
|
||||
export default function GlobalErrorPage({ reset }: { error: Error & { digest?: string }; reset: () => void }) {
|
||||
return (
|
||||
<html lang="de">
|
||||
<body>
|
||||
<section className="error-page">
|
||||
<div className="error-card">
|
||||
<p className="eyebrow">Runtime</p>
|
||||
<h1>Ein unerwarteter Fehler ist aufgetreten</h1>
|
||||
<p className="lead">Die Anwendung konnte diesen Bereich nicht laden. Bitte versuchen Sie es erneut.</p>
|
||||
<button className="button" type="button" onClick={reset}>Erneut versuchen</button>
|
||||
</div>
|
||||
</section>
|
||||
</body>
|
||||
</html>
|
||||
);
|
||||
}
|
||||
|
|
@ -461,6 +461,33 @@ h3 {
|
|||
font-size: 26px;
|
||||
}
|
||||
|
||||
.error-page {
|
||||
min-height: 70vh;
|
||||
display: grid;
|
||||
place-items: center;
|
||||
padding: 48px 16px;
|
||||
background:
|
||||
linear-gradient(90deg, rgba(6, 24, 52, 0.94), rgba(8, 42, 96, 0.76)),
|
||||
url("/workbench-signal.svg"),
|
||||
#07172d;
|
||||
background-size: cover;
|
||||
}
|
||||
|
||||
.error-card {
|
||||
width: min(720px, 100%);
|
||||
border: 1px solid rgba(255, 255, 255, 0.14);
|
||||
border-radius: 8px;
|
||||
background: rgba(255, 255, 255, 0.96);
|
||||
padding: 34px;
|
||||
box-shadow: var(--shadow);
|
||||
}
|
||||
|
||||
.error-card h1 {
|
||||
color: var(--ink);
|
||||
font-size: clamp(34px, 5vw, 56px);
|
||||
line-height: 1;
|
||||
}
|
||||
|
||||
.admin-login-page {
|
||||
min-height: 100vh;
|
||||
display: grid;
|
||||
|
|
@ -578,6 +605,13 @@ h3 {
|
|||
cursor: pointer;
|
||||
}
|
||||
|
||||
.admin-version {
|
||||
margin: 18px 12px 0;
|
||||
color: rgba(255, 255, 255, 0.56);
|
||||
font-size: 13px;
|
||||
font-weight: 800;
|
||||
}
|
||||
|
||||
.admin-main {
|
||||
min-width: 0;
|
||||
padding: 28px;
|
||||
|
|
@ -738,6 +772,30 @@ h3 {
|
|||
object-fit: cover;
|
||||
}
|
||||
|
||||
.system-list {
|
||||
display: grid;
|
||||
gap: 0;
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
.system-list div {
|
||||
display: grid;
|
||||
grid-template-columns: 220px minmax(0, 1fr);
|
||||
gap: 18px;
|
||||
border-bottom: 1px solid var(--line);
|
||||
padding: 12px 0;
|
||||
}
|
||||
|
||||
.system-list dt {
|
||||
color: var(--muted);
|
||||
font-weight: 800;
|
||||
}
|
||||
|
||||
.system-list dd {
|
||||
margin: 0;
|
||||
overflow-wrap: anywhere;
|
||||
}
|
||||
|
||||
@media (max-width: 1080px) and (min-width: 861px) {
|
||||
.brand-logo {
|
||||
width: 236px;
|
||||
|
|
@ -837,4 +895,9 @@ h3 {
|
|||
.admin-upload {
|
||||
display: grid;
|
||||
}
|
||||
|
||||
.system-list div {
|
||||
grid-template-columns: 1fr;
|
||||
gap: 4px;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
17
app/not-found.tsx
Normal file
17
app/not-found.tsx
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
import Link from "next/link";
|
||||
|
||||
export default function NotFoundPage() {
|
||||
return (
|
||||
<section className="error-page">
|
||||
<div className="error-card">
|
||||
<p className="eyebrow">404</p>
|
||||
<h1>Seite nicht gefunden</h1>
|
||||
<p className="lead">Die angeforderte Seite existiert nicht oder wurde verschoben.</p>
|
||||
<div className="actions">
|
||||
<Link className="button" href="/">Zur Startseite</Link>
|
||||
<Link className="button light" href="/kontakt">Kontakt aufnehmen</Link>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
);
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue