feat: initial codebase v0.4.1
Some checks failed
Deploy to Staging / build-and-deploy (push) Failing after 9m44s
Some checks failed
Deploy to Staging / build-and-deploy (push) Failing after 9m44s
- Extract complete codebase from running staging pod - Add Dockerfile with multi-stage build for Node.js + Puppeteer - Configure CI/CD workflows for staging and production deployment - Include all source files, configs, and public assets
This commit is contained in:
commit
b58f634318
28 changed files with 5669 additions and 0 deletions
68
public/status.html
Normal file
68
public/status.html
Normal file
|
|
@ -0,0 +1,68 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>SnapAPI Status</title>
|
||||
<style>
|
||||
*{margin:0;padding:0;box-sizing:border-box}
|
||||
body{background:#0a0a0a;color:#e0e0e0;font-family:-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,sans-serif;display:flex;justify-content:center;align-items:center;min-height:100vh}
|
||||
.container{max-width:480px;width:100%;padding:2rem}
|
||||
h1{font-size:1.5rem;margin-bottom:2rem;font-weight:600}
|
||||
.status-header{display:flex;align-items:center;gap:12px;margin-bottom:2rem}
|
||||
.dot{width:12px;height:12px;border-radius:50%;background:#ef4444;flex-shrink:0}
|
||||
.dot.ok{background:#22c55e;animation:pulse 2s infinite}
|
||||
.dot.degraded{background:#f59e0b}
|
||||
@keyframes pulse{0%,100%{opacity:1}50%{opacity:.4}}
|
||||
.status-text{font-size:1.25rem;font-weight:600}
|
||||
.status-text.ok{color:#22c55e}
|
||||
.status-text.down{color:#ef4444}
|
||||
.status-text.degraded{color:#f59e0b}
|
||||
.metrics{display:flex;flex-direction:column;gap:1rem}
|
||||
.metric{background:#141414;border-radius:8px;padding:1rem;display:flex;justify-content:space-between;align-items:center}
|
||||
.metric-label{color:#888;font-size:.85rem}
|
||||
.metric-value{font-weight:500;font-size:.95rem}
|
||||
.footer{margin-top:2rem;color:#555;font-size:.75rem;text-align:center}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div class="container">
|
||||
<h1>SnapAPI Status</h1>
|
||||
<div class="status-header">
|
||||
<div class="dot" id="dot"></div>
|
||||
<div class="status-text" id="statusText">Checking...</div>
|
||||
</div>
|
||||
<div class="metrics">
|
||||
<div class="metric"><span class="metric-label">Response Time</span><span class="metric-value" id="responseTime">—</span></div>
|
||||
<div class="metric"><span class="metric-label">Browser Pool</span><span class="metric-value" id="pool">—</span></div>
|
||||
<div class="metric"><span class="metric-label">Uptime</span><span class="metric-value" id="uptime">—</span></div>
|
||||
<div class="metric"><span class="metric-label">Last Checked</span><span class="metric-value" id="lastChecked">—</span></div>
|
||||
</div>
|
||||
<div class="footer">Auto-refreshes every 30s</div>
|
||||
</div>
|
||||
<script>
|
||||
function fmt(s){if(s<60)return s+"s";if(s<3600)return Math.floor(s/60)+"m "+s%60+"s";const h=Math.floor(s/3600);return h+"h "+Math.floor((s%3600)/60)+"m"}
|
||||
async function check(){
|
||||
const dot=document.getElementById("dot"),st=document.getElementById("statusText");
|
||||
try{
|
||||
const t0=performance.now();
|
||||
const r=await fetch("/health");
|
||||
const ms=Math.round(performance.now()-t0);
|
||||
const d=await r.json();
|
||||
const ok=d.status==="ok";
|
||||
dot.className="dot"+(ok?" ok":" degraded");
|
||||
st.className="status-text"+(ok?" ok":" degraded");
|
||||
st.textContent=ok?"Operational":"Degraded";
|
||||
document.getElementById("responseTime").textContent=ms+"ms";
|
||||
if(d.browserPool)document.getElementById("pool").textContent=d.browserPool.active+"/"+d.browserPool.total+" active";
|
||||
if(d.uptime)document.getElementById("uptime").textContent=fmt(d.uptime);
|
||||
document.getElementById("lastChecked").textContent=new Date().toLocaleTimeString();
|
||||
}catch(e){
|
||||
dot.className="dot";st.className="status-text down";st.textContent="Down";
|
||||
document.getElementById("responseTime").textContent="—";
|
||||
document.getElementById("lastChecked").textContent=new Date().toLocaleTimeString();
|
||||
}}
|
||||
check();setInterval(check,30000);
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
Loading…
Add table
Add a link
Reference in a new issue