Merge pull request #3 from madhura68/fix/agent-bind-and-index-routes

Fix ops-agent install + add index pages voor /flows en /settings
This commit is contained in:
Janpeter Visser 2026-05-13 19:43:29 +00:00 committed by GitHub
commit f7821c05be
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 92 additions and 2 deletions

46
app/flows/page.tsx Normal file
View file

@ -0,0 +1,46 @@
import Link from 'next/link'
import { redirect } from 'next/navigation'
import { getCurrentUser } from '@/lib/session'
export const dynamic = 'force-dynamic'
const FLOWS = [
{
href: '/flows/update-scrum4me-web',
title: 'Update Scrum4Me website',
desc: 'Pull main, build, restart container, run smoke tests',
},
{
href: '/flows/update-caddy-config',
title: 'Update Caddy config',
desc: 'Reload Caddy met nieuwe Caddyfile + cert renewal check',
},
]
export default async function FlowsIndex() {
const user = await getCurrentUser()
if (!user) redirect('/login')
return (
<div className="min-h-screen bg-background p-6">
<div className="mx-auto max-w-6xl space-y-6">
<div>
<h1 className="text-2xl font-semibold tracking-tight">Flows</h1>
<p className="text-sm text-muted-foreground">Multi-step deployments met dry-run en audit-log</p>
</div>
<div className="grid grid-cols-1 gap-4 sm:grid-cols-2">
{FLOWS.map((f) => (
<Link
key={f.href}
href={f.href}
className="block rounded-lg border bg-card p-5 transition-colors hover:bg-accent"
>
<h2 className="text-lg font-medium">{f.title}</h2>
<p className="mt-1 text-sm text-muted-foreground">{f.desc}</p>
</Link>
))}
</div>
</div>
</div>
)
}

41
app/settings/page.tsx Normal file
View file

@ -0,0 +1,41 @@
import Link from 'next/link'
import { redirect } from 'next/navigation'
import { getCurrentUser } from '@/lib/session'
export const dynamic = 'force-dynamic'
const SETTINGS = [
{
href: '/settings/backups',
title: 'Backups',
desc: 'Postgres dumps en restore-runbook',
},
]
export default async function SettingsIndex() {
const user = await getCurrentUser()
if (!user) redirect('/login')
return (
<div className="min-h-screen bg-background p-6">
<div className="mx-auto max-w-6xl space-y-6">
<div>
<h1 className="text-2xl font-semibold tracking-tight">Settings</h1>
<p className="text-sm text-muted-foreground">Configuratie en onderhoud</p>
</div>
<div className="grid grid-cols-1 gap-4 sm:grid-cols-2">
{SETTINGS.map((s) => (
<Link
key={s.href}
href={s.href}
className="block rounded-lg border bg-card p-5 transition-colors hover:bg-accent"
>
<h2 className="text-lg font-medium">{s.title}</h2>
<p className="mt-1 text-sm text-muted-foreground">{s.desc}</p>
</Link>
))}
</div>
</div>
</div>
)
}

View file

@ -20,13 +20,16 @@ rsync -a --delete \
--exclude=.git \ --exclude=.git \
"${REPO_DIR}/ops-agent/" "${INSTALL_DIR}/" "${REPO_DIR}/ops-agent/" "${INSTALL_DIR}/"
echo "==> Installing Node dependencies" echo "==> Installing Node dependencies (incl. dev for tsc)"
cd "${INSTALL_DIR}" cd "${INSTALL_DIR}"
npm ci --omit=dev 2>/dev/null || npm install --omit=dev npm ci 2>/dev/null || npm install
echo "==> Building TypeScript" echo "==> Building TypeScript"
npx tsc npx tsc
echo "==> Pruning dev dependencies"
npm prune --omit=dev
chown -R ops-agent:ops-agent "${INSTALL_DIR}" chown -R ops-agent:ops-agent "${INSTALL_DIR}"
echo "==> Installing config dir" echo "==> Installing config dir"