Platform setup
How to Deploy OpenClaw on Northflank
Browse more in Platform setup.
All platform setup guides →This guide walks you through how to deploy OpenClaw on Northflank using the existing Railway-based template and configuration as a reference. You’ll set up the gateway, persistent storage, and networking so you can reach the Control UI over HTTPS.
By the end, you’ll have a hosted OpenClaw Gateway + Control UI with state and workspace surviving redeploys.
Prerequisites
- ✓A Northflank account with permission to create services and volumes.
- ✓Access to the OpenClaw Railway template at https://railway.com/deploy/clawdbot-railway-template so you can mirror its settings on Northflank.
- ✓A domain or the ability to use Northflank’s generated HTTPS domain to reach the Control UI.
- ✓At least one messaging channel you plan to connect later (for example Telegram or Discord), as described under Channels in the OpenClaw docs.
Steps
- 1
Review what the Railway template gives you
Before you mirror this on Northflank, understand what the Railway template configures: a hosted OpenClaw Gateway + Control UI with persistent storage. You will recreate the same pieces on Northflank: HTTP networking on port 8080, a volume at /data, and the required environment variables.
textDeploy OpenClaw on Railway with a one-click template and access it through the web Control UI. This is the easiest “no terminal on the server” path: Railway runs the Gateway for you. - 2
Create a Northflank service that listens on port 8080
On Northflank, create a service that runs the OpenClaw container and exposes port 8080, matching the Railway configuration. This matters because the gateway listens on the port you later set in OPENCLAW_GATEWAY_PORT, and your HTTP proxy must forward to the same port.
textEnable **HTTP Proxy** for the service. * Port: `8080` - 3
Attach a persistent volume mounted at /data
Configure a Northflank volume and mount it at /data in the container, mirroring the Railway setup. OpenClaw uses this path to store its state, auth profiles, and workspace so your configuration survives restarts and redeploys.
textAttach a volume mounted at: * `/data` - 4
Set the required OpenClaw environment variables
Add the OpenClaw variables to your Northflank service so the gateway knows which port to bind to, what admin token to require, and where to store state and workspace. The token acts as your shared secret for the Control UI, so treat it like an admin password.
textSet these variables on the service: * `OPENCLAW_GATEWAY_PORT=8080` (required — must match the port in Public Networking) * `OPENCLAW_GATEWAY_TOKEN` (required; treat as an admin secret) * `OPENCLAW_STATE_DIR=/data/.openclaw` (recommended) * `OPENCLAW_WORKSPACE_DIR=/data/workspace` (recommended) - 5
Expose the Control UI over HTTPS
Once the service is running, configure Northflank routing so your public domain points to the service on port 8080. You will then access the Control UI at the /openclaw path using the shared secret from OPENCLAW_GATEWAY_TOKEN.
textThen open: * `https://<your-railway-domain>/openclaw` — Control UI - 6
Connect a messaging channel from the Control UI or shell
After the gateway is reachable, use the Control UI at /openclaw or a shell inside the container to run onboarding. This is where you wire up Telegram, Discord, or other channels so OpenClaw can talk to real users.
textUse the Control UI at `/openclaw` or run `openclaw onboard` via Railway’s shell for channel setup instructions: * [Telegram](https://docs.openclaw.ai/channels/telegram) (fastest — just a bot token) * [Discord](https://docs.openclaw.ai/channels/discord) * [All channels](https://docs.openclaw.ai/channels) - 7
Create a backup of your OpenClaw state
Once your Northflank deployment is configured, create a backup so you can migrate or restore later. Run the backup command inside the container; it packages state, config, auth profiles, and workspace into a portable archive.
bashopenclaw backup create
Configuration
| Option | Description | Example |
|---|---|---|
| OPENCLAW_GATEWAY_PORT | Port the OpenClaw Gateway listens on; it must match the port exposed by your Northflank HTTP routing. | 8080 |
| OPENCLAW_GATEWAY_TOKEN | Shared admin secret used to authenticate to the Control UI and gateway. | nf-prod-gateway-token-123 |
| OPENCLAW_STATE_DIR | Directory where OpenClaw stores its internal state so it survives redeploys. | /data/.openclaw |
| OPENCLAW_WORKSPACE_DIR | Directory where OpenClaw stores workspace files that should persist across deployments. | /data/workspace |
Troubleshooting
You open your Northflank URL but the Control UI at /openclaw does not load.
This usually means the service is not exposed on the same port OpenClaw is listening on. Make sure your HTTP routing forwards to port 8080 and that `OPENCLAW_GATEWAY_PORT=8080` is set so the gateway binds to that port.
OPENCLAW_GATEWAY_PORT=8080You reach /openclaw but cannot authenticate with the token you expect.
The Control UI uses the value of `OPENCLAW_GATEWAY_TOKEN` as the shared secret by default. Double-check that this variable is set on the Northflank service and that you are entering the exact same value when prompted.
OPENCLAW_GATEWAY_TOKENYour agents lose configuration or sessions after redeploying the Northflank service.
OpenClaw needs a persistent volume mounted at `/data` and the state/workspace directories pointing into that volume. openclaw` and `OPENCLAW_WORKSPACE_DIR=/data/workspace` are set so state survives redeploys.
Attach a volume mounted at:
* `/data`Frequently asked questions
Powered by Mem0
Add persistent memory to OpenClaw
Official Mem0 plugin for OpenClaw keeps context across chats and tools. Smaller prompts, lower cost, better continuity for your agents.