mirror of
https://github.com/coder/code-server.git
synced 2026-02-19 18:01:15 +08:00
Fixed railway setup
This commit is contained in:
parent
1266e7d531
commit
c2d4bffccd
@ -29,7 +29,7 @@ Step-by-step guide to configure the Claude Code Server Railway template.
|
||||
| Variable | Type | Description |
|
||||
|----------|------|-------------|
|
||||
| `PASSWORD` | **Secret** | Login password for code-server |
|
||||
| `CLAUDER_HOME` | **Path** | Volume mount path — use `/home/coder` for existing deployments |
|
||||
| `CLAUDER_HOME` | **Path** | Volume mount path (default: `/home/clauder`) |
|
||||
|
||||
> ⚠️ **CRITICAL**: `CLAUDER_HOME` MUST match your volume mount path!
|
||||
|
||||
@ -40,25 +40,6 @@ Step-by-step guide to configure the Claude Code Server Railway template.
|
||||
| `CLAUDER_UID` | `1000` | User ID |
|
||||
| `CLAUDER_GID` | `1000` | Group ID |
|
||||
| `RUN_AS_USER` | `clauder` | Set to `root` if you need root access |
|
||||
|
||||
### Pre-Install AI CLIs (default: 0)
|
||||
|
||||
| Variable | Description |
|
||||
|----------|-------------|
|
||||
| `INSTALL_OPENCODE` | Install OpenCode |
|
||||
| `INSTALL_GEMINI` | Install Gemini CLI |
|
||||
| `INSTALL_KILOCODE` | Install KiloCode CLI |
|
||||
| `INSTALL_CONTINUE` | Install Continue CLI |
|
||||
| `INSTALL_CODEX` | Install Codex CLI |
|
||||
|
||||
### Pre-Install Dev Frameworks (default: 0)
|
||||
|
||||
| Variable | Description |
|
||||
|----------|-------------|
|
||||
| `INSTALL_BMAD` | Install BMAD Method |
|
||||
| `INSTALL_OPENSPEC` | Install OpenSpec |
|
||||
| `INSTALL_SPECKIT` | Install Spec-Kit |
|
||||
|
||||
---
|
||||
|
||||
## Step 3: Volume Configuration (REQUIRED)
|
||||
@ -128,7 +109,7 @@ These are pre-configured in `railway.toml`:
|
||||
> - ⚡ **Instant Setup** – Deploy in 60 seconds
|
||||
> - 💾 **Persistent** – Extensions & auth survive redeploys
|
||||
> - 🛡️ **Non-root** – Runs as `clauder` user for security
|
||||
> - 🧠 **AI-Ready** – Optional: Gemini, OpenCode, Continue, Codex
|
||||
> - 🧠 **Claude Code** – AI coding assistant built-in
|
||||
>
|
||||
> Perfect for vibe coding, weekend hacks, and shipping fast.
|
||||
|
||||
@ -138,8 +119,7 @@ These are pre-configured in `railway.toml`:
|
||||
|
||||
| Old (code-server) | New (Claude Code Server) |
|
||||
|-------------------|--------------------------|
|
||||
| Generic VS Code | Claude Code + AI CLIs |
|
||||
| Generic VS Code | VS Code + Claude Code |
|
||||
| `coder` user | `clauder` user |
|
||||
| No AI tools | 5 optional AI CLIs |
|
||||
| No frameworks | BMAD, OpenSpec, Spec-Kit |
|
||||
| No AI tools | Claude Code pre-installed |
|
||||
| Basic docs | Auth + region guidance |
|
||||
|
||||
124
README.md
124
README.md
@ -1,106 +1,82 @@
|
||||
# VSCode Cloud IDE
|
||||
# Deploy and Host Claude Code Server on Railway
|
||||
|
||||
**Browser-based VSCode with Claude Code & Node.js**
|
||||
<p align="center">
|
||||
<img src="https://raw.githubusercontent.com/sphinxcode/claude-code-server/main/public/claude-code-server-logo.svg" alt="Claude Code Server Logo" width="120" height="120">
|
||||
</p>
|
||||
|
||||
[](https://railway.com/deploy/pHwM6f?referralCode=1uw5HI&utm_medium=integration&utm_source=template&utm_campaign=generic)
|
||||
<p align="center">
|
||||
<strong>Browser-based VS Code with Claude Code pre-installed. YOLO mode ready.</strong>
|
||||
</p>
|
||||
|
||||
Cloud IDE with persistent extensions, settings, and tools. Runs as non-root user.
|
||||
<p align="center">
|
||||
<a href="https://railway.com/deploy/pHwM6f?referralCode=1uw5HI&utm_medium=integration&utm_source=template&utm_campaign=generic">
|
||||
<img src="https://railway.com/button.svg" alt="Deploy on Railway">
|
||||
</a>
|
||||
</p>
|
||||
|
||||
---
|
||||
|
||||
## Features
|
||||
Claude Code Server is a cloud-based VS Code environment with Claude Code CLI pre-installed. Deploy in 60 seconds and start AI-assisted coding directly in your browser. Runs as non-root `clauder` user with persistent storage for extensions, authentication, and workspace files.
|
||||
|
||||
- **Claude Code** & **Node.js 20** pre-installed
|
||||
- **Non-root execution** - runs as `clauder` user (UID 1000)
|
||||
- Extensions persist across redeployments
|
||||
- Volume permissions auto-fixed on startup
|
||||
## About Hosting Claude Code Server
|
||||
|
||||
---
|
||||
Hosting Claude Code Server on Railway provides a fully configured development environment accessible from any browser. The template handles user permissions, volume persistence, and Claude Code installation automatically. On first deploy, set your `PASSWORD` environment variable and attach a volume to `/home/clauder`. The entrypoint script manages permission fixes, user switching via `gosu`, and shell configuration. Your Claude authentication tokens, VS Code extensions, and workspace files persist across redeploys via the mounted volume.
|
||||
|
||||
## Quick Start
|
||||
## Common Use Cases
|
||||
|
||||
- **Remote AI-assisted development** – Code with Claude from any device with a browser
|
||||
- **Ephemeral dev environments** – Spin up isolated workspaces for experiments or client projects
|
||||
- **Team onboarding** – Pre-configured environments for new developers with tools ready to go
|
||||
- **CI/CD integration** – Use as a hosted development server for automated workflows
|
||||
|
||||
## Dependencies for Claude Code Server Hosting
|
||||
|
||||
- **Railway account** – Free tier available
|
||||
- **Anthropic API access** – For Claude Code authentication
|
||||
|
||||
### Deployment Dependencies
|
||||
|
||||
- [code-server](https://github.com/coder/code-server) – VS Code in the browser by Coder
|
||||
- [Claude Code](https://docs.anthropic.com/en/docs/claude-code) – AI coding assistant by Anthropic
|
||||
- [Node.js 20 LTS](https://nodejs.org/) – JavaScript runtime
|
||||
|
||||
### Implementation Details
|
||||
|
||||
```bash
|
||||
# Claude Code with auto-accept (for automation)
|
||||
# YOLO mode - skip permission prompts
|
||||
claude --dangerously-skip-permissions
|
||||
|
||||
# Or use the alias
|
||||
claude-auto
|
||||
|
||||
# Interactive mode
|
||||
claude
|
||||
|
||||
# Node.js ready
|
||||
node --version
|
||||
npm --version
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Environment Variables
|
||||
|
||||
| Variable | Required | Default | Description |
|
||||
|----------|----------|---------|-------------|
|
||||
| `PASSWORD` | Yes | - | Login password |
|
||||
| `CLAUDER_HOME` | **Yes** | `/home/clauder` | Volume mount path (REQUIRED) |
|
||||
| `PASSWORD` | Yes | - | Login password for code-server |
|
||||
| `CLAUDER_HOME` | Yes | `/home/clauder` | Volume mount path |
|
||||
| `CLAUDER_UID` | No | `1000` | User ID |
|
||||
| `CLAUDER_GID` | No | `1000` | Group ID |
|
||||
| `RUN_AS_USER` | No | `clauder` | Set to `root` for root access |
|
||||
| `RUN_AS_USER` | No | `clauder` | Set to `root` if needed |
|
||||
|
||||
---
|
||||
## Volume Configuration
|
||||
|
||||
## How It Works
|
||||
> ⚠️ **CRITICAL**: Without a volume, ALL data is lost on every redeploy!
|
||||
|
||||
1. **Starts as root** - fixes volume permissions
|
||||
2. **Switches to clauder** - uses `gosu` for clean handoff
|
||||
3. **Runs code-server** - as non-root user
|
||||
| Setting | Value |
|
||||
|---------|-------|
|
||||
| **Mount Path** | `/home/clauder` |
|
||||
| **Size** | 5GB+ recommended |
|
||||
|
||||
This means:
|
||||
- ✅ No root permission warnings in code-server
|
||||
- ✅ Existing volumes with root-owned files work fine
|
||||
- ✅ Claude `--dangerously-skip-permissions` works
|
||||
## Why Deploy Claude Code 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.
|
||||
|
||||
## Claude Code Authentication
|
||||
|
||||
After running `claude` for the first time:
|
||||
|
||||
1. Follow the authentication prompts
|
||||
2. Your credentials are stored in `~/.claude/`
|
||||
3. They persist across redeployments (on volume)
|
||||
|
||||
---
|
||||
|
||||
## Custom Startup Scripts
|
||||
|
||||
Add to `$CLAUDER_HOME/entrypoint.d/`:
|
||||
|
||||
```bash
|
||||
#!/bin/bash
|
||||
git config --global user.name "Your Name"
|
||||
```
|
||||
|
||||
Make executable: `chmod +x script.sh`
|
||||
|
||||
---
|
||||
|
||||
## Update Behavior
|
||||
|
||||
| Component | Behavior |
|
||||
|-----------|----------|
|
||||
| **Volume tools** | You control - install to `~/.local/node/` or `~/.claude/local/` |
|
||||
| **Image tools** | Auto-update on redeploy (fallback) |
|
||||
| **Extensions** | Persist on volume |
|
||||
| **Claude auth** | Persists on volume |
|
||||
|
||||
Logs show `[volume]` or `[image]` next to each tool.
|
||||
|
||||
---
|
||||
|
||||
## Troubleshooting
|
||||
|
||||
| Issue | Solution |
|
||||
|-------|----------|
|
||||
| Permission denied | Check `CLAUDER_UID` matches your volume owner |
|
||||
| Claude not found | Run `which claude` to check PATH |
|
||||
| Extensions missing | Verify volume mounted at `CLAUDER_HOME` |
|
||||
By deploying Claude Code 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.
|
||||
|
||||
---
|
||||
|
||||
|
||||
BIN
public/claude-code-server-logo.png
Normal file
BIN
public/claude-code-server-logo.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 240 KiB |
BIN
public/social-preview.png
Normal file
BIN
public/social-preview.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 412 KiB |
@ -170,8 +170,8 @@ You'll need to authenticate with your Anthropic API key on first use.
|
||||
|
||||
Set these environment variables in Railway:
|
||||
|
||||
- `RUN_AS_USER=coder` - Run as non-root user (recommended for Claude)
|
||||
- `RUN_AS_USER=root` - Stay as root (default)
|
||||
- `RUN_AS_USER=clauder` - Run as non-root user (recommended for Claude)
|
||||
- `RUN_AS_USER=root` - Stay as root
|
||||
|
||||
Happy coding! 🚀
|
||||
WELCOME
|
||||
@ -239,10 +239,18 @@ fi
|
||||
# START CODE-SERVER
|
||||
# ============================================================================
|
||||
|
||||
# Branding customization
|
||||
APP_NAME="${APP_NAME:-Claude Code Server}"
|
||||
WELCOME_TEXT="${WELCOME_TEXT:-Welcome to Claude Code Server}"
|
||||
|
||||
echo ""
|
||||
echo "════════════════════════════════════════════════════════════════════════"
|
||||
echo "Starting code-server as $(whoami)..."
|
||||
echo "Starting $APP_NAME as $(whoami)..."
|
||||
echo "════════════════════════════════════════════════════════════════════════"
|
||||
echo ""
|
||||
|
||||
exec dumb-init /usr/bin/code-server --bind-addr 0.0.0.0:8080 /home/coder/workspace
|
||||
exec dumb-init /usr/bin/code-server \
|
||||
--bind-addr 0.0.0.0:8080 \
|
||||
--app-name "$APP_NAME" \
|
||||
--welcome-text "$WELCOME_TEXT" \
|
||||
"$CLAUDER_HOME/workspace"
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user