
Deploy EMQX | (Just Updated) MQTT Broker for IoT, Dashboard Included, Data Survives Redeploys
MQTT broker for IoT. Dashboard on, data on a volume, public MQTT port
emqx
Just deployed
/opt/emqx/data
Deploy and Host EMQX on Railway
EMQX is an open-source MQTT broker built for IoT fleets, telemetry pipelines and messaging between devices and backends. It speaks MQTT 3.1.1 and 5.0, scales to millions of connections, and ships a web dashboard for clients, subscriptions, topics and rule-engine data flows.
This template runs EMQX 6.1.5 as a single service from a digest-pinned official image: the broker on a TCP proxy for MQTT clients, the dashboard on an HTTPS domain, and the node's data on a Railway volume.
About Hosting EMQX
EMQX needs a few things handled before it runs well on Railway:
- The dashboard is locked behind a generated password. The admin password is random per deploy, so the well-known default login is never live on a public URL.
- The volume is writable. Railway mounts volumes owned by root while the stock image runs as an unprivileged user, which makes the broker crash-loop on its data directory. The start command fixes ownership on every boot and logs the owner and writability it found.
- The Erlang VM is sized to your container. EMQX schedules work across as many threads as the host reports, not as many as your plan has. The start command reads the container's CPU limit and caps the schedulers to it.
- MQTT is reachable from outside Railway. A TCP proxy exposes port 1883, and a ready-made connection URL is provided for it, plus a private URL for services in the same project.
- Data survives redeploys. Configuration, users and retained data live on the attached volume, and the node keeps a stable name so its data directory is found again on every boot.
Common Use Cases
- IoT device telemetry and command channels (sensors, trackers, smart-home gear)
- Message bus between backend services using MQTT topics and shared subscriptions
- Bridging device data into databases, Kafka or webhooks through the rule engine
- Real-time notifications to browsers and mobile apps over MQTT
Dependencies for EMQX Hosting
- One Railway volume for the node data (created by the template)
- A TCP proxy for MQTT clients outside Railway (created by the template)
Deployment Dependencies
- EMQX documentation: https://docs.emqx.com/en/emqx/latest/
- Official image: https://hub.docker.com/r/emqx/emqx
Implementation Details
| Variable | Purpose |
|---|---|
EMQX_DASHBOARD__DEFAULT_PASSWORD | Dashboard admin password, generated per deploy. The username is admin. |
EMQX_MQTT_URL | Ready-made mqtt:// URL over the TCP proxy, for clients outside Railway. |
EMQX_MQTT_PRIVATE_URL | Ready-made mqtt:// URL over the private network, for services in the same project. |
EMQX_DASHBOARD_URL | HTTPS address of the dashboard. |
Reference it from another service with ${{emqx.EMQX_MQTT_PRIVATE_URL}}. Change the dashboard password from the
dashboard after first login if you want one you can remember.
Why Deploy EMQX 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 EMQX 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.
Template Content
emqx
emqx/emqx:6.1.5