files.brainforge.ai → Railway migration
Status: Migration checklist. Use this when moving files.brainforge.ai from Heroku to Railway.
Context
- Domain:
files.brainforge.ai— serves static assets (PDFs, etc.) from thebrainforge-ai/brainforge-filesGitHub repo at paths like/sales/ai/brainforge_ai_capabilities_deck.pdf. - Previous host: Heroku app
brainforge-files-analytics(dashboard). DNS currently points to Heroku; the app returns 404 “No such app” and TLS fails (tlsv1 unrecognized name), so all links on files.brainforge.ai are broken. - Target host: Railway — same URL scheme, no link changes in platform/marketing.
Root cause (summary)
DNS for files.brainforge.ai still points at Heroku (*.herokudns.com). The Heroku app no longer exists or lost custom domain/cert. Fix: host the file proxy on Railway and point DNS at Railway.
Migration steps (do this now)
1. Deploy the files-proxy service on Railway
The repo includes a minimal proxy app at apps/files-proxy/ that serves paths from brainforge-ai/brainforge-files (GitHub raw).
From repo root, with Railway CLI installed and logged in (railway whoami):
cd apps/files-proxy
railway link # select workspace, project (e.g. brainforge-platform), environment (e.g. production)
railway add # add new service; name it e.g. "files-proxy"
railway service # switch to the files-proxy service-
Root directory (required): In Railway dashboard → files-proxy service → Settings → General → set Root Directory to
apps/files-proxy. If this is not set, the build runs from the repo root and the deployment will fail (build may not start or “Deployment failed during network process”). -
Variables (optional): If
brainforge-filesis private, setGITHUB_TOKEN(orGITHUB_RAW_TOKEN) on the service so the proxy can fetch files. If the repo is public, no token is required for raw.githubusercontent.com. -
Deploy:
railway up --path-as-rootOr from repo root:
railway up apps/files-proxy --path-as-root -
Verify: Open the Railway-generated URL (e.g.
https://files-proxy-production-xxxx.up.railway.app/health) and a test path (e.g./sales/ai/brainforge_ai_capabilities_deck.pdf). Confirm 200 and correct Content-Type.
2. Add custom domain in Railway
In the Railway dashboard (or via CLI):
- Open the files-proxy service → Settings → Networking → Custom Domains.
- Add domain:
files.brainforge.ai. - Railway will show the CNAME target (e.g.
xxxx.up.railway.app). Note it.
CLI alternative:
railway domain files.brainforge.ai --service files-proxy --jsonUse the returned DNS instructions (CNAME record).
3. Update DNS
At your DNS provider (where brainforge.ai is managed):
-
Remove or replace the existing CNAME for
files.brainforge.aithat points to Heroku (e.g.metric-bat-....herokudns.com). -
Add a CNAME record:
- Name/host:
files(orfiles.brainforge.aidepending on provider). - Value/target: The Railway CNAME target from step 2 (e.g.
xxxx.up.railway.app). - TTL: 300–3600 as preferred.
- Name/host:
-
Save and wait for propagation (often 5–30 minutes; can be up to 48 hours).
4. Verify
https://files.brainforge.ai/health→ 200.https://files.brainforge.ai/sales/ai/brainforge_ai_capabilities_deck.pdf→ 200, PDF loads.- Platform Marketing Assets page and any hardcoded
files.brainforge.ailinks should work without code changes.
5. Optional: retire Heroku
After DNS has been pointing at Railway for at least 24–48 hours and all links are verified:
- In Heroku dashboard, remove the custom domain
files.brainforge.aifrom the old app (if the app still exists). - Consider deleting the Heroku app
brainforge-files-analyticsif it is no longer used.
Troubleshooting
- “Deployment failed during network process” or Build not started: Usually (1) Root Directory is not set to
apps/files-proxyin the Railway service settings, or (2) the app crashed on startup (e.g. ensure the app uses ESMimportnotrequirewhenpackage.jsonhas"type": "module"). Check View logs in Railway for the failing deployment. - Health check timeout: The service must respond with 200 at
/healthwithin 30s. If the process exits before that (e.g. uncaught exception), Railway reports a network/deploy failure.
References
- Railway: Custom domains, CLI domain.
- Playbook: Railway CLI setup, Paperclip setup (same pattern: custom domain + CNAME).
- Platform:
apps/platform/src/app/(main)/internal/marketing-assets/page.tsxbuilds URLs ashttps://files.brainforge.ai/${path}; repobrainforge-ai/brainforge-files.