Merge branch origin/copilot/ensure-railway-connection into main

This commit is contained in:
Alexa Amundson
2025-11-21 13:54:01 -06:00
3 changed files with 29 additions and 3 deletions

View File

@@ -13,6 +13,7 @@ Public API gateway for the BlackRoad Operating System. This service fronts the p
- `GET /info` Service metadata including base URL, OS root, and version. - `GET /info` Service metadata including base URL, OS root, and version.
- `GET /version` Service id and version from `package.json`. - `GET /version` Service id and version from `package.json`.
- `GET /debug/env` Safe subset of environment configuration. - `GET /debug/env` Safe subset of environment configuration.
- `GET /v1/health` Versioned health check endpoint.
- `GET /v1/ping` Versioned ping endpoint for API consumers. - `GET /v1/ping` Versioned ping endpoint for API consumers.
## Getting Started ## Getting Started
@@ -45,11 +46,20 @@ See `.env.example` for defaults:
- `PORT` Port to bind (default `8080`) - `PORT` Port to bind (default `8080`)
## Railway Deployment ## Railway Deployment
`railway.json` is configured for deployment: The repository is configured for Railway deployment using the modern 2024 format:
**Configuration Files:**
- `railway.json` - Railway deployment configuration with schema validation
- `nixpacks.toml` - Explicit build configuration for Node.js 20
**Deployment Settings:**
- Builder: Nixpacks
- Build: `npm install && npm run build` - Build: `npm install && npm run build`
- Start: `npm start` - Start: `npm start`
- Port: `8080` - Healthcheck: `/health` (timeout: 100s)
- Healthcheck: `/health` - Restart Policy: Always
The service will automatically deploy to Railway when changes are pushed to the configured branches (dev, staging, main).
## Testing ## Testing
Run the test suite with: Run the test suite with:

View File

@@ -6,6 +6,7 @@ import healthRouter from "./routes/health";
import infoRouter from "./routes/info"; import infoRouter from "./routes/info";
import versionRouter from "./routes/version"; import versionRouter from "./routes/version";
import pingRouter from "./routes/v1/ping"; import pingRouter from "./routes/v1/ping";
import v1HealthRouter from "./routes/v1/health";
const app = express(); const app = express();
@@ -16,6 +17,7 @@ app.use(healthRouter);
app.use(infoRouter); app.use(infoRouter);
app.use(versionRouter); app.use(versionRouter);
app.use("/v1", pingRouter); app.use("/v1", pingRouter);
app.use("/v1", v1HealthRouter);
// Proxy routes // Proxy routes
app.use("/core", createProxyRouter(serviceClients.core)); app.use("/core", createProxyRouter(serviceClients.core));

14
src/routes/v1/health.ts Normal file
View File

@@ -0,0 +1,14 @@
import { Router, Request, Response } from "express";
import { SERVICE_ID } from "../../config/serviceConfig";
const router = Router();
router.get("/health", (req: Request, res: Response) => {
res.json({
ok: true,
service: SERVICE_ID,
ts: new Date().toISOString(),
});
});
export default router;