diff --git a/Dockerfile b/Dockerfile index e9c735400..e4e545965 100644 --- a/Dockerfile +++ b/Dockerfile @@ -10,7 +10,7 @@ USER root # ============================================================================ # SYSTEM DEPENDENCIES # Install gosu, Node.js 20, Python/uv, and essential tools -# Cache bust: 2026-01-29-v4 +# Cache bust: 2026-01-29-v5 # ============================================================================ RUN curl -fsSL https://deb.nodesource.com/setup_20.x | bash - \ @@ -36,47 +36,49 @@ RUN curl -fsSL https://deb.nodesource.com/setup_20.x | bash - \ # ============================================================================ # PERSISTENCE CONFIGURATION -# BACKWARD COMPATIBLE: Defaults to /home/coder for existing volumes +# Default to /home/clauder for new deployments # ============================================================================ -ENV HOME=/home/coder -ENV USER=coder +ENV HOME=/home/clauder +ENV USER=clauder # XDG Base Directory Specification -ENV XDG_DATA_HOME=/home/coder/.local/share -ENV XDG_CONFIG_HOME=/home/coder/.config -ENV XDG_CACHE_HOME=/home/coder/.cache -ENV XDG_STATE_HOME=/home/coder/.local/state +ENV XDG_DATA_HOME=/home/clauder/.local/share +ENV XDG_CONFIG_HOME=/home/clauder/.config +ENV XDG_CACHE_HOME=/home/clauder/.cache +ENV XDG_STATE_HOME=/home/clauder/.local/state # PATH: Volume paths FIRST (user installs), image paths LAST (fallbacks) -ENV PATH="/home/coder/.local/bin:/home/coder/.local/node/bin:/home/coder/.claude/local:/home/coder/node_modules/.bin:/usr/local/bin:/usr/bin:/usr/lib/code-server/lib/vscode/bin/remote-cli:${PATH}" +ENV PATH="/home/clauder/.local/bin:/home/clauder/.local/node/bin:/home/clauder/.claude/local:/home/clauder/node_modules/.bin:/usr/local/bin:/usr/bin:/usr/lib/code-server/lib/vscode/bin/remote-cli:${PATH}" # Custom startup scripts directory -ENV ENTRYPOINTD=/home/coder/entrypoint.d +ENV ENTRYPOINTD=/home/clauder/entrypoint.d # ============================================================================ # USER SETUP -# The base image already has coder user with UID 1000 +# Create clauder user (UID 1000 to match base image's coder user) # ============================================================================ -# Ensure coder user exists with correct UID/GID -RUN id -u coder &>/dev/null || useradd -m -s /bin/bash -u 1000 -g 1000 coder 2>/dev/null || true +RUN groupadd -g 1000 clauder 2>/dev/null || true \ + && useradd -m -s /bin/bash -u 1000 -g 1000 clauder 2>/dev/null || true \ + && usermod -l clauder coder 2>/dev/null || true \ + && groupmod -n clauder coder 2>/dev/null || true # ============================================================================ # DIRECTORY SETUP # ============================================================================ RUN mkdir -p \ - /home/coder/.local/share \ - /home/coder/.config \ - /home/coder/.cache \ - /home/coder/.local/state \ - /home/coder/.local/bin \ - /home/coder/.local/node \ - /home/coder/.claude \ - /home/coder/entrypoint.d \ - /home/coder/workspace \ - && chown -R 1000:1000 /home/coder + /home/clauder/.local/share \ + /home/clauder/.config \ + /home/clauder/.cache \ + /home/clauder/.local/state \ + /home/clauder/.local/bin \ + /home/clauder/.local/node \ + /home/clauder/.claude \ + /home/clauder/entrypoint.d \ + /home/clauder/workspace \ + && chown -R 1000:1000 /home/clauder # Copy our custom entrypoint (replaces base image's entrypoint) COPY railway-entrypoint.sh /usr/bin/railway-entrypoint.sh @@ -100,9 +102,10 @@ RUN curl -fsSL https://claude.ai/install.sh | bash \ # Stay as root - entrypoint handles user switching based on RUN_AS_USER # ============================================================================ -WORKDIR /home/coder/workspace +WORKDIR /home/clauder/workspace EXPOSE 8080 # Use our entrypoint which calls code-server directly ENTRYPOINT ["/usr/bin/railway-entrypoint.sh"] + diff --git a/RAILWAY_TEMPLATE_GUIDE.md b/RAILWAY_TEMPLATE_GUIDE.md new file mode 100644 index 000000000..f4308da9d --- /dev/null +++ b/RAILWAY_TEMPLATE_GUIDE.md @@ -0,0 +1,145 @@ +# Railway Template Setup Guide + +Step-by-step guide to configure the Claude Code Server Railway template. + +--- + +## Template Metadata + +| Field | Value | +|-------|-------| +| **Name** | Claude Code Server | +| **Description** | Claude Code in Browser – Full VS Code with AI coding assistants | +| **Repository** | `sphinxcode/claude-code-server` | + +--- + +## Step 1: Create Template + +1. Go to [Railway Templates](https://railway.com/new/template) +2. Select your GitHub repository: `sphinxcode/claude-code-server` +3. Configure the template metadata as shown above + +--- + +## Step 2: Configure Variables + +### Required Variables + +| Variable | Type | Description | +|----------|------|-------------| +| `PASSWORD` | **Secret** | Login password for code-server | +| `CLAUDER_HOME` | **Path** | Volume mount path — use `/home/coder` for existing deployments | + +> ⚠️ **CRITICAL**: `CLAUDER_HOME` MUST match your volume mount path! + +### Optional User Variables + +| Variable | Default | Description | +|----------|---------|-------------| +| `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) + +> ⚠️ **CRITICAL**: Without a volume, ALL data is lost on every redeploy! + +| Setting | Value | +|---------|-------| +| **Mount Path** | `/home/clauder` | +| **Size** | 5GB+ recommended | +| **Purpose** | Persists extensions, Claude auth, configs | + +**Important**: Set `CLAUDER_HOME` to match your volume mount path! + +--- + +## Step 4: Region Selection + +> 📍 **CRITICAL**: Select **US West** region for optimal performance. + +Railway region options: +- ✅ `us-west1` (recommended) +- `us-east4` +- `europe-west4` +- `asia-southeast1` + +--- + +## Step 5: Deploy Settings + +These are pre-configured in `railway.toml`: + +| Setting | Value | +|---------|-------| +| Health Check Path | `/healthz` | +| Health Check Timeout | 300s | +| Restart Policy | On Failure | +| Max Retries | 10 | + +--- + +## Step 6: Publish Template + +1. Test the deployment with your own Railway account +2. Verify Claude Code authentication works +3. Confirm volume persistence across redeploys +4. Publish the template + +--- + +## Marketing Copy + +### Template Title +**Claude Code Server** + +### Template Tagline +**Claude Code in Browser – YOLO Mode Enabled 🚀** + +### Template Description + +> **Full VS Code + Claude Code in your browser. YOLO mode ready.** +> +> Skip the approval prompts. Claude runs with `--dangerously-skip-permissions` out of the box—just type `claude-auto` and let it cook. +> +> **Why developers love it:** +> - 🔥 **YOLO Mode** – No permission prompts, pure flow state +> - ⚡ **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 +> +> Perfect for vibe coding, weekend hacks, and shipping fast. + +--- + +## Reference: Original Template Comparison + +| Old (code-server) | New (Claude Code Server) | +|-------------------|--------------------------| +| Generic VS Code | Claude Code + AI CLIs | +| `coder` user | `clauder` user | +| No AI tools | 5 optional AI CLIs | +| No frameworks | BMAD, OpenSpec, Spec-Kit | +| Basic docs | Auth + region guidance | diff --git a/README.md b/README.md index 8ae656cdd..dc72ba0b8 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,7 @@ **Browser-based VSCode with Claude Code & Node.js** -[![Deploy on Railway](https://railway.com/button.svg)](https://railway.com/template/TEMPLATE_ID) +[![Deploy on Railway](https://railway.com/button.svg)](https://railway.com/deploy/pHwM6f?referralCode=1uw5HI&utm_medium=integration&utm_source=template&utm_campaign=generic) Cloud IDE with persistent extensions, settings, and tools. Runs as non-root user. @@ -41,6 +41,7 @@ npm --version | `CLAUDER_HOME` | **Yes** | `/home/clauder` | Volume mount path (REQUIRED) | | `CLAUDER_UID` | No | `1000` | User ID | | `CLAUDER_GID` | No | `1000` | Group ID | +| `RUN_AS_USER` | No | `clauder` | Set to `root` for root access | --- diff --git a/railway-entrypoint.sh b/railway-entrypoint.sh index 9c0c94115..5e3ae3be7 100644 --- a/railway-entrypoint.sh +++ b/railway-entrypoint.sh @@ -15,12 +15,12 @@ echo "" # CONFIGURABLE PATHS AND USER # ============================================================================ -CLAUDER_HOME="${CLAUDER_HOME:-/home/coder}" +CLAUDER_HOME="${CLAUDER_HOME:-/home/clauder}" CLAUDER_UID="${CLAUDER_UID:-1000}" CLAUDER_GID="${CLAUDER_GID:-1000}" -# RUN_AS_USER: Set to "coder" to run as non-root, or "root" (default) to stay as root -RUN_AS_USER="${RUN_AS_USER:-root}" +# RUN_AS_USER: Defaults to "clauder" for non-root. Set to "root" if needed. +RUN_AS_USER="${RUN_AS_USER:-clauder}" export HOME="$CLAUDER_HOME" export XDG_DATA_HOME="$CLAUDER_HOME/.local/share"