Compare commits

..
5 Commits
Author SHA1 Message Date
ffaerber c7ea9f26e8 Drop the /bee page (#2)
Docker / build (push) Successful in 20s
2026-09-17 14:51:30 +02:00
Felix FaerberandClaude Opus 5 79e79097ae drop the /bee page
Docker / build (pull_request) Successful in 17s
It showed node health, addresses, topology, wallet, stamps and chain state --
the same ground bee-manager covers at stamps.ffaerber.duckdns.org, and covers
better: bucket maps, top-up and dilute actions, the action ledger, alerting.
Two views of one node drift apart, and the weaker one is the one people find
first, from the gateway's own nav.

Route, component and nav entry go together. The gateway's /bee/stats endpoint
is left alone: nothing else in this app called it, but it is a public API route
and removing it is a decision about the API, not about this page.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01CYFnHida4AdiNDek2pzgXx
2026-09-17 14:27:48 +03:00
Felix FaerberandClaude Opus 5 c0e7b0f8a5 declare the VITE args in the stage that builds
Docker / build (push) Successful in 19s
The build args were only in development-dependencies-env, which runs npm ci.
npm run build happens in build-env, and args do not cross stages -- so Vite has
never seen VITE_API_URL, VITE_GOOGLE_CLIENT_ID or VITE_COMMIT_SHA in any image
this Dockerfile has produced.

It went unnoticed because app/routes/*.tsx fall back to
https://api.t4t-gateway.com, which is correct for the VPS image and silently
wrong everywhere else: the homelab instance deployed today served a UI that
called production, exactly what building it separately was meant to prevent.
Verified from the served bundle -- assets/signup-*.js carried the VPS URL.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01CYFnHida4AdiNDek2pzgXx
2026-09-15 13:03:27 +03:00
Felix FaerberandClaude Opus 5 70786f73ab push with a write:package token, not the Actions token
Docker / build (push) Failing after 17s
Second build failed the same way: docker login to this instance's registry
returns "unauthorized" for the automatic Actions token, and declaring
permissions: packages: write did not change it -- Gitea's task token is accepted
by the API but not by the package registry.

So the push uses REGISTRY_TOKEN, an org secret holding a personal access token
scoped to write:package and nothing else. The step fails with that sentence in
the log rather than another bare "unauthorized", because the difference
between a missing secret and a rejected credential is not visible from the
error docker prints.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01CYFnHida4AdiNDek2pzgXx
2026-09-15 12:38:14 +03:00
Felix FaerberandClaude Opus 5 f2f3e4e3f9 declare packages: write so the registry login works
Docker / build (push) Failing after 17s
The first build pushed nothing: `docker login git.ffaerber.duckdns.org` came
back "unauthorized". Gitea scopes the automatic Actions token from the job's
permissions block, and without one it has no package write -- so the build
succeeded and the push failed on auth, which reads like a credential problem
rather than a missing declaration.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01CYFnHida4AdiNDek2pzgXx
2026-09-15 12:36:51 +03:00
5 changed files with 26 additions and 212 deletions

No files matched your search

+11 -1
View File
@@ -43,7 +43,17 @@ jobs:
if: github.event_name != 'pull_request'
run: |
set -eu
echo "${{ secrets.GITEA_TOKEN }}" | docker login git.ffaerber.duckdns.org -u "${{ github.actor }}" --password-stdin
# Not the automatic Actions token: this Gitea's package registry rejects
# it (docker login returns a bare "unauthorized"), with or without a
# permissions: packages: write block. REGISTRY_TOKEN is an org secret
# holding a personal access token scoped to write:package only.
if [ -z "${{ secrets.REGISTRY_TOKEN }}" ]; then
echo "REGISTRY_TOKEN is not set — create a token with the write:package scope" >&2
echo "and add it as an org secret on token-for-token. The image built fine;" >&2
echo "only the push needs it." >&2
exit 1
fi
echo "${{ secrets.REGISTRY_TOKEN }}" | docker login git.ffaerber.duckdns.org -u "${{ vars.REGISTRY_USER || 'ffaerber' }}" --password-stdin
docker tag "$IMAGE:$SHA" "$IMAGE:latest"
docker push "$IMAGE:$SHA"
docker push "$IMAGE:latest"
+15
View File
@@ -19,6 +19,21 @@ WORKDIR /app
RUN npm ci --omit=dev
FROM public.ecr.aws/docker/library/node:20-alpine AS build-env
# These have to be declared HERE, not only in development-dependencies-env:
# build args do not cross stages, and this is the stage that runs `npm run
# build`. Without them Vite inlines the fallbacks from app/routes/*.tsx --
# https://api.t4t-gateway.com -- so an image built for anywhere else silently
# drives production.
ARG VITE_API_URL
ENV VITE_API_URL=$VITE_API_URL
ARG VITE_GOOGLE_CLIENT_ID
ENV VITE_GOOGLE_CLIENT_ID=$VITE_GOOGLE_CLIENT_ID
ARG VITE_COMMIT_SHA
ENV VITE_COMMIT_SHA=$VITE_COMMIT_SHA
COPY . /app/
COPY --from=development-dependencies-env /app/node_modules /app/node_modules
WORKDIR /app
-1
View File
@@ -3,7 +3,6 @@ import { NavLink } from 'react-router';
const ITEMS = [
{ to: '/chat', label: 'Chat' },
{ to: '/account', label: 'Account' },
{ to: '/bee', label: 'Bee' },
];
export function Nav() {
-1
View File
@@ -7,5 +7,4 @@ export default [
route('login', 'routes/login.tsx'),
route('account', 'routes/account.tsx'),
route('chat', 'routes/chat.tsx'),
route('bee', 'routes/bee.tsx'),
] satisfies RouteConfig;
-209
View File
@@ -1,209 +0,0 @@
import { useEffect, useState } from 'react';
import { Nav } from '~/components/nav';
const API_URL = import.meta.env.VITE_API_URL ?? 'https://api.t4t-gateway.com';
type Health = { status: string; version: string; apiVersion: string };
type Addresses = {
overlay: string;
ethereum: string;
publicKey: string;
pssPublicKey: string;
underlay: string[];
};
type Topology = {
connected: number;
population: number;
depth: number;
reachability: string;
networkAvailability: string;
};
type Wallet = {
bzz: string;
xdai: string;
walletAddress: string;
chainID: number;
};
type Stamp = {
batchID: string;
label: string;
depth: number;
amount: string;
usable: boolean;
usageText: string;
durationDays: number;
};
type ChainState = { block: number; chainTip: number; currentPrice: number };
type Stats = {
health: Health | null;
addresses: Addresses | null;
topology: Topology | null;
wallet: Wallet | null;
stamps: Stamp[] | null;
chain: ChainState | null;
};
export function meta() {
return [{ title: 'Bee · t4t Gateway' }];
}
async function fetchStats(): Promise<Stats> {
const token = localStorage.getItem('jwt');
if (!token) throw new Error('Not authenticated');
const res = await fetch(`${API_URL}/bee/stats`, {
headers: { Authorization: `Bearer ${token}` },
});
if (res.status === 401) {
localStorage.removeItem('jwt');
window.location.href = '/login';
throw new Error('Unauthorized');
}
const body = await res.json();
if (!res.ok) throw new Error(body?.error ?? `Request failed (${res.status})`);
return body as Stats;
}
function Card({ title, children }: { title: string; children: React.ReactNode }) {
return (
<section className='rounded-lg border border-neutral-200 bg-white p-5 shadow-sm'>
<h2 className='text-xs font-semibold uppercase tracking-wide text-neutral-500'>{title}</h2>
<div className='mt-3 text-sm'>{children}</div>
</section>
);
}
function Row({ label, value }: { label: string; value: React.ReactNode }) {
return (
<div className='flex justify-between gap-4 py-1'>
<span className='text-neutral-500'>{label}</span>
<span className='break-all text-right font-mono text-neutral-900'>{value}</span>
</div>
);
}
export default function BeePage() {
const [stats, setStats] = useState<Stats | null>(null);
const [error, setError] = useState<string | null>(null);
const [loading, setLoading] = useState(true);
useEffect(() => {
if (typeof window === 'undefined') return;
if (!localStorage.getItem('jwt')) {
window.location.href = '/login';
return;
}
fetchStats()
.then((s) => setStats(s))
.catch((err) => setError(err instanceof Error ? err.message : 'Unknown error'))
.finally(() => setLoading(false));
}, []);
if (loading) {
return (
<>
<Nav />
<main className='flex min-h-[60vh] items-center justify-center'>
<p className='text-sm text-neutral-600'>Loading Bee stats…</p>
</main>
</>
);
}
return (
<>
<Nav />
<main className='mx-auto max-w-3xl px-6 py-10'>
<h1 className='text-2xl font-semibold'>Bee node</h1>
<p className='mt-1 text-sm text-neutral-600'>Read-only status of the operator's Bee node.</p>
{error && (
<p className='mt-4 rounded-md bg-red-50 px-3 py-2 text-sm text-red-700'>{error}</p>
)}
<div className='mt-6 grid gap-4'>
<Card title='Health'>
{stats?.health ? (
<>
<Row label='Status' value={stats.health.status} />
<Row label='Version' value={stats.health.version} />
<Row label='API version' value={stats.health.apiVersion} />
</>
) : (
<p className='text-neutral-500'>unavailable</p>
)}
</Card>
<Card title='Addresses'>
{stats?.addresses ? (
<>
<Row label='Overlay' value={stats.addresses.overlay} />
<Row label='Ethereum' value={stats.addresses.ethereum} />
<Row label='Underlays' value={stats.addresses.underlay.length} />
</>
) : (
<p className='text-neutral-500'>unavailable</p>
)}
</Card>
<Card title='Topology'>
{stats?.topology ? (
<>
<Row label='Connected peers' value={stats.topology.connected} />
<Row label='Known peers' value={stats.topology.population} />
<Row label='Depth' value={stats.topology.depth} />
<Row label='Reachability' value={stats.topology.reachability} />
<Row label='Network availability' value={stats.topology.networkAvailability} />
</>
) : (
<p className='text-neutral-500'>unavailable</p>
)}
</Card>
<Card title='Wallet'>
{stats?.wallet ? (
<>
<Row label='Address' value={stats.wallet.walletAddress} />
<Row label='xBZZ' value={stats.wallet.bzz} />
<Row label='xDAI' value={stats.wallet.xdai} />
<Row label='Chain ID' value={stats.wallet.chainID} />
</>
) : (
<p className='text-neutral-500'>unavailable</p>
)}
</Card>
<Card title='Chain state'>
{stats?.chain ? (
<>
<Row label='Block' value={stats.chain.block} />
<Row label='Chain tip' value={stats.chain.chainTip} />
<Row label='Current price (PLUR/chunk)' value={stats.chain.currentPrice} />
</>
) : (
<p className='text-neutral-500'>unavailable</p>
)}
</Card>
<Card title='Postage batches'>
{stats?.stamps && stats.stamps.length > 0 ? (
<ul className='divide-y divide-neutral-200'>
{stats.stamps.map((s) => (
<li key={s.batchID} className='py-2'>
<p className='font-mono text-xs text-neutral-900'>{s.batchID}</p>
<p className='mt-1 text-xs text-neutral-500'>
{s.label || '(unlabeled)'} · depth {s.depth} · used {s.usageText} ·{' '}
{s.usable ? 'usable' : 'not usable'} · {s.durationDays.toFixed(1)}d left
</p>
</li>
))}
</ul>
) : (
<p className='text-neutral-500'>no batches</p>
)}
</Card>
</div>
</main>
</>
);
}