---
title: "Deploy Opencode Server v2"
description: "Opencode fully featured server for AI Agents. Web, Server, and CLI mode."
category: "AI/ML"
url: https://railway.com/deploy/opencode-server
---

# Deploy Opencode Server v2

Opencode fully featured server for AI Agents. Web, Server, and CLI mode.

**[Deploy Opencode Server v2 on Railway](https://railway.com/template/opencode-server)**

Machine-readable deploy manifest (JSON, validated by TemplateCI): https://railway.com/deploy/opencode-server/manifest.json

- **Creator:** Sprisa Inc
- **Category:** AI/ML
- **Total deploys:** 36

## Template content

### Opencode Server https://pub-6fb5f1860061469da0fd642d6d3a2bbd.r2.dev/opencodelogo2.png

- **Image:** sprisa/opencode:latest
- **Health check:** /site.webmanifest
- **Public domain:** Yes

## Documentation

# Deploy and Host Opencode Server on Railway

Host your own cloud opencode sandbox.   
Ubuntu based minimal Opencode Server deployment. Supports web desktop &amp; 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 `opencode` and default password is `changeme`. 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 `opencode` user has passwordless sudo, so you can `su - opencode -c 'apt install '` inside the container.
- The root filesystem is ephemeral; mount `/home/opencode` as the persistent volume for all user data (dotfiles, config, projects). The `~/workspace` subdirectory is the default workdir.
- `~/.local/bin` is 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/zb` with its prefix at `~/.local/share/zerobrew/prefix` on 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.toml` to 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.


## Similar templates

- [Chat Chat](https://railway.com/deploy/-WWW5r) — Chat Chat, your own unified chat and search to AI platform.
- [Weaviate](https://railway.com/deploy/weaviate-1) — Vector database with hybrid search and an API key-protected API
- [Möbius v0.1 Personal AI OS](https://railway.com/deploy/mobius-v01-personal-ai-os) — Self-hosted AI agent that builds and runs apps for you, with memory.

Open this page in a browser: https://railway.com/deploy/opencode-server
