attempt deploy
This commit is contained in:
@@ -20,6 +20,7 @@ FROM base as builder
|
|||||||
# Include all NEXT_PUBLIC_* env vars here
|
# Include all NEXT_PUBLIC_* env vars here
|
||||||
ARG NEXT_PUBLIC_POSTHOG_KEY
|
ARG NEXT_PUBLIC_POSTHOG_KEY
|
||||||
ARG NEXT_PUBLIC_IS_PUBLIC_PLAYGROUND
|
ARG NEXT_PUBLIC_IS_PUBLIC_PLAYGROUND
|
||||||
|
ARG NEXT_PUBLIC_SOCKET_URL
|
||||||
|
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
COPY --from=deps /app/node_modules ./node_modules
|
COPY --from=deps /app/node_modules ./node_modules
|
||||||
|
|||||||
15
render.yaml
15
render.yaml
@@ -19,3 +19,18 @@ services:
|
|||||||
name: prompt-lab-prod
|
name: prompt-lab-prod
|
||||||
property: connectionString
|
property: connectionString
|
||||||
- fromGroup: prompt-lab-prod
|
- fromGroup: prompt-lab-prod
|
||||||
|
- key: NEXT_PUBLIC_SOCKET_URL
|
||||||
|
value: https://prompt-lab-prod-wss.onrender.com
|
||||||
|
# Render support says we need to manually set this because otherwise
|
||||||
|
# sometimes it checks a different random port that NextJS opens for
|
||||||
|
# liveness and the liveness check fails.
|
||||||
|
- key: PORT
|
||||||
|
value: 10000
|
||||||
|
|
||||||
|
- type: web
|
||||||
|
name: prompt-lab-prod-wss
|
||||||
|
env: docker
|
||||||
|
dockerfilePath: Dockerfile
|
||||||
|
dockerContext: .
|
||||||
|
plan: free
|
||||||
|
dockerCommand: pnpm tsx src/wss-server.ts
|
||||||
|
|||||||
@@ -2,11 +2,9 @@ import "dotenv/config";
|
|||||||
import express from "express";
|
import express from "express";
|
||||||
import { createServer } from "http";
|
import { createServer } from "http";
|
||||||
import { Server } from "socket.io";
|
import { Server } from "socket.io";
|
||||||
import { env } from "./env.mjs";
|
|
||||||
import cors from "cors";
|
import cors from "cors";
|
||||||
|
|
||||||
// Get the port from SOCKET_URL
|
const port = process.env.NEXT_PUBLIC_SOCKET_URL?.split(":")?.[2] ?? process.env.PORT ?? 3318;
|
||||||
const port = env.NEXT_PUBLIC_SOCKET_URL?.split(":")[2] || 3318;
|
|
||||||
|
|
||||||
const app = express();
|
const app = express();
|
||||||
app.use(cors());
|
app.use(cors());
|
||||||
@@ -26,7 +24,7 @@ io.on("connection", (socket) => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
// When a 'message' event is received, emit it to the room specified
|
// When a 'message' event is received, emit it to the room specified
|
||||||
socket.on("message", (msg: { channel: string; payload: any }) => {
|
socket.on("message", (msg: { channel: string; payload: unknown }) => {
|
||||||
socket.to(msg.channel).emit("message", msg.payload);
|
socket.to(msg.channel).emit("message", msg.payload);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user