podman 로컬개발 + Coolify(Dockerfile) 배포용 베이스. - Express 서버: /healthz, /db, /s3 연결 확인 - src/config.js 단일 진입점 → src/db.js(pg), src/s3.js(MinIO) - scripts/check-db.js, check-minio.js 연결 점검 - Dockerfile / compose.yaml / .dockerignore, 비밀값은 env 파일(gitignore)에서만 Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
34 lines
877 B
JavaScript
34 lines
877 B
JavaScript
// 최소 Express 서버 — /healthz, /db, /s3 로 연결 확인.
|
|
import express from "express";
|
|
import { config } from "./config.js";
|
|
import { pingDb } from "./db.js";
|
|
import { pingS3 } from "./s3.js";
|
|
|
|
const app = express();
|
|
|
|
app.get("/healthz", (_req, res) => res.json({ ok: true }));
|
|
|
|
app.get("/db", async (_req, res) => {
|
|
try {
|
|
res.json({ ok: true, ...(await pingDb()) });
|
|
} catch (e) {
|
|
res.status(500).json({ ok: false, error: String(e.message || e) });
|
|
}
|
|
});
|
|
|
|
app.get("/s3", async (_req, res) => {
|
|
try {
|
|
res.json({ ok: true, ...(await pingS3()) });
|
|
} catch (e) {
|
|
res.status(500).json({ ok: false, error: String(e.message || e) });
|
|
}
|
|
});
|
|
|
|
app.get("/", (_req, res) =>
|
|
res.json({ name: "sample", endpoints: ["/healthz", "/db", "/s3"] })
|
|
);
|
|
|
|
app.listen(config.port, "0.0.0.0", () => {
|
|
console.log(`sample listening on :${config.port}`);
|
|
});
|