
Deploy Opencode Server
Opencode fully featured server for AI Agents. Web, Server, and CLI mode.
Opencode Server
Just deployed
/home/opencode
Deploy and Host Opencode Server on Railway
Host your own cloud opencode sandbox.
Ubuntu based minimal Opencode Server deployment. Supports web desktop & server mode with 10+ tools out of the box.
https://github.com/sprisa/opencode-server
Connect via Web or CLI
Web
Go to the Railway web address. This will be auto generated. e.g. https://opencode.up.railway.app
Use user opencode + your password (default password is changeme)
CLI
Attach using the opencode attach command on your local computer. Use your Railway instance url and password.
e.g. opencode attach https://opencode.up.railway.app --password changeme
About Hosting Opencode Server
Fully featured image for running Opencode agent machines in a Docker or Kubernetes environment. The agent can install it's own tools on demand with mise.
- Default user is
opencodeand default password ischangeme. Be sure to change these values! - Recommended Options
- Create 1 machine / template per user.
- Enable CDN caching for faster load times.
- Enable serverless for sleeping when not in use (cost savings)
Common Use Cases
- Your own opencode sandbox
- Run your agents 24/7
- Isolated machine
- Auto stop and persistent volume support
Dependencies for Opencode Server Hosting
0.3 cpu / 2GiB ram minimal .
2 cpu / 4GiB ram recommend.
Deployment Dependencies
None.
Implementation Details
What's inside
| Layer | Details |
|---|---|
| Base OS | ubuntu:26.04 |
| User | opencode (uid/gid 1000), passwordless sudo |
| opencode | Pinned in version.txt as OPENCODE_VERSION build arg |
| Lazy Installed Tools | Node, Python3 (see below) |
| Homebrew | Linux-native Homebrew (/home/linuxbrew/.linuxbrew) — brew on PATH |
| zerobrew | Faster Homebrew alternative (zb on PATH) -- used as mise backend for lazy-installed tools |
| mise | Dev tool manager — tools listed below install on first use via zerobrew backend |
| CLI utilities | git, curl, less, unzip |
| Init | tini as PID 1 (zombie reaping, clean shutdown) |
Lazy-installed tools
These tools install on first use (via mise → github/zerobrew):
| Tool | Command | Backend |
|---|---|---|
| GitHub CLI | gh | github |
| jq | jq | github |
| GitLab CLI | glab | zerobrew |
| Ruby | ruby | zerobrew |
| ripgrep | rg | github |
| fd | fd | github |
| Wget | wget | zerobrew |
| Vim | vim | zerobrew |
| Micro | micro | github |
| Nano | nano | zerobrew |
| Python 3 | python3 | zerobrew |
| Node.js | node | core |
| Sapling | sl | github |
The image ships with a system config at /etc/mise/config.toml with these pre-approved tools. Users can add or override tools by creating ~/.config/mise/config.toml — mise merges both.
Runtime notes
- The
opencodeuser has passwordless sudo, so you cansu - opencode -c 'apt install 'inside the container. - The root filesystem is ephemeral; mount
/home/opencodeas the persistent volume for all user data (dotfiles, config, projects). The~/workspacesubdirectory is the default workdir. ~/.local/binis on PATH and user-writable, useful for dropping custom tools at runtime.- Node version can be switched at runtime with
n(e.g.n lts). - Homebrew is installed under
/home/linuxbrew/.linuxbrew(outside the persistent volume). It uses its bundled portable Ruby — no system Ruby needed. - Zerobrew (
zb) is installed at/usr/local/bin/zbwith its prefix at~/.local/share/zerobrew/prefixon PATH for accessing formula binaries. - Lazy-installed tools (see table above): run any listed tool and mise auto-installs it via zerobrew or github backend on first use. The image ships defaults in
/etc/mise/config.toml; create~/.config/mise/config.tomlto add your own — mise merges both.
Why Deploy Opencode Server 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 Opencode Server 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
Opencode Server
sprisa/opencode:latest