Compare commits

...

10 Commits

Author SHA1 Message Date
7c6effc66e
updates
Some checks failed
Gitea Actions CI / Build and deploy (push) Failing after 57s
Tests / Build and deploy (push) Failing after 16s
Signed-off-by: Xe Iaso <me@xeiaso.net>
2025-01-12 12:32:08 -05:00
f5443aaf2b
manifest/autoscale: set default pods to 0
Signed-off-by: Xe Iaso <me@xeiaso.net>
2024-10-09 09:43:01 -04:00
6fa1904a50
use internal registry
Signed-off-by: Xe Iaso <me@xeiaso.net>
2024-10-08 18:27:07 -04:00
2848465630
allow well known
Signed-off-by: Xe Iaso <me@xeiaso.net>
2024-10-03 15:14:11 -04:00
547ab3dc85
allow GO_HTTP
Signed-off-by: Xe Iaso <me@xeiaso.net>
2024-10-03 15:13:53 -04:00
5cd8a98101
underscores are banned
Signed-off-by: Xe Iaso <me@xeiaso.net>
2024-10-03 11:07:17 -04:00
1036526e1c
I'm a baka, Next.js routes can't start with underscores 2024-10-03 10:17:30 -04:00
b543376207
manifest: default to 0 autoscaled pods
Signed-off-by: Xe Iaso <me@xeiaso.net>
2024-10-03 10:12:43 -04:00
de9f968d78
app: make _healthz a real API route, match on k8s healthcheck user-agent
Signed-off-by: Xe Iaso <me@xeiaso.net>
2024-10-03 09:56:51 -04:00
0dabe6e399
log less
Signed-off-by: Xe Iaso <me@xeiaso.net>
2024-10-03 09:19:32 -04:00
10 changed files with 580 additions and 1229 deletions

View File

@ -37,6 +37,7 @@ next-env.d.ts
# Kubernetes
/manifest/
Earthfile
# Content collections
.content-collections

View File

@ -27,9 +27,8 @@ run:
COPY +build/app/.next/standalone /app
COPY +build/app/.next/static /app/.next/static
COPY +build/app/public /app/public
RUN mkdir -p /app/.next/cache
EXPOSE 3000
CMD [ "node", "server.js" ]
SAVE IMAGE --push ghcr.io/xe/techaro-lol
SAVE IMAGE --push registry.default.svc.alrest.xeserv.us/techaro/www

14
app/healthz/route.ts Normal file
View File

@ -0,0 +1,14 @@
import { NextRequest, NextResponse } from "next/server";
export const GET = async (req: NextRequest) => {
if (req.headers.get("user-agent") !== "healthz") {
return NextResponse.json({ error: "Not found" }, { status: 404 });
}
return new Response("OK", {
status: 200,
headers: {
"Content-Type": "text/plain",
},
});
};

View File

@ -13,7 +13,7 @@ spec:
service: techaro-lol
port: 80
replicas:
min: 1
min: 0
max: 10
scaledownPeriod: 300
scalingMetric:

View File

@ -16,7 +16,7 @@ spec:
claimName: techaro-lol-temp
containers:
- name: main
image: ghcr.io/xe/techaro-lol:latest
image: reg.xeiaso.net/techaro/www:latest
imagePullPolicy: "Always"
resources:
limits:
@ -44,12 +44,10 @@ spec:
type: RuntimeDefault
livenessProbe:
httpGet:
path: /_healthz
path: /healthz
port: 3000
httpHeaders:
- name: x-real-ip
value: "100.100.100.100"
- name: user-agent
value: "Kubernetes healthchecks"
value: "healthz"
initialDelaySeconds: 3
periodSeconds: 3

View File

@ -4,7 +4,7 @@ import { NextRequest, NextResponse } from "next/server";
export const config = {
// matcher tells Next.js which routes to run the middleware on.
// This runs the middleware on all routes except for static assets.
matcher: ["/((?!_next/static|_next/image|favicon.ico|_healthz).*)"],
matcher: ["/((?!_next/static|_next/image|favicon.ico|healthz|.well-known/.*).*)"],
};
const aj = arcjet({
@ -16,6 +16,7 @@ const aj = arcjet({
"CATEGORY:SEARCH_ENGINE",
"CATEGORY:PREVIEW",
"CATEGORY:SOCIAL",
"GO_HTTP",
],
}),
],
@ -23,11 +24,8 @@ const aj = arcjet({
export default async function middleware(req: NextRequest) {
const decision = await aj.protect(req);
console.log(decision);
if (
// If this deny comes from a bot rule then block the request. You can
// customize this logic to fit your needs e.g. changing the status code.
decision.isDenied() &&
decision.reason.isBot()
) {

View File

@ -1,8 +1,10 @@
/** @type {import('next').NextConfig} */
import { withContentCollections } from "@content-collections/next";
import createMDX from '@next/mdx';
const nextConfig = {
pageExtensions: ['js', 'jsx', 'md', 'mdx', 'ts', 'tsx'],
output: "standalone",
images: {
remotePatterns: [
@ -16,4 +18,6 @@ const nextConfig = {
},
};
export default withContentCollections(nextConfig);
const withMDX = createMDX({});
export default withContentCollections(withMDX(nextConfig));

1764
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -12,7 +12,11 @@
},
"dependencies": {
"@arcjet/next": "^1.0.0-alpha.26",
"@mdx-js/loader": "^3.0.1",
"@mdx-js/react": "^3.0.1",
"@next/mdx": "^14.2.14",
"@tabler/icons-react": "^3.17.0",
"@types/mdx": "^2.0.13",
"date-fns": "^4.1.0",
"feed": "^4.2.2",
"lucide-react": "^0.399.0",

View File

@ -1 +0,0 @@
OK