Add Railway deployment configuration (#651)

* Add Railway deployment configuration

* docs: add Railway deployment instructions to README

- Add Railway section under Docker/Fly.io in setup docs
- Add Railway secrets command in cookie import section
- Mention Railway in 'Deploy Anywhere' feature list
- Add Railway to PORT env var description

---------

Co-authored-by: Pradeep Elankumaran <pradeepe@gmail.com>
This commit is contained in:
vvx1srising
2026-04-28 10:18:55 -07:00
committed by GitHub
co-authored by Pradeep Elankumaran
parent c9ea6f86b1
commit 2b981ec496
2 changed files with 33 additions and 3 deletions
+23 -3
View File
@@ -53,7 +53,7 @@ This project wraps that engine in a REST API built for agents: accessibility sna
- **Large Page Handling** - automatic snapshot truncation with offset-based pagination
- **Download Capture** - capture browser downloads and fetch them via API (optional inline base64)
- **DOM Image Extraction** - list `<img>` src/alt and optionally return inline data URLs
- **Deploy Anywhere** - Docker, Fly.io
- **Deploy Anywhere** - Docker, Fly.io, Railway
- **VNC Interactive Login** - log into sites visually via noVNC, export storage state for agent reuse
- **OpenAPI Docs** - auto-generated spec at [`/openapi.json`](http://localhost:9377/openapi.json) and interactive docs at [`/docs`](http://localhost:9377/docs)
- **Structured Extract** - `POST /tabs/:tabId/extract` with a JSON Schema that maps properties to snapshot refs via `x-ref`
@@ -117,6 +117,21 @@ make up VERSION=135.0.1 RELEASE=beta.24
For Fly.io or other remote CI, you'll need a Dockerfile that downloads binaries at build time instead of using bind mounts.
### Railway
A `railway.toml` is included. It uses `Dockerfile.ci` (which downloads binaries at build time) and maps Railway's `PORT` env var to `CAMOFOX_PORT` automatically.
```bash
# Install Railway CLI, then:
railway link
railway up
```
Set secrets via the Railway dashboard or CLI:
```bash
railway variables set CAMOFOX_API_KEY="your-generated-key"
```
## Usage
### Cookie Import
@@ -252,7 +267,7 @@ curl -X POST http://localhost:9377/sessions/agent1/cookies \
-d '{"cookies":[{"name":"foo","value":"bar","domain":"example.com","path":"/","expires":-1,"httpOnly":false,"secure":false}]}'
```
#### Docker / Fly.io
#### Docker / Fly.io / Railway
```bash
docker run -p 9377:9377 \
@@ -266,6 +281,11 @@ For Fly.io:
fly secrets set CAMOFOX_API_KEY="your-generated-key"
```
For Railway:
```bash
railway variables set CAMOFOX_API_KEY="your-generated-key"
```
### Proxy + GeoIP
Route all browser traffic through a proxy with automatic locale, timezone, and geolocation derived from the proxy's IP address via Camoufox's built-in GeoIP.
@@ -480,7 +500,7 @@ Reddit macros return JSON directly (no HTML parsing needed):
| Variable | Description | Default |
|----------|-------------|---------|
| `CAMOFOX_PORT` | Server port | `9377` |
| `PORT` | Server port (fallback, for platforms like Fly.io) | `9377` |
| `PORT` | Server port (fallback, for platforms like Fly.io, Railway) | `9377` |
| `CAMOFOX_API_KEY` | Enable cookie import endpoint (disabled if unset) | - |
| `CAMOFOX_ADMIN_KEY` | Required for `POST /stop` | - |
| `CAMOFOX_ACCESS_KEY` | If set, all routes (except `/health`, cookie import, and `/stop`) require `Authorization: Bearer <key>`. Lets you safely expose the server beyond loopback. | - |
+10
View File
@@ -0,0 +1,10 @@
[build]
builder = "DOCKERFILE"
dockerfilePath = "Dockerfile.ci"
[deploy]
startCommand = "sh -c 'CAMOFOX_PORT=${PORT:-9377} node --max-old-space-size=${MAX_OLD_SPACE_SIZE:-128} server.js'"
healthcheckPath = "/health"
healthcheckTimeout = 120
restartPolicyType = "ON_FAILURE"
restartPolicyMaxRetries = 10