mirror of
https://github.com/ION606/argo-temp.git
synced 2026-06-06 05:22:57 +00:00
added initial istio BLAHAJ code
This commit is contained in:
@@ -0,0 +1,6 @@
|
||||
FROM oven/bun:1.1.31-alpine
|
||||
WORKDIR /app
|
||||
COPY server.mjs ./server.mjs
|
||||
COPY public ./public
|
||||
EXPOSE 8080
|
||||
CMD ["bun", "run", "server.mjs"]
|
||||
@@ -0,0 +1,26 @@
|
||||
apiVersion: apps/v1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
name: reef
|
||||
namespace: demo
|
||||
spec:
|
||||
replicas: 1
|
||||
selector: { matchLabels: { app: reef } }
|
||||
template:
|
||||
metadata:
|
||||
labels: { app: reef }
|
||||
spec:
|
||||
containers:
|
||||
- name: app
|
||||
image: blahaj-bun:dev
|
||||
imagePullPolicy: IfNotPresent
|
||||
ports: [{ name: http, containerPort: 8080 }]
|
||||
---
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
name: reef
|
||||
namespace: demo
|
||||
spec:
|
||||
selector: { app: reef }
|
||||
ports: [{ name: http, port: 80, targetPort: 8080 }]
|
||||
@@ -0,0 +1,3 @@
|
||||
apiVersion: kustomize.config.k8s.io/v1beta1
|
||||
kind: Kustomization
|
||||
resources: [deployment.yaml]
|
||||
@@ -0,0 +1,44 @@
|
||||
const endpoints = [
|
||||
{ path: '/blahaj', title: 'bubbles greeter (blahaj)' },
|
||||
{ path: '/kelp', title: 'kelp' },
|
||||
{ path: '/coral', title: 'coral' },
|
||||
{ path: '/bubbles', title: 'bubbles' },
|
||||
];
|
||||
|
||||
const cards = document.querySelector('#cards');
|
||||
|
||||
function cardDOM({ title, ok, data, error }) {
|
||||
const el = document.createElement('article');
|
||||
el.className = `card ${ok ? 'ok' : 'err'}`;
|
||||
|
||||
const h2 = document.createElement('h2');
|
||||
h2.textContent = title;
|
||||
el.appendChild(h2);
|
||||
|
||||
const pre = document.createElement('pre');
|
||||
pre.textContent = ok ? JSON.stringify(data, null, 2) : String(error || 'error');
|
||||
el.appendChild(pre);
|
||||
|
||||
return el;
|
||||
}
|
||||
|
||||
async function fetchOne(path) {
|
||||
const r = await fetch(path, { headers: { 'accept': 'application/json' } });
|
||||
if (!r.ok) throw new Error(`${path} -> ${r.status}`);
|
||||
return r.json();
|
||||
}
|
||||
|
||||
async function refresh() {
|
||||
cards.textContent = ''; // clear
|
||||
for (const ep of endpoints) {
|
||||
try {
|
||||
const data = await fetchOne(ep.path);
|
||||
cards.appendChild(cardDOM({ title: ep.title, ok: true, data }));
|
||||
} catch (err) {
|
||||
cards.appendChild(cardDOM({ title: ep.title, ok: false, error: err.message }));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
document.querySelector('#refresh').addEventListener('click', () => refresh());
|
||||
refresh();
|
||||
@@ -0,0 +1,23 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<title>blåhaj reef</title>
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
||||
<link href="/static/style.css" rel="stylesheet" />
|
||||
</head>
|
||||
<body>
|
||||
<header>
|
||||
<h1>🦈 blåhaj’s reef</h1>
|
||||
<p>cute sea-friends saying hi (live from your mesh)</p>
|
||||
</header>
|
||||
|
||||
<main id="cards"></main>
|
||||
|
||||
<footer>
|
||||
<button id="refresh">refresh</button>
|
||||
</footer>
|
||||
|
||||
<script type="module" src="/static/app.js"></script>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,94 @@
|
||||
/* soft, cute card ui */
|
||||
/* created by ChatGPT because god help me I can't UI */
|
||||
:root {
|
||||
--bg: #0b132b;
|
||||
--panel: #1c2541;
|
||||
--ink: #e0e6ff;
|
||||
--muted: #9fb3ff;
|
||||
--ok: #3ddc97;
|
||||
--err: #ff6b6b;
|
||||
}
|
||||
|
||||
* {
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
body {
|
||||
margin: 0;
|
||||
font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Inter, sans-serif;
|
||||
background: var(--bg);
|
||||
color: var(--ink);
|
||||
}
|
||||
|
||||
header {
|
||||
padding: 24px;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
header h1 {
|
||||
margin: 0 0 8px 0;
|
||||
font-size: 28px;
|
||||
}
|
||||
|
||||
header p {
|
||||
margin: 0;
|
||||
color: var(--muted);
|
||||
}
|
||||
|
||||
#cards {
|
||||
display: grid;
|
||||
gap: 16px;
|
||||
grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
|
||||
padding: 16px;
|
||||
max-width: 1200px;
|
||||
margin: 0 auto;
|
||||
}
|
||||
|
||||
.card {
|
||||
background: var(--panel);
|
||||
border-radius: 16px;
|
||||
padding: 16px;
|
||||
box-shadow: 0 10px 24px rgba(0, 0, 0, .25);
|
||||
border: 1px solid rgba(255, 255, 255, .06);
|
||||
}
|
||||
|
||||
.card.ok {
|
||||
outline: 2px solid var(--ok);
|
||||
}
|
||||
|
||||
.card.err {
|
||||
outline: 2px solid var(--err);
|
||||
}
|
||||
|
||||
.card h2 {
|
||||
margin: 0 0 8px 0;
|
||||
font-size: 18px;
|
||||
}
|
||||
|
||||
.card pre {
|
||||
margin: 0;
|
||||
white-space: pre-wrap;
|
||||
word-break: break-word;
|
||||
font-size: 13px;
|
||||
color: #e9f2ff;
|
||||
}
|
||||
|
||||
footer {
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
padding: 16px 0 32px;
|
||||
}
|
||||
|
||||
button {
|
||||
background: var(--ok);
|
||||
color: #002b36;
|
||||
border: 0;
|
||||
padding: 10px 16px;
|
||||
border-radius: 12px;
|
||||
font-weight: 600;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
button:hover {
|
||||
filter: brightness(.95);
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
const serveFile = (path) => new Response(Bun.file(path));
|
||||
|
||||
const server = Bun.serve({
|
||||
port: Number(process.env.PORT || 8080),
|
||||
async fetch(req) {
|
||||
const url = new URL(req.url);
|
||||
if (url.pathname === '/') return serveFile('./public/index.html');
|
||||
if (url.pathname.startsWith('/static/')) {
|
||||
return serveFile(`.${url.pathname}`);
|
||||
}
|
||||
|
||||
return serveFile('./public/index.html');
|
||||
},
|
||||
});
|
||||
|
||||
console.log(`reef listening on ${server.port};`);
|
||||
Reference in New Issue
Block a user