Railway

Deploy Selenium Standalone Firefox | Password-Protected Grid, Pinned 4.46

Password-protected Selenium 4.46 grid, Firefox 152, pinned image

Deploy Selenium Standalone Firefox | Password-Protected Grid, Pinned 4.46

Deploy and Host Selenium Standalone Firefox on Railway

Selenium is the W3C WebDriver stack that drives a real browser from your code. This template deploys Selenium Standalone Firefox 4.46 — router, distributor and browser node in one container — behind an HTTPS URL your tests, scrapers and agents can point at, with the router password-protected.

About Hosting Selenium Standalone Firefox

A Selenium Grid executes whatever the caller asks a browser to do, from inside your project's network. Published on a public URL with no credentials — which is how the stock image ships and how the existing Selenium listings deploy — that is an open remote-execution endpoint for anyone who finds the hostname. This template turns on Grid's built-in router basic auth, generates the password per deploy, and the image refuses to boot if the password is empty, so an open grid is not something you can leave behind by accident.

The rest is Railway-specific plumbing the stock image cannot know about. The router honours Railway's injected $PORT, because Railway's healthcheck dials the injected port and not the domain's target port; a service pinned to 4444 serves 200 to the world while its deploy is failed. Session count is pinned to 2 with override-max-sessions, because nproc inside a container reports the host's cores and Selenium's automatic min(cpus, 8) sizes itself for the metal, oversubscribes your plan and takes browsers down with it. Firefox does not take Chromium's /dev/shm flag, so this image leaves it off — a Firefox node that carries it refuses every session with a driver connection error. Grid's timeouts sit at 300s, inside Railway's ~5-minute edge limit, so a stuck session surfaces as a Selenium error your client can read instead of a bare 502.

The image is pinned to selenium/standalone-firefox:4.46.0-20260707 — Firefox 152. Upstream's :latest moves weekly and carries a new major browser with it, so an unpinned grid does not reproduce last week's test run.

Why Deploy Selenium Standalone Firefox on Railway?

Railway is a singular platform to deploy your infrastructure stack. Railway will host your infrastructure so you don't have to deal with configuration, while allowing you to vertically and horizontally scale it.

By deploying Selenium Standalone Firefox on Railway, you are one step closer to supporting a complete full-stack application with minimal burden. Host your servers, databases, AI agents, and more on Railway.

  • Not an open grid — router basic auth on by default, password generated per deploy, boot refused without one.
  • A browser your CI can reach — GitHub Actions, cron jobs and agents get a stable HTTPS WebDriver endpoint instead of a browser installed per runner.
  • Pinned and reproducible — Firefox 152 on Selenium 4.46.0, not a tag that changes under you.
  • Empty deploy form — every setting that is not yours is baked into the image.

Common Use Cases

  • End-to-end tests from CI — point Playwright-style browser tests or an existing Selenium suite at one hosted grid instead of installing browsers on every runner.
  • Scraping and monitoring JavaScript-rendered pages — render a page the way a user sees it, on a schedule, from a fixed address.
  • AI agents that browse — give an LLM agent a real browser it can drive over WebDriver, isolated in its own Railway project.
  • Screenshot and PDF services — drive a headless browser behind your own small API.

Dependencies for Selenium Standalone Firefox Hosting

  • No database and no volume — sessions are ephemeral by design.
  • 2 GB RAM or more is comfortable for the default two concurrent sessions; raise SE_NODE_MAX_SESSIONS with the plan.

Deployment Dependencies

Implementation Details

Connect any WebDriver client to https://selenium:@/wd/hub:

from selenium import webdriver

options = webdriver.FirefoxOptions()
options.add_argument("--headless")
driver = webdriver.Remote(
    command_executor="https://selenium:PASSWORD@YOUR-DOMAIN.up.railway.app/wd/hub",
    options=options,
)
driver.get("https://example.com")
print(driver.title)
driver.quit()

GET /status returns grid readiness and node capacity (same credentials) — the fastest check that the grid came up. VNC and noVNC are off in this image and are meant to stay off: Railway is not a remote-desktop host, and an exposed noVNC port has no authentication of its own. Debug failing sessions from the deployment logs and from screenshots your driver takes, not from a graphical session.

Variables you may want to change: SE_NODE_MAX_SESSIONS (default 2), SE_NODE_SESSION_TIMEOUT (default 300s), SE_ROUTER_USERNAME (default selenium).


Template Content

More templates in this category

View Template
N8N Main + Worker
Deploy and Host N8N with Inactive worker.

jakemerson
120
View Template
Evolution API with n8n
[Jul'26] WhatsApp automation platform using Evolution API, n8n & PostgreSQL

codestorm
66
View Template
Postgres Backup
Cron-based PostgreSQL backup to bucket storage

Railway Templates
869