Merge branch origin/copilot/ensure-railway-connection into main
This commit is contained in:
11
nixpacks.toml
Normal file
11
nixpacks.toml
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
[phases.setup]
|
||||||
|
nixPkgs = ['nodejs_20']
|
||||||
|
|
||||||
|
[phases.install]
|
||||||
|
cmds = ['npm ci']
|
||||||
|
|
||||||
|
[phases.build]
|
||||||
|
cmds = ['npm run build']
|
||||||
|
|
||||||
|
[start]
|
||||||
|
cmd = 'npm start'
|
||||||
17
railway.json
17
railway.json
@@ -1,10 +1,13 @@
|
|||||||
{
|
{
|
||||||
"build": "npm install && npm run build",
|
"$schema": "https://railway.com/railway.schema.json",
|
||||||
"start": "npm start",
|
"build": {
|
||||||
"service": {
|
"builder": "NIXPACKS",
|
||||||
"port": 8080,
|
"buildCommand": "npm install && npm run build"
|
||||||
"healthcheck": {
|
},
|
||||||
"path": "/health"
|
"deploy": {
|
||||||
}
|
"startCommand": "npm start",
|
||||||
|
"healthcheckPath": "/health",
|
||||||
|
"healthcheckTimeout": 100,
|
||||||
|
"restartPolicyType": "always"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
17
src/index.ts
17
src/index.ts
@@ -2,19 +2,22 @@ import express from "express";
|
|||||||
import { env } from "./config/env";
|
import { env } from "./config/env";
|
||||||
import { createProxyRouter } from "./routes/proxy";
|
import { createProxyRouter } from "./routes/proxy";
|
||||||
import { serviceClients } from "./lib/httpClient";
|
import { serviceClients } from "./lib/httpClient";
|
||||||
|
import healthRouter from "./routes/health";
|
||||||
|
import infoRouter from "./routes/info";
|
||||||
|
import versionRouter from "./routes/version";
|
||||||
|
import pingRouter from "./routes/v1/ping";
|
||||||
|
|
||||||
const app = express();
|
const app = express();
|
||||||
|
|
||||||
app.use(express.json({ limit: "5mb" }));
|
app.use(express.json({ limit: "5mb" }));
|
||||||
|
|
||||||
app.get("/health", (_req, res) => {
|
// API routes
|
||||||
res.json({ status: "ok" });
|
app.use(healthRouter);
|
||||||
});
|
app.use(infoRouter);
|
||||||
|
app.use(versionRouter);
|
||||||
app.get("/version", (_req, res) => {
|
app.use("/v1", pingRouter);
|
||||||
res.json({ version: env.SERVICE_VERSION });
|
|
||||||
});
|
|
||||||
|
|
||||||
|
// Proxy routes
|
||||||
app.use("/core", createProxyRouter(serviceClients.core));
|
app.use("/core", createProxyRouter(serviceClients.core));
|
||||||
app.use("/agents", createProxyRouter(serviceClients.agents));
|
app.use("/agents", createProxyRouter(serviceClients.agents));
|
||||||
app.use("/operator", createProxyRouter(serviceClients.operator));
|
app.use("/operator", createProxyRouter(serviceClients.operator));
|
||||||
|
|||||||
Reference in New Issue
Block a user