first commit

This commit is contained in:
Tom Chien (IQ-AS)
2026-11-18 14:25:46 +08:00
commit 3894a995d7
+93
View File
@@ -0,0 +1,93 @@
# Portal
Interview portal for my Kubernetes home lab. A single-page Next.js site with three sections:
1. **Introduction** - short bio (placeholder `TBD` until the ~200 words are written).
2. **The Lab** - animated diagrams of the request path (GoDaddy DNS -> host Nginx :80 -> ingress-nginx :8081 -> Service -> Pod) and the CI/CD pipeline (git push -> Gitea Actions -> docker build -> Harbor -> Helm -> Kubernetes), plus a link list for `it-cost-prod`, `harbor` and `gitea`.
3. **Travel** - link to the travel map.
Everything is rendered by server components (no client JS), styled with Tailwind CSS 4, and shipped as a Next.js `standalone` build.
## Editing the content
All copy lives in one file: [`content/site.ts`](content/site.ts).
| What | Where |
| --- | --- |
| Name shown in the header | `profile.name` |
| Introduction paragraphs | `introduction` (array of strings, one per paragraph) |
| Lab links, user and password | `labServices` |
| Travel map link, user and password | `travel` |
Replace every `TBD` with the real value. The diagrams themselves are in `components/lab/`.
> **Do not put real credentials here.** This repo and the rendered page are public to anyone who can reach them. Use a read-only demo account created just for interviewers.
## Local development
```bash
npm install
npm run dev # http://localhost:3000
npm run lint
npx tsc --noEmit
```
Production-like run:
```bash
npm run build
cp -r .next/static .next/standalone/.next/static
node .next/standalone/server.js
```
(`output: "standalone"` means `next start` is not the right entrypoint; the Dockerfile does the same copy.)
## Deployment
```
Dockerfile multi-stage image (node:24-alpine, non-root uid 1001, port 3000)
helm/ chart: Deployment + Service + Ingress
helm/values.yaml defaults
helm/values-dev.yaml dev overrides -> portal-dev.tomchien.com
helm/values-prod.yaml prod overrides -> tomchien.com
.gitea/workflows/cicd.yaml Gitea Actions pipeline
```
### Pipeline behaviour
| Trigger | Environment | Namespace / release | Image tag deployed |
| --- | --- | --- | --- |
| push to branch `dev` | dev | `portal-dev` | commit SHA |
| push of any tag | prod | `portal-prod` | the git tag |
- A tag is only deployed if its commit is an ancestor of `origin/main`; otherwise the job fails.
- Each run: lint the chart -> build the image -> push to Harbor (`host.docker.internal:8080/library/portal-<env>`) -> ensure namespace and `harbor-pull-secret` -> `helm upgrade --install --wait --atomic`.
- A failed Helm release is rolled back automatically (`--atomic`) and the job prints pod/event/log diagnostics.
- Concurrency is grouped per environment, so a `dev` push never cancels a running prod deploy.
### Required Gitea secrets
Repository -> Settings -> Actions -> Secrets:
| Secret | Value |
| --- | --- |
| `KUBE_CONFIG_DATA` | base64 of the kubeconfig the runner uses (`base64 -w0 ~/.kube/config`) |
| `HARBOR_USERNAME` | Harbor user with push rights on the `library` project |
| `HARBOR_PASSWORD` | that user's password / robot token |
### One-time prerequisites
- GoDaddy DNS: add an `A` record for `portal-dev` (and for `@` / `tomchien.com` if it is not already pointing at the Mac mini).
- Docker Desktop daemon must list `host.docker.internal:8080` under `insecure-registries` (Harbor is plain HTTP).
- If `tomchien.com/travelmap` is served by a different Service on the same host, give it its own Ingress with path `/travelmap`; ingress-nginx picks the longest matching path over this chart's `/`.
### Release flow
```bash
# dev
git push origin dev
# prod
git checkout main && git merge dev
git tag v1.0.0 && git push origin main v1.0.0
```