Skip to content

Commit 0385cd3

Browse files
fix: Simplify Railway build to prevent cache conflicts
1 parent c379cbe commit 0385cd3

File tree

6 files changed

+37
-31
lines changed

6 files changed

+37
-31
lines changed

.npmrc

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,5 @@
22
cache=/tmp/.npm
33
prefer-offline=false
44
audit=false
5-
fund=false
5+
fund=false
6+
legacy-peer-deps=true

nixpacks.toml

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,25 @@
11
# Nixpacks configuration for Railway deployment
2-
# This configures the build environment without Puppeteer/Chromium
2+
# Fixed to prevent node_modules cache conflicts
33

44
[phases.setup]
55
nixPkgs = ["nodejs_20", "npm-10_x"]
66

77
[phases.install]
8+
# Single install phase - no duplicate copying
89
cmds = [
9-
"rm -rf node_modules/.cache node_modules",
10-
"npm ci"
10+
"npm ci --legacy-peer-deps"
1111
]
12-
cacheDirectories = []
1312

1413
[phases.build]
1514
dependsOn = ["install"]
16-
cmds = ["npm run build"]
15+
cmds = [
16+
"rm -rf node_modules/.cache",
17+
"npm run build"
18+
]
1719

1820
[start]
1921
cmd = "node dist/servers/railway/minimal.js"
2022

2123
[variables]
22-
NODE_ENV = "production"
24+
NODE_ENV = "production"
25+
PUPPETEER_SKIP_DOWNLOAD = "true"

package-lock.json

Lines changed: 20 additions & 20 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@
116116
"ngrok": "^5.0.0-beta.2",
117117
"open": "^11.0.0",
118118
"ora": "^9.0.0",
119-
"pg": "^8.16.3",
119+
"pg": "^8.17.1",
120120
"puppeteer": "^24.34.0",
121121
"rate-limiter-flexible": "^9.0.1",
122122
"redis": "^5.10.0",

railway.toml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
11
[build]
22
builder = "nixpacks"
3-
buildCommand = "rm -rf node_modules/.cache node_modules && npm ci && npm run build"
43

54
[deploy]
65
startCommand = "node dist/servers/railway/minimal.js"
76
healthcheckPath = "/api/health"
8-
restartPolicyType = "on-failure"
7+
restartPolicyType = "on_failure"
98
restartPolicyMaxRetries = 3

scripts/sync-frames-from-railway.js

100644100755
Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,10 @@ import { homedir } from 'os';
99
const { Client } = pg;
1010

1111
// Railway PostgreSQL connection
12-
const RAILWAY_DATABASE_URL = 'postgresql://postgres:YTSFXqPzFhghOcefgwPvJyWOBTYHbYxd@postgres.railway.internal:5432/railway';
12+
// Use environment variable or fallback to internal URL
13+
const RAILWAY_DATABASE_URL = process.env.RAILWAY_DATABASE_URL ||
14+
process.env.DATABASE_URL ||
15+
'postgresql://postgres:YTSFXqPzFhghOcefgwPvJyWOBTYHbYxd@postgres.railway.internal:5432/railway';
1316

1417
// Local SQLite database path
1518
const dbPath = join(homedir(), '.stackmemory', 'context.db');

0 commit comments

Comments
 (0)