This commit is contained in:
@@ -0,0 +1,15 @@
|
||||
node_modules
|
||||
.next
|
||||
out
|
||||
.git
|
||||
.gitea
|
||||
.claude
|
||||
.vscode
|
||||
helm
|
||||
Dockerfile
|
||||
.dockerignore
|
||||
README.md
|
||||
AGENTS.md
|
||||
npm-debug.log*
|
||||
*.tsbuildinfo
|
||||
.env*
|
||||
@@ -0,0 +1,209 @@
|
||||
name: CI/CD (dev on branch, prod on tag)
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- dev # build & deploy for dev only
|
||||
tags:
|
||||
- "*" # build & deploy for prod only when a tag is pushed
|
||||
|
||||
jobs:
|
||||
build-and-deploy:
|
||||
# Gitea Actions: runners are selected by label only (no runner groups).
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
# Per-environment group: a dev push must never cancel an in-flight prod
|
||||
# deploy. NOTE: act_runner does not support dynamic matrix (fromJSON of a
|
||||
# job output expands every matrix.* to ""), so per-env config is computed
|
||||
# in the "Resolve environment config" bash step below instead.
|
||||
concurrency:
|
||||
group: deploy-${{ github.ref_type == 'tag' && 'prod' || 'dev' }}
|
||||
cancel-in-progress: true
|
||||
|
||||
env:
|
||||
# Harbor on the Mac mini host. The runner pod mounts the Docker Desktop
|
||||
# daemon socket, so from the daemon's point of view the registry is
|
||||
# reachable as host.docker.internal:8080 (plain HTTP — the daemon must
|
||||
# list it under "insecure-registries"). Images live in Harbor's
|
||||
# "library" project.
|
||||
REGISTRY: host.docker.internal:8080/library
|
||||
DOCKER_BUILDKIT: "1"
|
||||
COMPOSE_DOCKER_CLI_BUILD: "1"
|
||||
|
||||
steps:
|
||||
- name: Checkout (with tags)
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 0 # IMPORTANT to access tags
|
||||
|
||||
# Replaces the former setup job + dynamic matrix (unsupported on
|
||||
# act_runner). Everything derived from the ref type lands in GITHUB_ENV
|
||||
# so later steps can use plain $VARS.
|
||||
- name: Resolve environment config
|
||||
shell: bash
|
||||
run: |
|
||||
if [[ "${{ github.ref_type }}" == "tag" ]]; then
|
||||
DEPLOY_ENV=prod
|
||||
RELEASE_TAG="${GITHUB_REF#refs/tags/}"
|
||||
else
|
||||
DEPLOY_ENV=dev
|
||||
RELEASE_TAG=""
|
||||
fi
|
||||
{
|
||||
echo "DEPLOY_ENV=${DEPLOY_ENV}"
|
||||
echo "RELEASE_TAG=${RELEASE_TAG}"
|
||||
echo "IMAGE=${REGISTRY}/portal-${DEPLOY_ENV}"
|
||||
echo "LATEST_TAG=latest-${DEPLOY_ENV}"
|
||||
echo "RELEASE=portal-${DEPLOY_ENV}"
|
||||
echo "NAMESPACE=portal-${DEPLOY_ENV}"
|
||||
echo "CHART=./helm"
|
||||
echo "VALUES_FILE=./helm/values-${DEPLOY_ENV}.yaml"
|
||||
} >> "$GITHUB_ENV"
|
||||
|
||||
echo "Resolved environment: ${DEPLOY_ENV} (release tag: '${RELEASE_TAG}')"
|
||||
|
||||
- name: Verify tag is on prod branch (main)
|
||||
if: github.ref_type == 'tag'
|
||||
shell: bash
|
||||
run: |
|
||||
git fetch origin main --quiet
|
||||
if git merge-base --is-ancestor "${{ github.sha }}" origin/main; then
|
||||
echo "Tag commit is on main. Proceeding with prod deploy."
|
||||
else
|
||||
echo "::error::Tag ${GITHUB_REF#refs/tags/} points at a commit not on main. Refusing prod deploy."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# The runner's job image ships docker but not kubectl/helm, so install
|
||||
# them at job start (static binaries, linux/amd64).
|
||||
- name: Install kubectl & helm
|
||||
run: |
|
||||
if ! command -v kubectl >/dev/null 2>&1; then
|
||||
KVER=$(curl -sfL https://dl.k8s.io/release/stable.txt)
|
||||
curl -sfL -o /usr/local/bin/kubectl "https://dl.k8s.io/release/${KVER}/bin/linux/amd64/kubectl"
|
||||
chmod +x /usr/local/bin/kubectl
|
||||
fi
|
||||
if ! command -v helm >/dev/null 2>&1; then
|
||||
curl -sfL https://get.helm.sh/helm-v3.16.4-linux-amd64.tar.gz | tar xz -C /tmp
|
||||
mv /tmp/linux-amd64/helm /usr/local/bin/helm
|
||||
fi
|
||||
kubectl version --client
|
||||
helm version
|
||||
|
||||
# Fail fast on chart/template errors before spending time on a build.
|
||||
- name: Lint Helm chart
|
||||
run: |
|
||||
helm lint "${CHART}" -f "${VALUES_FILE}"
|
||||
|
||||
- name: Set up kubeconfig
|
||||
run: |
|
||||
echo "KUBECONFIG=${RUNNER_TEMP}/kubeconfig" >> "$GITHUB_ENV"
|
||||
echo "${{ secrets.KUBE_CONFIG_DATA }}" | base64 -d > "${RUNNER_TEMP}/kubeconfig"
|
||||
chmod 600 "${RUNNER_TEMP}/kubeconfig"
|
||||
|
||||
- name: Login to Harbor
|
||||
run: |
|
||||
# REGISTRY is host/project but `docker login` takes only the host.
|
||||
REGISTRY_HOST=$(echo "${REGISTRY}" | cut -d'/' -f1)
|
||||
echo "Logging in to ${REGISTRY_HOST}"
|
||||
echo "${{ secrets.HARBOR_PASSWORD }}" | docker login "${REGISTRY_HOST}" \
|
||||
-u "${{ secrets.HARBOR_USERNAME }}" \
|
||||
--password-stdin
|
||||
|
||||
- name: Pre-build diagnostics
|
||||
run: |
|
||||
echo "Ref: ${GITHUB_REF}"
|
||||
echo "Environment: ${DEPLOY_ENV}"
|
||||
echo "Release tag: ${RELEASE_TAG}"
|
||||
echo "Image: ${IMAGE}"
|
||||
docker version
|
||||
helm version
|
||||
kubectl version --client
|
||||
|
||||
- name: Build & Push image
|
||||
run: |
|
||||
BUILD_TAG_ARGS=(
|
||||
-t "${IMAGE}:${LATEST_TAG}"
|
||||
-t "${IMAGE}:${{ github.sha }}"
|
||||
)
|
||||
if [[ -n "${RELEASE_TAG}" ]]; then
|
||||
BUILD_TAG_ARGS+=( -t "${IMAGE}:${RELEASE_TAG}" )
|
||||
fi
|
||||
|
||||
docker build \
|
||||
-f Dockerfile \
|
||||
"${BUILD_TAG_ARGS[@]}" \
|
||||
.
|
||||
|
||||
docker push "${IMAGE}:${LATEST_TAG}"
|
||||
docker push "${IMAGE}:${{ github.sha }}"
|
||||
if [[ -n "${RELEASE_TAG}" ]]; then
|
||||
docker push "${IMAGE}:${RELEASE_TAG}"
|
||||
fi
|
||||
|
||||
- name: Ensure namespace exists
|
||||
run: |
|
||||
# `helm --atomic` against a missing namespace fails outright.
|
||||
kubectl create namespace "${NAMESPACE}" \
|
||||
--dry-run=client -o yaml | kubectl apply -f -
|
||||
|
||||
# The kubelet pulls through the same Docker Desktop daemon that built the
|
||||
# image, so the pull server must match the push host exactly
|
||||
# (host.docker.internal:8080).
|
||||
- name: Ensure Harbor pull secret exists
|
||||
run: |
|
||||
kubectl create secret docker-registry harbor-pull-secret \
|
||||
--docker-server="$(echo "${REGISTRY}" | cut -d'/' -f1)" \
|
||||
--docker-username="${{ secrets.HARBOR_USERNAME }}" \
|
||||
--docker-password="${{ secrets.HARBOR_PASSWORD }}" \
|
||||
--namespace "${NAMESPACE}" \
|
||||
--dry-run=client -o yaml | kubectl apply -f -
|
||||
|
||||
# ---- DEV DEPLOY (branch dev only) ----
|
||||
# Deployed by commit SHA, not latest-dev: an immutable tag sidesteps the
|
||||
# moving-tag + IfNotPresent stale-cache trap and makes `kubectl describe
|
||||
# pod` show exactly which commit is live.
|
||||
- name: Deploy DEV with Helm
|
||||
if: github.ref_type == 'branch' && github.ref == 'refs/heads/dev'
|
||||
run: |
|
||||
kubectl get nodes
|
||||
kubectl get ns
|
||||
|
||||
helm upgrade --install "${RELEASE}" "${CHART}" \
|
||||
-f "${VALUES_FILE}" \
|
||||
--namespace "${NAMESPACE}" \
|
||||
--set server.image.repository="${IMAGE}" \
|
||||
--set server.image.tag="${{ github.sha }}" \
|
||||
--wait --timeout 10m --atomic --debug
|
||||
|
||||
# ---- PROD DEPLOY (tag push only) ----
|
||||
- name: Deploy PROD with Helm
|
||||
if: github.ref_type == 'tag'
|
||||
run: |
|
||||
kubectl get nodes
|
||||
kubectl get ns
|
||||
|
||||
if [[ -z "${RELEASE_TAG}" ]]; then
|
||||
echo "No tag detected; aborting prod deploy."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
helm upgrade --install "${RELEASE}" "${CHART}" \
|
||||
-f "${VALUES_FILE}" \
|
||||
--namespace "${NAMESPACE}" \
|
||||
--set server.image.repository="${IMAGE}" \
|
||||
--set server.image.tag="${RELEASE_TAG}" \
|
||||
--wait --timeout 10m --atomic --debug
|
||||
|
||||
- name: Post-deploy diagnostics (if failure)
|
||||
if: failure()
|
||||
run: |
|
||||
echo "----- Diagnostics -----"
|
||||
kubectl get deploy,po,svc,ing -n "${NAMESPACE}" -o wide || true
|
||||
echo "----- Events -----"
|
||||
kubectl get events -n "${NAMESPACE}" --sort-by=.lastTimestamp || true
|
||||
for p in $(kubectl get po -n "${NAMESPACE}" -o name); do
|
||||
echo "### $p"
|
||||
kubectl describe "$p" -n "${NAMESPACE}" || true
|
||||
kubectl logs "$p" -n "${NAMESPACE}" --all-containers --tail=200 || true
|
||||
done
|
||||
+44
@@ -0,0 +1,44 @@
|
||||
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
|
||||
|
||||
# dependencies
|
||||
/node_modules
|
||||
/.pnp
|
||||
.pnp.*
|
||||
.yarn/*
|
||||
!.yarn/patches
|
||||
!.yarn/plugins
|
||||
!.yarn/releases
|
||||
!.yarn/versions
|
||||
|
||||
# testing
|
||||
/coverage
|
||||
|
||||
# next.js
|
||||
/.next/
|
||||
/out/
|
||||
|
||||
# production
|
||||
/build
|
||||
|
||||
# misc
|
||||
.DS_Store
|
||||
*.pem
|
||||
|
||||
# debug
|
||||
npm-debug.log*
|
||||
yarn-debug.log*
|
||||
yarn-error.log*
|
||||
.pnpm-debug.log*
|
||||
|
||||
# env files (can opt-in for committing if needed)
|
||||
.env*
|
||||
|
||||
# vercel
|
||||
.vercel
|
||||
|
||||
# typescript
|
||||
*.tsbuildinfo
|
||||
next-env.d.ts
|
||||
|
||||
# local tooling
|
||||
/.claude/
|
||||
@@ -0,0 +1,9 @@
|
||||
<!-- BEGIN:nextjs-agent-rules -->
|
||||
|
||||
## This is NOT the Next.js you know
|
||||
|
||||
This version has breaking changes — APIs, conventions, and file structure may all differ from your training data. Read the relevant guide in `node_modules/next/dist/docs/` (resolved from this file's directory; in monorepos the `next` package may not be visible from the repo root) before writing any code. Heed deprecation notices.
|
||||
|
||||
This block is written and re-added by `next dev` — verify at `node_modules/next/dist/server/lib/generate-agent-files.js`. Removing it from a diff only re-creates the uncommitted change; committing it with your work keeps the tree clean.
|
||||
|
||||
<!-- END:nextjs-agent-rules -->
|
||||
+34
@@ -0,0 +1,34 @@
|
||||
# syntax=docker/dockerfile:1
|
||||
|
||||
# ---- deps: install node_modules from the lockfile ----
|
||||
FROM node:24-alpine AS deps
|
||||
WORKDIR /app
|
||||
COPY package.json package-lock.json ./
|
||||
RUN npm ci
|
||||
|
||||
# ---- builder: produce the standalone Next.js output ----
|
||||
FROM node:24-alpine AS builder
|
||||
WORKDIR /app
|
||||
ENV NEXT_TELEMETRY_DISABLED=1
|
||||
COPY --from=deps /app/node_modules ./node_modules
|
||||
COPY . .
|
||||
# public/ may be empty (git does not track empty dirs); the runner stage copies it.
|
||||
RUN mkdir -p public && npm run build
|
||||
|
||||
# ---- runner: minimal image with only what `node server.js` needs ----
|
||||
FROM node:24-alpine AS runner
|
||||
WORKDIR /app
|
||||
ENV NODE_ENV=production \
|
||||
NEXT_TELEMETRY_DISABLED=1 \
|
||||
PORT=3000 \
|
||||
HOSTNAME=0.0.0.0
|
||||
|
||||
RUN addgroup -S -g 1001 nodejs && adduser -S -u 1001 -G nodejs nextjs
|
||||
|
||||
COPY --from=builder --chown=nextjs:nodejs /app/.next/standalone ./
|
||||
COPY --from=builder --chown=nextjs:nodejs /app/.next/static ./.next/static
|
||||
COPY --from=builder --chown=nextjs:nodejs /app/public ./public
|
||||
|
||||
USER 1001
|
||||
EXPOSE 3000
|
||||
CMD ["node", "server.js"]
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 15 KiB |
+107
@@ -0,0 +1,107 @@
|
||||
@import "tailwindcss";
|
||||
|
||||
:root {
|
||||
--background: #060a14;
|
||||
--foreground: #e6edf7;
|
||||
color-scheme: dark;
|
||||
}
|
||||
|
||||
@theme inline {
|
||||
--color-background: var(--background);
|
||||
--color-foreground: var(--foreground);
|
||||
--font-sans: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto,
|
||||
"Helvetica Neue", Arial, sans-serif;
|
||||
--font-mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas,
|
||||
"Liberation Mono", monospace;
|
||||
}
|
||||
|
||||
html {
|
||||
scroll-behavior: smooth;
|
||||
}
|
||||
|
||||
body {
|
||||
background-color: var(--background);
|
||||
color: var(--foreground);
|
||||
font-family: var(--font-sans);
|
||||
background-image:
|
||||
radial-gradient(60rem 30rem at 15% -10%, rgb(56 189 248 / 0.14), transparent 60%),
|
||||
radial-gradient(50rem 30rem at 95% 5%, rgb(129 140 248 / 0.12), transparent 60%),
|
||||
linear-gradient(rgb(255 255 255 / 0.025) 1px, transparent 1px),
|
||||
linear-gradient(90deg, rgb(255 255 255 / 0.025) 1px, transparent 1px);
|
||||
background-size: auto, auto, 48px 48px, 48px 48px;
|
||||
background-repeat: no-repeat, no-repeat, repeat, repeat;
|
||||
}
|
||||
|
||||
/*
|
||||
* Animated "traffic" connector used by the flow diagrams.
|
||||
* Vertical by default (mobile); turns horizontal from the lg breakpoint.
|
||||
*/
|
||||
.flow-line {
|
||||
--flow-color: #38bdf8;
|
||||
flex: none;
|
||||
width: 2px;
|
||||
height: 2rem;
|
||||
background-image: linear-gradient(to bottom, var(--flow-color) 0 6px, transparent 6px);
|
||||
background-size: 2px 10px;
|
||||
background-repeat: repeat-y;
|
||||
animation: flow-y 0.9s linear infinite;
|
||||
}
|
||||
|
||||
@media (min-width: 1024px) {
|
||||
.flow-line {
|
||||
width: 2.25rem;
|
||||
height: 2px;
|
||||
background-image: linear-gradient(to right, var(--flow-color) 0 6px, transparent 6px);
|
||||
background-size: 10px 2px;
|
||||
background-repeat: repeat-x;
|
||||
animation-name: flow-x;
|
||||
}
|
||||
}
|
||||
|
||||
/* Always-vertical variant for hand-offs between stacked boundaries. */
|
||||
.flow-line-v {
|
||||
--flow-color: #38bdf8;
|
||||
flex: none;
|
||||
width: 2px;
|
||||
height: 2rem;
|
||||
background-image: linear-gradient(to bottom, var(--flow-color) 0 6px, transparent 6px);
|
||||
background-size: 2px 10px;
|
||||
background-repeat: repeat-y;
|
||||
animation: flow-y 0.9s linear infinite;
|
||||
}
|
||||
|
||||
@keyframes flow-y {
|
||||
to {
|
||||
background-position: 0 10px;
|
||||
}
|
||||
}
|
||||
|
||||
@keyframes flow-x {
|
||||
to {
|
||||
background-position: 10px 0;
|
||||
}
|
||||
}
|
||||
|
||||
@keyframes pulse-ring {
|
||||
0% {
|
||||
box-shadow: 0 0 0 0 rgb(52 211 153 / 0.5);
|
||||
}
|
||||
100% {
|
||||
box-shadow: 0 0 0 10px rgb(52 211 153 / 0);
|
||||
}
|
||||
}
|
||||
|
||||
.pulse-ring {
|
||||
animation: pulse-ring 1.8s ease-out infinite;
|
||||
}
|
||||
|
||||
@media (prefers-reduced-motion: reduce) {
|
||||
html {
|
||||
scroll-behavior: auto;
|
||||
}
|
||||
.flow-line,
|
||||
.flow-line-v,
|
||||
.pulse-ring {
|
||||
animation: none;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
import type { Metadata } from "next";
|
||||
import { profile } from "@/content/site";
|
||||
import "./globals.css";
|
||||
|
||||
export const metadata: Metadata = {
|
||||
title: `${profile.name} · Portal`,
|
||||
description:
|
||||
"Personal portal: an introduction, the architecture and CI/CD workflow of my Kubernetes home lab, and my travel album.",
|
||||
};
|
||||
|
||||
export default function RootLayout({ children }: LayoutProps<"/">) {
|
||||
return (
|
||||
<html lang="en" className="h-full antialiased">
|
||||
<body className="flex min-h-full flex-col">{children}</body>
|
||||
</html>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,66 @@
|
||||
import { Header } from "@/components/Header";
|
||||
import { Introduction } from "@/components/Introduction";
|
||||
import { Section } from "@/components/Section";
|
||||
import { Travel } from "@/components/Travel";
|
||||
import { CicdFlow } from "@/components/lab/CicdFlow";
|
||||
import { RequestFlow } from "@/components/lab/RequestFlow";
|
||||
import { ServiceLinks } from "@/components/lab/ServiceLinks";
|
||||
import { StackBadges } from "@/components/lab/StackBadges";
|
||||
|
||||
function SubHeading({ title, children }: { title: string; children?: React.ReactNode }) {
|
||||
return (
|
||||
<div className="mb-8">
|
||||
<h3 className="text-xl font-semibold text-white">{title}</h3>
|
||||
{children && <p className="mt-1 max-w-3xl text-sm leading-6 text-slate-400">{children}</p>}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
export default function Home() {
|
||||
return (
|
||||
<>
|
||||
<span id="top" />
|
||||
<Header />
|
||||
<main className="flex-1">
|
||||
<Introduction />
|
||||
|
||||
<Section
|
||||
id="lab"
|
||||
eyebrow="The Lab"
|
||||
title="A Kubernetes lab on a Mac mini"
|
||||
lead="Kubernetes comes from Docker Desktop on my Mac mini. A host-level Nginx accepts traffic on port 80 and hands it to the cluster's ingress controller, which routes each hostname to the right service. Everything below is hosted on that one machine, including this site."
|
||||
>
|
||||
<StackBadges />
|
||||
|
||||
<div className="mt-14">
|
||||
<SubHeading title="How a request reaches a pod">
|
||||
DNS is managed at GoDaddy. From there a request passes through the host Nginx and
|
||||
the cluster ingress before landing on a pod.
|
||||
</SubHeading>
|
||||
<RequestFlow />
|
||||
</div>
|
||||
|
||||
<div className="mt-20">
|
||||
<SubHeading title="From git push to running pod">
|
||||
Gitea Actions builds the image on the Docker Desktop daemon, stores it in Harbor and
|
||||
deploys it with Helm. A branch push goes to dev, a tag goes to prod.
|
||||
</SubHeading>
|
||||
<CicdFlow />
|
||||
</div>
|
||||
|
||||
<div className="mt-20">
|
||||
<SubHeading title="Lab services">
|
||||
Live endpoints you can open yourself.
|
||||
</SubHeading>
|
||||
<ServiceLinks />
|
||||
</div>
|
||||
</Section>
|
||||
|
||||
<Travel />
|
||||
</main>
|
||||
<footer className="border-t border-white/10 py-8 text-center text-sm text-slate-500">
|
||||
Built with Next.js and deployed by the pipeline described above.
|
||||
</footer>
|
||||
</>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
import type { SimpleIcon } from "simple-icons";
|
||||
|
||||
export function BrandIcon({
|
||||
icon,
|
||||
className,
|
||||
color,
|
||||
}: {
|
||||
icon: SimpleIcon;
|
||||
className?: string;
|
||||
/** Override the brand colour (dark brand colours vanish on a dark theme). */
|
||||
color?: string;
|
||||
}) {
|
||||
return (
|
||||
<svg
|
||||
viewBox="0 0 24 24"
|
||||
aria-hidden="true"
|
||||
className={className}
|
||||
fill={color ?? `#${icon.hex}`}
|
||||
>
|
||||
<path d={icon.path} />
|
||||
</svg>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
import { KeyRound, User } from "lucide-react";
|
||||
|
||||
export function CredentialRows({ user, password }: { user: string; password: string }) {
|
||||
return (
|
||||
<dl className="grid grid-cols-[auto_1fr] items-center gap-x-3 gap-y-2 text-sm">
|
||||
<dt className="flex items-center gap-1.5 text-slate-400">
|
||||
<User className="size-3.5" aria-hidden="true" />
|
||||
User
|
||||
</dt>
|
||||
<dd className="rounded-md bg-black/30 px-2 py-1 font-mono text-slate-100">{user}</dd>
|
||||
<dt className="flex items-center gap-1.5 text-slate-400">
|
||||
<KeyRound className="size-3.5" aria-hidden="true" />
|
||||
Password
|
||||
</dt>
|
||||
<dd className="rounded-md bg-black/30 px-2 py-1 font-mono text-slate-100">{password}</dd>
|
||||
</dl>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,44 @@
|
||||
import { profile } from "@/content/site";
|
||||
|
||||
const links = [
|
||||
{ href: "#introduction", label: "Introduction" },
|
||||
{ href: "#lab", label: "The Lab" },
|
||||
{ href: "#travel", label: "Travel" },
|
||||
];
|
||||
|
||||
export function Header() {
|
||||
const initials = profile.name
|
||||
.split(" ")
|
||||
.map((w) => w[0])
|
||||
.join("");
|
||||
|
||||
return (
|
||||
<header className="sticky top-0 z-40 border-b border-white/10 bg-slate-950/70 backdrop-blur-md">
|
||||
<div className="mx-auto flex h-14 w-full max-w-6xl items-center justify-between px-6">
|
||||
<a
|
||||
href="#top"
|
||||
className="flex items-center gap-2.5 rounded-md text-sm font-semibold text-white focus-visible:ring-2 focus-visible:ring-sky-300 focus-visible:outline-none"
|
||||
>
|
||||
<span className="flex size-7 items-center justify-center rounded-md bg-linear-to-br from-sky-400 to-indigo-500 text-xs font-bold text-slate-950">
|
||||
{initials}
|
||||
</span>
|
||||
<span className="sr-only sm:not-sr-only">{profile.name}</span>
|
||||
</a>
|
||||
<nav aria-label="Primary">
|
||||
<ul className="flex items-center gap-1 text-sm">
|
||||
{links.map((l) => (
|
||||
<li key={l.href}>
|
||||
<a
|
||||
href={l.href}
|
||||
className="rounded-md px-2.5 py-1.5 whitespace-nowrap text-slate-300 transition-colors sm:px-3 hover:bg-white/10 hover:text-white focus-visible:ring-2 focus-visible:ring-sky-300 focus-visible:outline-none"
|
||||
>
|
||||
{l.label}
|
||||
</a>
|
||||
</li>
|
||||
))}
|
||||
</ul>
|
||||
</nav>
|
||||
</div>
|
||||
</header>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
import { introduction, profile } from "@/content/site";
|
||||
|
||||
export function Introduction() {
|
||||
return (
|
||||
<section id="introduction" className="scroll-mt-16 pt-20 pb-16 sm:pt-28 sm:pb-24">
|
||||
<div className="mx-auto w-full max-w-6xl px-6">
|
||||
<p className="text-sm font-semibold tracking-widest text-sky-400 uppercase">
|
||||
Introduction
|
||||
</p>
|
||||
<h1 className="mt-3 text-4xl font-bold tracking-tight text-white sm:text-6xl">
|
||||
Hi, I'm{" "}
|
||||
<span className="bg-linear-to-r from-sky-300 to-indigo-400 bg-clip-text text-transparent">
|
||||
{profile.name}
|
||||
</span>
|
||||
</h1>
|
||||
<div className="mt-8 max-w-3xl space-y-5 text-lg leading-8 text-slate-300">
|
||||
{introduction.map((p, i) => (
|
||||
<p key={i}>{p}</p>
|
||||
))}
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
import type { ReactNode } from "react";
|
||||
|
||||
export function Section({
|
||||
id,
|
||||
eyebrow,
|
||||
title,
|
||||
lead,
|
||||
children,
|
||||
}: {
|
||||
id: string;
|
||||
eyebrow: string;
|
||||
title: string;
|
||||
lead?: ReactNode;
|
||||
children: ReactNode;
|
||||
}) {
|
||||
return (
|
||||
<section id={id} className="scroll-mt-16 py-16 sm:py-24">
|
||||
<div className="mx-auto w-full max-w-6xl px-6">
|
||||
<p className="text-sm font-semibold tracking-widest text-sky-400 uppercase">
|
||||
{eyebrow}
|
||||
</p>
|
||||
<h2 className="mt-2 text-3xl font-bold tracking-tight text-white sm:text-4xl">
|
||||
{title}
|
||||
</h2>
|
||||
{lead && <div className="mt-4 max-w-3xl text-base leading-7 text-slate-300">{lead}</div>}
|
||||
<div className="mt-10">{children}</div>
|
||||
</div>
|
||||
</section>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,93 @@
|
||||
import { ExternalLink, MapPin, Plane } from "lucide-react";
|
||||
import { CredentialRows } from "@/components/CredentialRows";
|
||||
import { Section } from "@/components/Section";
|
||||
import { travel } from "@/content/site";
|
||||
|
||||
/** Decorative route map: dotted "world" backdrop, a dashed flight path and pins. */
|
||||
function RouteArt() {
|
||||
const pins = [
|
||||
{ x: 70, y: 150 },
|
||||
{ x: 170, y: 70 },
|
||||
{ x: 290, y: 120 },
|
||||
{ x: 400, y: 50 },
|
||||
];
|
||||
return (
|
||||
<svg
|
||||
viewBox="0 0 470 200"
|
||||
role="img"
|
||||
aria-label="Illustration of a travel route connecting four destinations"
|
||||
className="h-full w-full"
|
||||
>
|
||||
<defs>
|
||||
<pattern id="dots" width="14" height="14" patternUnits="userSpaceOnUse">
|
||||
<circle cx="2" cy="2" r="1.2" fill="#38bdf8" fillOpacity="0.28" />
|
||||
</pattern>
|
||||
<linearGradient id="route" x1="0" x2="1">
|
||||
<stop offset="0" stopColor="#38bdf8" />
|
||||
<stop offset="1" stopColor="#818cf8" />
|
||||
</linearGradient>
|
||||
</defs>
|
||||
<rect width="470" height="200" fill="url(#dots)" />
|
||||
<path
|
||||
d="M70 150 C 100 60, 140 40, 170 70 S 250 160, 290 120 S 370 20, 400 50"
|
||||
fill="none"
|
||||
stroke="url(#route)"
|
||||
strokeWidth="2.5"
|
||||
strokeDasharray="6 7"
|
||||
strokeLinecap="round"
|
||||
/>
|
||||
{pins.map((p, i) => (
|
||||
<g key={i} transform={`translate(${p.x} ${p.y})`}>
|
||||
<circle r="11" fill="#38bdf8" fillOpacity="0.18" />
|
||||
<circle r="5" fill={i === pins.length - 1 ? "#818cf8" : "#38bdf8"} />
|
||||
<circle r="5" fill="none" stroke="#fff" strokeOpacity="0.8" strokeWidth="1.5" />
|
||||
</g>
|
||||
))}
|
||||
</svg>
|
||||
);
|
||||
}
|
||||
|
||||
export function Travel() {
|
||||
return (
|
||||
<Section
|
||||
id="travel"
|
||||
eyebrow="Beyond the terminal"
|
||||
title="Get to know me through my travel album"
|
||||
lead="Outside of work I like to explore. Pin by pin, the travel map is a visual diary of the places I have been."
|
||||
>
|
||||
<div className="overflow-hidden rounded-2xl border border-white/10 bg-slate-900/70 shadow-lg shadow-black/20">
|
||||
<div className="grid lg:grid-cols-2">
|
||||
<div className="relative min-h-52 border-b border-white/10 bg-linear-to-br from-sky-500/10 via-transparent to-indigo-500/10 p-4 lg:border-r lg:border-b-0">
|
||||
<RouteArt />
|
||||
<span className="absolute top-4 left-4 flex items-center gap-1.5 rounded-full border border-white/15 bg-slate-950/80 px-3 py-1 text-xs text-slate-200">
|
||||
<Plane className="size-3.5 text-sky-300" aria-hidden="true" />
|
||||
Travel map
|
||||
</span>
|
||||
</div>
|
||||
|
||||
<div className="flex flex-col justify-center gap-5 p-6 sm:p-8">
|
||||
<div>
|
||||
<h3 className="flex items-center gap-2 text-xl font-semibold text-white">
|
||||
<MapPin className="size-5 text-sky-300" aria-hidden="true" />
|
||||
Travel map
|
||||
</h3>
|
||||
<p className="mt-2 text-sm leading-6 text-slate-300">
|
||||
Sign in with the credentials below to browse the album.
|
||||
</p>
|
||||
</div>
|
||||
<a
|
||||
href={travel.url}
|
||||
target="_blank"
|
||||
rel="noopener noreferrer"
|
||||
className="flex items-center justify-between gap-2 rounded-lg border border-sky-400/30 bg-sky-400/10 px-4 py-3 font-mono text-sm text-sky-200 transition-colors hover:bg-sky-400/20 focus-visible:ring-2 focus-visible:ring-sky-300 focus-visible:outline-none"
|
||||
>
|
||||
<span className="truncate">{travel.host}</span>
|
||||
<ExternalLink className="size-4 flex-none" aria-hidden="true" />
|
||||
</a>
|
||||
<CredentialRows user={travel.user} password={travel.password} />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</Section>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,121 @@
|
||||
import type { CSSProperties, ReactNode } from "react";
|
||||
import { ChevronDown, ChevronRight } from "lucide-react";
|
||||
|
||||
/** One box in a flow diagram: icon tile, title, subtitle and a mono detail line. */
|
||||
export function FlowNode({
|
||||
icon,
|
||||
title,
|
||||
subtitle,
|
||||
detail,
|
||||
accent,
|
||||
step,
|
||||
className = "",
|
||||
}: {
|
||||
icon: ReactNode;
|
||||
title: string;
|
||||
subtitle?: string;
|
||||
detail?: string;
|
||||
/** Hex colour used for the icon tile glow. */
|
||||
accent: string;
|
||||
step?: number;
|
||||
className?: string;
|
||||
}) {
|
||||
return (
|
||||
<div
|
||||
className={`relative min-w-0 flex-1 rounded-xl border border-white/10 bg-slate-900/70 p-4 shadow-lg shadow-black/20 backdrop-blur ${className}`}
|
||||
>
|
||||
{step !== undefined && (
|
||||
<span className="absolute -top-2.5 -left-2.5 flex size-6 items-center justify-center rounded-full border border-white/15 bg-slate-800 text-[11px] font-semibold text-slate-200">
|
||||
{step}
|
||||
</span>
|
||||
)}
|
||||
<div
|
||||
className="mb-3 flex size-11 items-center justify-center rounded-lg border"
|
||||
style={{
|
||||
backgroundColor: `${accent}1f`,
|
||||
borderColor: `${accent}40`,
|
||||
}}
|
||||
>
|
||||
{icon}
|
||||
</div>
|
||||
<h4 className="text-sm font-semibold text-white">{title}</h4>
|
||||
{subtitle && <p className="mt-1 text-xs leading-5 text-slate-400">{subtitle}</p>}
|
||||
{detail && (
|
||||
<p className="mt-2 break-words rounded-md bg-black/30 px-2 py-1 font-mono text-[11px] leading-4 text-sky-300">
|
||||
{detail}
|
||||
</p>
|
||||
)}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Animated dashed connector with an arrow head. Vertical on mobile and
|
||||
* horizontal on lg+, unless `vertical` pins it to a top-to-bottom hand-off.
|
||||
*/
|
||||
export function Connector({
|
||||
label,
|
||||
color = "#38bdf8",
|
||||
vertical = false,
|
||||
}: {
|
||||
label?: string;
|
||||
color?: string;
|
||||
vertical?: boolean;
|
||||
}) {
|
||||
if (vertical) {
|
||||
return (
|
||||
<div className="flex items-center justify-center gap-3 py-1" aria-hidden="true">
|
||||
<div className="flex flex-col items-center">
|
||||
<span className="flow-line-v" style={{ "--flow-color": color } as CSSProperties} />
|
||||
<ChevronDown className="-mt-1.5 size-4" style={{ color }} />
|
||||
</div>
|
||||
{label && <span className="font-mono text-[11px] text-slate-400">{label}</span>}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
return (
|
||||
<div
|
||||
className="flex flex-none items-center justify-center gap-2 py-1 lg:flex-col lg:gap-1 lg:px-1 lg:py-0"
|
||||
aria-hidden="true"
|
||||
>
|
||||
{label && (
|
||||
<span className="order-2 font-mono text-[11px] whitespace-nowrap text-slate-400 lg:order-0">
|
||||
{label}
|
||||
</span>
|
||||
)}
|
||||
<div className="order-1 flex flex-col items-center lg:order-0 lg:flex-row">
|
||||
<span className="flow-line" style={{ "--flow-color": color } as CSSProperties} />
|
||||
<ChevronDown className="-mt-1.5 size-4 lg:hidden" style={{ color }} />
|
||||
<ChevronRight className="-ml-1.5 hidden size-4 lg:block" style={{ color }} />
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
/** Dashed container that groups nodes belonging to the same host / system. */
|
||||
export function Boundary({
|
||||
label,
|
||||
icon,
|
||||
children,
|
||||
className = "",
|
||||
tone = "border-white/15",
|
||||
}: {
|
||||
label: string;
|
||||
icon: ReactNode;
|
||||
children: ReactNode;
|
||||
className?: string;
|
||||
tone?: string;
|
||||
}) {
|
||||
return (
|
||||
<div
|
||||
className={`relative rounded-2xl border border-dashed bg-white/2 px-4 pt-7 pb-5 sm:px-6 ${tone} ${className}`}
|
||||
>
|
||||
<div className="absolute -top-3.5 left-5 flex items-center gap-2 rounded-full border border-white/15 bg-slate-950 px-3 py-1 text-xs font-medium text-slate-200">
|
||||
{icon}
|
||||
{label}
|
||||
</div>
|
||||
{children}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,139 @@
|
||||
import { siDocker, siGit, siGitea, siHarbor, siHelm, siKubernetes } from "simple-icons";
|
||||
import { GitBranch, ShieldCheck, Tag, Undo2 } from "lucide-react";
|
||||
import { BrandIcon } from "@/components/BrandIcon";
|
||||
import { Connector, FlowNode } from "@/components/flow";
|
||||
|
||||
const lanes = [
|
||||
{
|
||||
env: "DEV",
|
||||
badge: "border-amber-300/40 bg-amber-300/10 text-amber-200",
|
||||
ring: "border-amber-300/25",
|
||||
icon: <GitBranch className="size-4 text-amber-300" aria-hidden="true" />,
|
||||
trigger: "Push to branch dev",
|
||||
rows: [
|
||||
["Image tag", "<commit sha> · latest-dev"],
|
||||
["Release", "<app>-dev, own namespace"],
|
||||
],
|
||||
},
|
||||
{
|
||||
env: "PROD",
|
||||
badge: "border-emerald-300/40 bg-emerald-300/10 text-emerald-200",
|
||||
ring: "border-emerald-300/25",
|
||||
icon: <Tag className="size-4 text-emerald-300" aria-hidden="true" />,
|
||||
trigger: "Push a version tag",
|
||||
rows: [
|
||||
["Guard", "tag commit must be on main"],
|
||||
["Image tag", "<release tag> · latest-prod"],
|
||||
["Release", "<app>-prod, own namespace"],
|
||||
],
|
||||
},
|
||||
];
|
||||
|
||||
const guarantees = [
|
||||
{ icon: <ShieldCheck className="size-4" aria-hidden="true" />, text: "Immutable image tags" },
|
||||
{ icon: <Undo2 className="size-4" aria-hidden="true" />, text: "helm --atomic --wait rolls back a bad release" },
|
||||
{ icon: <GitBranch className="size-4" aria-hidden="true" />, text: "One pipeline, two environments" },
|
||||
];
|
||||
|
||||
export function CicdFlow() {
|
||||
return (
|
||||
<div>
|
||||
<div className="flex flex-col items-stretch lg:flex-row lg:items-stretch">
|
||||
<FlowNode
|
||||
step={1}
|
||||
accent={`#${siGit.hex}`}
|
||||
icon={<BrandIcon icon={siGit} className="size-5" />}
|
||||
title="git push"
|
||||
subtitle="A branch or tag push starts the pipeline."
|
||||
detail="dev | v1.2.3"
|
||||
/>
|
||||
<Connector color="#34d399" />
|
||||
<FlowNode
|
||||
step={2}
|
||||
accent={`#${siGitea.hex}`}
|
||||
icon={<BrandIcon icon={siGitea} className="size-5" />}
|
||||
title="Gitea Actions"
|
||||
subtitle="act_runner picks up the workflow from the repo."
|
||||
detail="cicd.yaml"
|
||||
/>
|
||||
<Connector color="#34d399" />
|
||||
<FlowNode
|
||||
step={3}
|
||||
accent={`#${siDocker.hex}`}
|
||||
icon={<BrandIcon icon={siDocker} className="size-5" />}
|
||||
title="docker build"
|
||||
subtitle="Runner pod uses the Docker Desktop daemon socket."
|
||||
detail="multi-stage Dockerfile"
|
||||
/>
|
||||
<Connector color="#34d399" />
|
||||
<FlowNode
|
||||
step={4}
|
||||
accent={`#${siHarbor.hex}`}
|
||||
icon={<BrandIcon icon={siHarbor} className="size-5" />}
|
||||
title="Harbor"
|
||||
subtitle="Image is pushed to the private registry."
|
||||
detail="registry :8080"
|
||||
/>
|
||||
<Connector color="#34d399" />
|
||||
<FlowNode
|
||||
step={5}
|
||||
accent="#7c8cff"
|
||||
icon={<BrandIcon icon={siHelm} color="#7c8cff" className="size-5" />}
|
||||
title="helm upgrade"
|
||||
subtitle="Chart is rolled out to the namespace."
|
||||
detail="--atomic"
|
||||
/>
|
||||
<Connector color="#34d399" />
|
||||
<FlowNode
|
||||
step={6}
|
||||
accent={`#${siKubernetes.hex}`}
|
||||
icon={<BrandIcon icon={siKubernetes} className="size-5" />}
|
||||
title="Kubernetes"
|
||||
subtitle="Pods pull from Harbor with a pull secret."
|
||||
detail="Deployment · Service · Ingress"
|
||||
/>
|
||||
</div>
|
||||
|
||||
<div className="mt-8 grid gap-4 md:grid-cols-2">
|
||||
{lanes.map((lane) => (
|
||||
<div
|
||||
key={lane.env}
|
||||
className={`rounded-xl border bg-slate-900/60 p-5 ${lane.ring}`}
|
||||
>
|
||||
<div className="flex items-center gap-3">
|
||||
<span
|
||||
className={`rounded-md border px-2 py-0.5 text-xs font-bold tracking-wider ${lane.badge}`}
|
||||
>
|
||||
{lane.env}
|
||||
</span>
|
||||
<span className="flex items-center gap-1.5 text-sm font-medium text-white">
|
||||
{lane.icon}
|
||||
{lane.trigger}
|
||||
</span>
|
||||
</div>
|
||||
<dl className="mt-4 space-y-2 text-sm">
|
||||
{lane.rows.map(([k, v]) => (
|
||||
<div key={k} className="flex flex-wrap items-baseline justify-between gap-x-4">
|
||||
<dt className="text-slate-400">{k}</dt>
|
||||
<dd className="font-mono text-xs text-slate-200">{v}</dd>
|
||||
</div>
|
||||
))}
|
||||
</dl>
|
||||
</div>
|
||||
))}
|
||||
</div>
|
||||
|
||||
<ul className="mt-6 flex flex-wrap gap-2">
|
||||
{guarantees.map((g) => (
|
||||
<li
|
||||
key={g.text}
|
||||
className="flex items-center gap-2 rounded-full border border-white/10 bg-white/5 px-3 py-1.5 text-xs text-slate-300"
|
||||
>
|
||||
<span className="text-emerald-300">{g.icon}</span>
|
||||
{g.text}
|
||||
</li>
|
||||
))}
|
||||
</ul>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,154 @@
|
||||
import type { ReactNode } from "react";
|
||||
import {
|
||||
siApple,
|
||||
siDocker,
|
||||
siGitea,
|
||||
siGodaddy,
|
||||
siHarbor,
|
||||
siKubernetes,
|
||||
siNginx,
|
||||
} from "simple-icons";
|
||||
import { BarChart3, Globe, Laptop, Rocket } from "lucide-react";
|
||||
import { BrandIcon } from "@/components/BrandIcon";
|
||||
import { Boundary, Connector, FlowNode } from "@/components/flow";
|
||||
|
||||
type Target = {
|
||||
name: string;
|
||||
detail: string;
|
||||
icon: ReactNode;
|
||||
accent: string;
|
||||
};
|
||||
|
||||
const targets: Target[] = [
|
||||
{
|
||||
name: "it-cost-dev",
|
||||
detail: "dev environment",
|
||||
icon: <BarChart3 className="size-5 text-amber-300" aria-hidden="true" />,
|
||||
accent: "#fcd34d",
|
||||
},
|
||||
{
|
||||
name: "it-cost-prod",
|
||||
detail: "it-cost-prod.tomchien.com",
|
||||
icon: <BarChart3 className="size-5 text-emerald-300" aria-hidden="true" />,
|
||||
accent: "#6ee7b7",
|
||||
},
|
||||
{
|
||||
name: "harbor",
|
||||
detail: "harbor.tomchien.com",
|
||||
icon: <BrandIcon icon={siHarbor} className="size-5" />,
|
||||
accent: `#${siHarbor.hex}`,
|
||||
},
|
||||
{
|
||||
name: "gitea",
|
||||
detail: "gitea.tomchien.com",
|
||||
icon: <BrandIcon icon={siGitea} className="size-5" />,
|
||||
accent: `#${siGitea.hex}`,
|
||||
},
|
||||
{
|
||||
name: "portal",
|
||||
detail: "tomchien.com · this site",
|
||||
icon: <Rocket className="size-5 text-sky-300" aria-hidden="true" />,
|
||||
accent: "#7dd3fc",
|
||||
},
|
||||
];
|
||||
|
||||
export function RequestFlow() {
|
||||
return (
|
||||
<div className="space-y-2">
|
||||
<Boundary label="Internet" icon={<Globe className="size-3.5" aria-hidden="true" />}>
|
||||
<div className="flex flex-col items-center lg:flex-row lg:justify-center">
|
||||
<FlowNode
|
||||
step={1}
|
||||
accent="#7dd3fc"
|
||||
icon={<Laptop className="size-5 text-sky-300" aria-hidden="true" />}
|
||||
title="Visitor"
|
||||
subtitle="Opens a hostname in the browser."
|
||||
detail="*.tomchien.com"
|
||||
className="w-full lg:max-w-xs"
|
||||
/>
|
||||
<Connector label="DNS lookup" />
|
||||
<FlowNode
|
||||
step={2}
|
||||
accent={`#${siGodaddy.hex}`}
|
||||
icon={<BrandIcon icon={siGodaddy} className="size-5" />}
|
||||
title="GoDaddy DNS"
|
||||
subtitle="Records for tomchien.com point every hostname at the lab."
|
||||
detail="host.tomchien.com → Mac mini"
|
||||
className="w-full lg:max-w-xs"
|
||||
/>
|
||||
</div>
|
||||
</Boundary>
|
||||
|
||||
<div className="flex justify-center">
|
||||
<Connector vertical label="HTTP :80" />
|
||||
</div>
|
||||
|
||||
<Boundary
|
||||
label="Mac mini · macOS host"
|
||||
icon={<BrandIcon icon={siApple} color="#e2e8f0" className="size-3.5" />}
|
||||
>
|
||||
<div className="flex flex-col items-stretch lg:flex-row lg:items-center">
|
||||
<FlowNode
|
||||
step={3}
|
||||
accent={`#${siNginx.hex}`}
|
||||
icon={<BrandIcon icon={siNginx} className="size-5" />}
|
||||
title="Nginx on the host"
|
||||
subtitle="Edge reverse proxy: redirects port 80 into the cluster."
|
||||
detail="listen :80 → 127.0.0.1:8081"
|
||||
className="lg:max-w-60"
|
||||
/>
|
||||
<Connector label=":80 → :8081" />
|
||||
|
||||
<Boundary
|
||||
label="Docker Desktop · Kubernetes"
|
||||
icon={<BrandIcon icon={siDocker} className="size-3.5" />}
|
||||
tone="border-sky-400/40"
|
||||
className="min-w-0 flex-1"
|
||||
>
|
||||
<div className="flex flex-col items-stretch lg:flex-row lg:items-center">
|
||||
<FlowNode
|
||||
step={4}
|
||||
accent={`#${siKubernetes.hex}`}
|
||||
icon={<BrandIcon icon={siKubernetes} className="size-5" />}
|
||||
title="ingress-nginx"
|
||||
subtitle="LoadBalancer on 127.0.0.1. Routes by the Host header."
|
||||
detail="127.0.0.1 : 8081"
|
||||
className="lg:max-w-56"
|
||||
/>
|
||||
<Connector label="Host rule" />
|
||||
<div className="min-w-0 flex-1">
|
||||
<p className="mb-2 flex items-center gap-2 text-xs font-medium tracking-wide text-slate-400 uppercase">
|
||||
<span className="rounded bg-sky-400/15 px-1.5 py-0.5 text-[10px] font-semibold text-sky-300">
|
||||
5
|
||||
</span>
|
||||
Service → Pod
|
||||
</p>
|
||||
<ul className="relative space-y-2 border-l border-sky-400/30 pl-4">
|
||||
{targets.map((t) => (
|
||||
<li
|
||||
key={t.name}
|
||||
className="relative flex items-center gap-3 rounded-lg border border-white/10 bg-slate-900/70 px-3 py-2 before:absolute before:top-1/2 before:-left-4 before:h-px before:w-4 before:bg-sky-400/30"
|
||||
>
|
||||
<span
|
||||
className="flex size-8 flex-none items-center justify-center rounded-md border"
|
||||
style={{ backgroundColor: `${t.accent}1f`, borderColor: `${t.accent}40` }}
|
||||
>
|
||||
{t.icon}
|
||||
</span>
|
||||
<span className="min-w-0">
|
||||
<span className="block text-sm font-semibold text-white">{t.name}</span>
|
||||
<span className="block truncate font-mono text-[11px] text-slate-400">
|
||||
{t.detail}
|
||||
</span>
|
||||
</span>
|
||||
</li>
|
||||
))}
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</Boundary>
|
||||
</div>
|
||||
</Boundary>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,66 @@
|
||||
import type { ReactNode } from "react";
|
||||
import { siGitea, siHarbor } from "simple-icons";
|
||||
import { BarChart3, ExternalLink } from "lucide-react";
|
||||
import { BrandIcon } from "@/components/BrandIcon";
|
||||
import { CredentialRows } from "@/components/CredentialRows";
|
||||
import { labServices, type LabService } from "@/content/site";
|
||||
|
||||
const visuals: Record<LabService["id"], { icon: ReactNode; accent: string }> = {
|
||||
"it-cost-prod": {
|
||||
icon: <BarChart3 className="size-6 text-emerald-300" aria-hidden="true" />,
|
||||
accent: "#6ee7b7",
|
||||
},
|
||||
harbor: {
|
||||
icon: <BrandIcon icon={siHarbor} className="size-6" />,
|
||||
accent: `#${siHarbor.hex}`,
|
||||
},
|
||||
gitea: {
|
||||
icon: <BrandIcon icon={siGitea} className="size-6" />,
|
||||
accent: `#${siGitea.hex}`,
|
||||
},
|
||||
};
|
||||
|
||||
export function ServiceLinks() {
|
||||
return (
|
||||
<ul className="grid gap-4 md:grid-cols-3">
|
||||
{labServices.map((s) => {
|
||||
const v = visuals[s.id];
|
||||
return (
|
||||
<li
|
||||
key={s.id}
|
||||
className="flex flex-col rounded-xl border border-white/10 bg-slate-900/70 p-5 shadow-lg shadow-black/20"
|
||||
>
|
||||
<div className="flex items-center gap-3">
|
||||
<span
|
||||
className="flex size-12 flex-none items-center justify-center rounded-lg border"
|
||||
style={{ backgroundColor: `${v.accent}1f`, borderColor: `${v.accent}40` }}
|
||||
>
|
||||
{v.icon}
|
||||
</span>
|
||||
<div className="min-w-0">
|
||||
<h4 className="font-semibold text-white">{s.name}</h4>
|
||||
<p className="flex items-center gap-1.5 text-xs text-emerald-300">
|
||||
<span className="pulse-ring size-1.5 rounded-full bg-emerald-400" />
|
||||
{s.id}
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
<p className="mt-4 text-sm leading-6 text-slate-300">{s.description}</p>
|
||||
<a
|
||||
href={s.url}
|
||||
target="_blank"
|
||||
rel="noopener noreferrer"
|
||||
className="mt-4 flex items-center justify-between gap-2 rounded-lg border border-sky-400/30 bg-sky-400/10 px-3 py-2 font-mono text-sm text-sky-200 transition-colors hover:bg-sky-400/20 focus-visible:ring-2 focus-visible:ring-sky-300 focus-visible:outline-none"
|
||||
>
|
||||
<span className="truncate">{s.host}</span>
|
||||
<ExternalLink className="size-4 flex-none" aria-hidden="true" />
|
||||
</a>
|
||||
<div className="mt-5 border-t border-white/10 pt-4">
|
||||
<CredentialRows user={s.user} password={s.password} />
|
||||
</div>
|
||||
</li>
|
||||
);
|
||||
})}
|
||||
</ul>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,39 @@
|
||||
import {
|
||||
siApple,
|
||||
siDocker,
|
||||
siGitea,
|
||||
siGodaddy,
|
||||
siHarbor,
|
||||
siHelm,
|
||||
siKubernetes,
|
||||
siNginx,
|
||||
} from "simple-icons";
|
||||
import type { SimpleIcon } from "simple-icons";
|
||||
import { BrandIcon } from "@/components/BrandIcon";
|
||||
|
||||
const stack: { icon: SimpleIcon; label: string; color?: string }[] = [
|
||||
{ icon: siApple, label: "Mac mini", color: "#e2e8f0" },
|
||||
{ icon: siDocker, label: "Docker Desktop" },
|
||||
{ icon: siKubernetes, label: "Kubernetes" },
|
||||
{ icon: siNginx, label: "Nginx · ingress-nginx" },
|
||||
{ icon: siGodaddy, label: "GoDaddy DNS" },
|
||||
{ icon: siGitea, label: "Gitea Actions" },
|
||||
{ icon: siHarbor, label: "Harbor" },
|
||||
{ icon: siHelm, label: "Helm", color: "#7c8cff" },
|
||||
];
|
||||
|
||||
export function StackBadges() {
|
||||
return (
|
||||
<ul className="flex flex-wrap gap-2">
|
||||
{stack.map((s) => (
|
||||
<li
|
||||
key={s.label}
|
||||
className="flex items-center gap-2 rounded-full border border-white/10 bg-white/5 px-3 py-1.5 text-sm text-slate-200"
|
||||
>
|
||||
<BrandIcon icon={s.icon} color={s.color} className="size-4" />
|
||||
{s.label}
|
||||
</li>
|
||||
))}
|
||||
</ul>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,62 @@
|
||||
/**
|
||||
* All editable copy for the portal lives here, so nothing else needs touching
|
||||
* when you fill in the TBD placeholders.
|
||||
*/
|
||||
|
||||
// Only port 80 is exposed by the host Nginx, so the lab links default to
|
||||
// plain http. Switch to "https" once TLS is terminated on the Mac mini.
|
||||
const SCHEME = "http";
|
||||
|
||||
export const profile = {
|
||||
name: "Tom Chien",
|
||||
};
|
||||
|
||||
/** One string per paragraph. Replace "TBD" with the ~200 word introduction. */
|
||||
export const introduction: string[] = ["TBD"];
|
||||
|
||||
export type Credentials = { user: string; password: string };
|
||||
|
||||
export type LabService = {
|
||||
id: "it-cost-prod" | "harbor" | "gitea";
|
||||
name: string;
|
||||
description: string;
|
||||
host: string;
|
||||
url: string;
|
||||
} & Credentials;
|
||||
|
||||
export const labServices: LabService[] = [
|
||||
{
|
||||
id: "it-cost-prod",
|
||||
name: "IT Cost Dashboard",
|
||||
description: "Production environment of the IT cost dashboard app.",
|
||||
host: "it-cost-prod.tomchien.com",
|
||||
url: `${SCHEME}://it-cost-prod.tomchien.com`,
|
||||
user: "TBD",
|
||||
password: "TBD",
|
||||
},
|
||||
{
|
||||
id: "harbor",
|
||||
name: "Harbor",
|
||||
description: "Container registry that stores every image the pipeline builds.",
|
||||
host: "harbor.tomchien.com",
|
||||
url: `${SCHEME}://harbor.tomchien.com`,
|
||||
user: "TBD",
|
||||
password: "TBD",
|
||||
},
|
||||
{
|
||||
id: "gitea",
|
||||
name: "Gitea",
|
||||
description: "Git hosting and Actions CI/CD that drives every deployment.",
|
||||
host: "gitea.tomchien.com",
|
||||
url: `${SCHEME}://gitea.tomchien.com`,
|
||||
user: "TBD",
|
||||
password: "TBD",
|
||||
},
|
||||
];
|
||||
|
||||
export const travel = {
|
||||
host: "tomchien.com/travelmap",
|
||||
url: `${SCHEME}://tomchien.com/travelmap`,
|
||||
user: "TBD",
|
||||
password: "TBD",
|
||||
} satisfies Credentials & { host: string; url: string };
|
||||
@@ -0,0 +1,18 @@
|
||||
import { defineConfig, globalIgnores } from "eslint/config";
|
||||
import nextVitals from "eslint-config-next/core-web-vitals";
|
||||
import nextTs from "eslint-config-next/typescript";
|
||||
|
||||
const eslintConfig = defineConfig([
|
||||
...nextVitals,
|
||||
...nextTs,
|
||||
// Override default ignores of eslint-config-next.
|
||||
globalIgnores([
|
||||
// Default ignores of eslint-config-next:
|
||||
".next/**",
|
||||
"out/**",
|
||||
"build/**",
|
||||
"next-env.d.ts",
|
||||
]),
|
||||
]);
|
||||
|
||||
export default eslintConfig;
|
||||
@@ -0,0 +1,6 @@
|
||||
apiVersion: v2
|
||||
name: portal
|
||||
description: Interview portal describing the Mac mini Kubernetes lab (Next.js, standalone server)
|
||||
type: application
|
||||
version: 0.1.0
|
||||
appVersion: "0.1.0"
|
||||
@@ -0,0 +1,28 @@
|
||||
{{- define "portal.name" -}}
|
||||
{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" -}}
|
||||
{{- end -}}
|
||||
|
||||
{{- define "portal.fullname" -}}
|
||||
{{- if .Values.fullnameOverride -}}
|
||||
{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" -}}
|
||||
{{- else -}}
|
||||
{{- $name := default .Chart.Name .Values.nameOverride -}}
|
||||
{{- if contains $name .Release.Name -}}
|
||||
{{- .Release.Name | trunc 63 | trimSuffix "-" -}}
|
||||
{{- else -}}
|
||||
{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
|
||||
{{- define "portal.selectorLabels" -}}
|
||||
app.kubernetes.io/name: {{ include "portal.name" . }}
|
||||
app.kubernetes.io/instance: {{ .Release.Name }}
|
||||
app.kubernetes.io/component: server
|
||||
{{- end -}}
|
||||
|
||||
{{- define "portal.labels" -}}
|
||||
helm.sh/chart: {{ printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }}
|
||||
{{ include "portal.selectorLabels" . }}
|
||||
app.kubernetes.io/managed-by: {{ .Release.Service }}
|
||||
{{- end -}}
|
||||
@@ -0,0 +1,57 @@
|
||||
apiVersion: apps/v1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
name: {{ include "portal.fullname" . }}
|
||||
labels:
|
||||
{{- include "portal.labels" . | nindent 4 }}
|
||||
spec:
|
||||
replicas: {{ .Values.server.replicas }}
|
||||
selector:
|
||||
matchLabels:
|
||||
{{- include "portal.selectorLabels" . | nindent 6 }}
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
{{- include "portal.labels" . | nindent 8 }}
|
||||
spec:
|
||||
{{- with .Values.imagePullSecrets }}
|
||||
imagePullSecrets:
|
||||
{{- toYaml . | nindent 8 }}
|
||||
{{- end }}
|
||||
securityContext:
|
||||
runAsNonRoot: true
|
||||
runAsUser: 1001
|
||||
runAsGroup: 1001
|
||||
seccompProfile:
|
||||
type: RuntimeDefault
|
||||
containers:
|
||||
- name: server
|
||||
image: "{{ .Values.server.image.repository }}:{{ .Values.server.image.tag }}"
|
||||
imagePullPolicy: {{ .Values.server.image.pullPolicy }}
|
||||
ports:
|
||||
- name: http
|
||||
containerPort: {{ .Values.server.port }}
|
||||
protocol: TCP
|
||||
env:
|
||||
- name: PORT
|
||||
value: {{ .Values.server.port | quote }}
|
||||
- name: HOSTNAME
|
||||
value: "0.0.0.0"
|
||||
readinessProbe:
|
||||
httpGet:
|
||||
path: /
|
||||
port: http
|
||||
initialDelaySeconds: 3
|
||||
periodSeconds: 10
|
||||
livenessProbe:
|
||||
httpGet:
|
||||
path: /
|
||||
port: http
|
||||
initialDelaySeconds: 10
|
||||
periodSeconds: 20
|
||||
resources:
|
||||
{{- toYaml .Values.server.resources | nindent 12 }}
|
||||
securityContext:
|
||||
allowPrivilegeEscalation: false
|
||||
capabilities:
|
||||
drop: ["ALL"]
|
||||
@@ -0,0 +1,25 @@
|
||||
{{- if .Values.ingress.enabled }}
|
||||
apiVersion: networking.k8s.io/v1
|
||||
kind: Ingress
|
||||
metadata:
|
||||
name: {{ include "portal.fullname" . }}
|
||||
labels:
|
||||
{{- include "portal.labels" . | nindent 4 }}
|
||||
{{- with .Values.ingress.annotations }}
|
||||
annotations:
|
||||
{{- toYaml . | nindent 4 }}
|
||||
{{- end }}
|
||||
spec:
|
||||
ingressClassName: {{ .Values.ingress.className }}
|
||||
rules:
|
||||
- host: {{ .Values.ingress.host | quote }}
|
||||
http:
|
||||
paths:
|
||||
- path: /
|
||||
pathType: Prefix
|
||||
backend:
|
||||
service:
|
||||
name: {{ include "portal.fullname" . }}
|
||||
port:
|
||||
name: http
|
||||
{{- end }}
|
||||
@@ -0,0 +1,15 @@
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
name: {{ include "portal.fullname" . }}
|
||||
labels:
|
||||
{{- include "portal.labels" . | nindent 4 }}
|
||||
spec:
|
||||
type: {{ .Values.service.type }}
|
||||
ports:
|
||||
- name: http
|
||||
port: {{ .Values.service.port }}
|
||||
targetPort: http
|
||||
protocol: TCP
|
||||
selector:
|
||||
{{- include "portal.selectorLabels" . | nindent 4 }}
|
||||
@@ -0,0 +1,4 @@
|
||||
# Dev environment: deployed from the `dev` branch.
|
||||
# Requires a DNS record for this host at GoDaddy (same target as the other lab hostnames).
|
||||
ingress:
|
||||
host: portal-dev.tomchien.com
|
||||
@@ -0,0 +1,6 @@
|
||||
# Prod environment: deployed from a version tag on main.
|
||||
ingress:
|
||||
host: tomchien.com
|
||||
|
||||
server:
|
||||
replicas: 1
|
||||
@@ -0,0 +1,33 @@
|
||||
nameOverride: ""
|
||||
fullnameOverride: ""
|
||||
|
||||
# Image settings. The CI workflow overrides repository and tag per run:
|
||||
# --set server.image.repository=<registry>/portal-<env> --set server.image.tag=<sha|release-tag>
|
||||
server:
|
||||
image:
|
||||
repository: host.docker.internal:8080/library/portal
|
||||
tag: latest
|
||||
pullPolicy: IfNotPresent
|
||||
replicas: 1
|
||||
port: 3000
|
||||
resources:
|
||||
requests:
|
||||
cpu: 25m
|
||||
memory: 96Mi
|
||||
limits:
|
||||
cpu: 250m
|
||||
memory: 256Mi
|
||||
|
||||
# Pull secret created per namespace by the CI workflow.
|
||||
imagePullSecrets:
|
||||
- name: harbor-pull-secret
|
||||
|
||||
service:
|
||||
type: ClusterIP
|
||||
port: 80
|
||||
|
||||
ingress:
|
||||
enabled: true
|
||||
className: nginx
|
||||
host: portal.example.com
|
||||
annotations: {}
|
||||
@@ -0,0 +1,18 @@
|
||||
import type { NextConfig } from "next";
|
||||
|
||||
const nextConfig: NextConfig = {
|
||||
// Self-contained server bundle (.next/standalone) for the Docker image.
|
||||
output: "standalone",
|
||||
cacheComponents: true,
|
||||
partialPrefetching: true,
|
||||
turbopack: {
|
||||
rules: {
|
||||
"*.css": {
|
||||
loaders: ["@tailwindcss/turbopack"],
|
||||
as: "*.css",
|
||||
},
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
export default nextConfig;
|
||||
Generated
+6828
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,28 @@
|
||||
{
|
||||
"name": "portal",
|
||||
"version": "0.1.0",
|
||||
"private": true,
|
||||
"scripts": {
|
||||
"dev": "next dev",
|
||||
"build": "next build",
|
||||
"start": "next start",
|
||||
"lint": "eslint"
|
||||
},
|
||||
"dependencies": {
|
||||
"lucide-react": "^1.74.0",
|
||||
"next": "16.4.6",
|
||||
"react": "19.3.0",
|
||||
"react-dom": "19.3.0",
|
||||
"simple-icons": "^16.38.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@tailwindcss/turbopack": "4.3.3",
|
||||
"@types/node": "^20",
|
||||
"@types/react": "^19",
|
||||
"@types/react-dom": "^19",
|
||||
"eslint": "^9",
|
||||
"eslint-config-next": "16.4.6",
|
||||
"tailwindcss": "4.3.3",
|
||||
"typescript": "^5"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"target": "ES2017",
|
||||
"lib": ["dom", "dom.iterable", "esnext"],
|
||||
"allowJs": true,
|
||||
"skipLibCheck": true,
|
||||
"strict": true,
|
||||
"noEmit": true,
|
||||
"esModuleInterop": true,
|
||||
"module": "esnext",
|
||||
"moduleResolution": "bundler",
|
||||
"resolveJsonModule": true,
|
||||
"isolatedModules": true,
|
||||
"jsx": "react-jsx",
|
||||
"incremental": true,
|
||||
"plugins": [
|
||||
{
|
||||
"name": "next"
|
||||
}
|
||||
],
|
||||
"paths": {
|
||||
"@/*": ["./*"]
|
||||
}
|
||||
},
|
||||
"include": [
|
||||
"next-env.d.ts",
|
||||
"**/*.ts",
|
||||
"**/*.tsx",
|
||||
".next/types/**/*.ts",
|
||||
".next/dev/types/**/*.ts",
|
||||
"**/*.mts"
|
||||
],
|
||||
"exclude": ["node_modules"]
|
||||
}
|
||||
Reference in New Issue
Block a user