Skip to content

Commit 5da85ec

Browse files
committed
fix: force wrapper port 8080 on Railway
1 parent a01cd4a commit 5da85ec

2 files changed

Lines changed: 7 additions & 2 deletions

File tree

Dockerfile

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,8 @@ RUN printf '%s\n' '#!/usr/bin/env bash' 'exec node /clawdbot/dist/entry.js "$@"'
6262

6363
COPY src ./src
6464

65+
# The wrapper listens on this port.
66+
ENV CLAWDBOT_PUBLIC_PORT=8080
6567
ENV PORT=8080
6668
EXPOSE 8080
6769
CMD ["node", "src/server.js"]

src/server.js

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,11 @@ import express from "express";
88
import httpProxy from "http-proxy";
99
import * as tar from "tar";
1010

11-
// Railway commonly sets PORT=8080 for HTTP services.
12-
const PORT = Number.parseInt(process.env.PORT ?? "8080", 10);
11+
// Railway deployments sometimes inject PORT=3000 by default. We want the wrapper to
12+
// reliably listen on 8080 unless explicitly overridden.
13+
//
14+
// Prefer CLAWDBOT_PUBLIC_PORT (set in the Dockerfile / template) over PORT.
15+
const PORT = Number.parseInt(process.env.CLAWDBOT_PUBLIC_PORT ?? process.env.PORT ?? "8080", 10);
1316
const STATE_DIR = process.env.CLAWDBOT_STATE_DIR?.trim() || path.join(os.homedir(), ".clawdbot");
1417
const WORKSPACE_DIR = process.env.CLAWDBOT_WORKSPACE_DIR?.trim() || path.join(STATE_DIR, "workspace");
1518

0 commit comments

Comments
 (0)