Build & Deploy / build-and-push (backend) (push) Failing after 35s
Build & Deploy / build-and-push (discord-gateway) (push) Failing after 25s
Build & Deploy / build-and-push (proxy) (push) Failing after 25s
- Remove pnpm workspace, moon repo, and all monorepo tooling - Delete packages/shared/, embed shared code directly into each service - Copy packages/shared/src/* -> services/backend/src/shared/ and services/discord-gateway/src/shared/ - Replace all @bete/shared imports with @/shared/ path alias - Remove @bete/shared workspace dependency from both services - Update root package.json scripts from --filter to --prefix - Rewrite Dockerfiles to build each service standalone - Clean up biome.json, .gitignore, remove root drizzle.config.ts
37 lines
1.1 KiB
TypeScript
37 lines
1.1 KiB
TypeScript
import { createServer, type Server } from "node:http";
|
|
import { createChildLogger } from "@/shared/logger/index";
|
|
import { config } from "../shared/config/index.js";
|
|
import { initializeDatabase } from "../shared/database/index.js";
|
|
import { startRedisBridge } from "../ws/redis-bridge.js";
|
|
import { createWebSocketServer } from "../ws/server.js";
|
|
import { createHttpApp } from "./app.js";
|
|
|
|
const logger = createChildLogger("http.server");
|
|
|
|
export async function startHttpServer(): Promise<Server> {
|
|
await initializeDatabase();
|
|
|
|
const app = createHttpApp();
|
|
const port = config.WEBSERVER_PORT;
|
|
|
|
const server = createServer(app);
|
|
|
|
// Attach WebSocket server to the same HTTP server
|
|
createWebSocketServer(server);
|
|
|
|
// Start Redis pub/sub bridge to forward discord-gateway events to WS clients
|
|
await startRedisBridge();
|
|
|
|
return new Promise<Server>((resolve, reject) => {
|
|
server.listen(port, () => {
|
|
logger.info({ port }, "HTTP server started");
|
|
resolve(server);
|
|
});
|
|
|
|
server.on("error", (err) => {
|
|
logger.error({ err }, "HTTP server error");
|
|
reject(err);
|
|
});
|
|
});
|
|
}
|