2026-04-04 15:09:27 -04:00
# Claude Code + Agents UI Stack
2026-04-04 14:23:42 -04:00
2026-04-04 15:09:27 -04:00
A self-hosted Docker stack that combines the [claude-code-agents-ui ](https://github.com/Ngxba/claude-code-agents-ui ) frontend with the Claude Code CLI runtime, designed for TrueNAS SCALE deployment.
2026-04-04 14:34:56 -04:00
2026-04-04 15:09:27 -04:00
---
2026-04-04 14:34:56 -04:00
2026-04-04 15:09:27 -04:00
## What's Included
2026-04-04 14:34:56 -04:00
2026-04-04 15:09:27 -04:00
| File | Purpose |
|------|---------|
| `claude-agents-ui-Dockerfile` | Multi-stage image: builds the Nuxt 3 UI + installs Claude Code CLI |
| `claude-code-stack-docker-compose.yml` | Orchestrates all services (UI, runtime, Postgres, Redis, Nginx) |
| `claude-code-stack.env` | Environment variable template — copy to `.env` before deploying |
| `nginx.conf` | Reverse-proxy config (SSL-ready) |
| `deploy-ssh.sh` | One-command SSH deployment to TrueNAS ⭐ recommended |
| `deploy-mcp.py` | MCP-based deployment (advanced) |
| `QUICKSTART.md` | 5-minute setup guide |
| `DEPLOYMENT_GUIDE.md` | Full reference |
| `CHECKLIST.md` | Pre/post-deployment checklist |
2026-04-04 14:34:56 -04:00
2026-04-04 15:09:27 -04:00
---
## Quick Start
2026-04-04 14:34:56 -04:00
```bash
2026-04-04 15:09:27 -04:00
# 1. Set your Anthropic API key (get one at https://console.anthropic.com/)
export ANTHROPIC_API_KEY="sk-ant-..."
2026-04-04 14:34:56 -04:00
2026-04-04 15:09:27 -04:00
# 2. Deploy to TrueNAS
2026-04-04 14:34:56 -04:00
chmod +x deploy-ssh.sh
./deploy-ssh.sh 192.168.1.100 root tank
2026-04-04 15:09:27 -04:00
# 3. Open the UI
open http://192.168.1.100:3000
2026-04-04 14:34:56 -04:00
```
2026-04-04 15:09:27 -04:00
---
## Authentication
Claude Code requires authentication to execute prompts. This stack implements **non-interactive auth** so no manual `claude auth login` step is needed.
### How it works
1. You provide your `ANTHROPIC_API_KEY` in `.env` (or via environment variable).
2. The `agents-ui` container entrypoint writes `~/.claude/.credentials.json` containing your API key on first start.
3. The Claude Code CLI reads this file and is ready to execute without any interactive login step.
4. The `claude-code-backend` container uses `ANTHROPIC_API_KEY` directly at runtime.
### Manual auth (optional)
If you prefer OAuth-based login (tied to a Claude.ai subscription rather than pay-per-token API):
2026-04-04 14:34:56 -04:00
2026-04-04 15:09:27 -04:00
```bash
# SSH into TrueNAS
ssh root@192.168.1.100
# Run interactive login inside the container
cd /mnt/tank/docker/claude-code-stack
docker-compose exec agents-ui claude auth login
2026-04-04 14:34:56 -04:00
```
2026-04-04 15:09:27 -04:00
The credentials are stored in the `claude-config` Docker volume and persist across restarts.
### Auth status check
```bash
docker-compose exec agents-ui claude auth status
2026-04-04 14:34:56 -04:00
```
2026-04-04 15:09:27 -04:00
---
## Architecture
2026-04-04 14:34:56 -04:00
```
2026-04-04 15:09:27 -04:00
Your Browser
2026-04-04 14:34:56 -04:00
│
▼
2026-04-04 15:09:27 -04:00
Nginx :80/:443
2026-04-04 14:34:56 -04:00
│
2026-04-04 15:09:27 -04:00
├──► Agents UI (Nuxt 3) :3000 ──► ~/.claude/ volume
│ │
│ └──► Claude Code Backend :5000
2026-04-04 14:34:56 -04:00
│
2026-04-04 15:09:27 -04:00
├──► PostgreSQL :5432
└──► Redis :6379
2026-04-04 14:34:56 -04:00
```
2026-04-04 15:09:27 -04:00
All services share two Docker volumes:
- `claude-config` — Claude credentials, agents, commands, skills, workflows
- `workspace` — Project files for agent execution
2026-04-04 14:34:56 -04:00
2026-04-04 15:09:27 -04:00
---
2026-04-04 14:34:56 -04:00
2026-04-04 15:09:27 -04:00
## Configuration
2026-04-04 14:34:56 -04:00
2026-04-04 15:09:27 -04:00
Copy the env template and fill in your values:
2026-04-04 14:34:56 -04:00
2026-04-04 15:09:27 -04:00
```bash
cp claude-code-stack.env .env
nano .env # Set ANTHROPIC_API_KEY and change POSTGRES_PASSWORD / SESSION_SECRET
```
2026-04-04 14:34:56 -04:00
2026-04-04 15:09:27 -04:00
### Key variables
2026-04-04 14:34:56 -04:00
2026-04-04 15:09:27 -04:00
| Variable | Required | Description |
|----------|----------|-------------|
| `ANTHROPIC_API_KEY` | **Yes** | Your Anthropic API key |
| `CLAUDE_MODEL` | No | Model to use (default: `claude-sonnet-4-6` ) |
| `POSTGRES_PASSWORD` | **Yes** | Change from default before production |
| `SESSION_SECRET` | **Yes** | Random string — run `openssl rand -base64 32` |
2026-04-04 14:34:56 -04:00
2026-04-04 15:09:27 -04:00
Available models: `claude-opus-4-6` , `claude-sonnet-4-6` , `claude-haiku-4-5-20251001`
2026-04-04 14:34:56 -04:00
2026-04-04 15:09:27 -04:00
---
2026-04-04 14:34:56 -04:00
2026-04-04 15:09:27 -04:00
## Deployment Methods
2026-04-04 14:34:56 -04:00
2026-04-04 15:09:27 -04:00
### Method 1: SSH (recommended)
2026-04-04 14:34:56 -04:00
2026-04-04 15:09:27 -04:00
```bash
export ANTHROPIC_API_KEY="sk-ant-..."
./deploy-ssh.sh 192.168.1.100 root tank
```
2026-04-04 14:34:56 -04:00
2026-04-04 15:09:27 -04:00
The script:
- Validates prerequisites
- Tests SSH connectivity
- Creates project directory on TrueNAS
- Uploads all files
- Writes `.env` with auto-generated secrets
- Builds and starts all services
- Verifies Claude auth inside containers
2026-04-04 14:34:56 -04:00
2026-04-04 15:09:27 -04:00
### Method 2: Manual
2026-04-04 14:34:56 -04:00
2026-04-04 15:09:27 -04:00
```bash
# SSH into TrueNAS
ssh root@192.168.1.100
2026-04-04 14:34:56 -04:00
2026-04-04 15:09:27 -04:00
mkdir -p /mnt/tank/docker/claude-code-stack
cd /mnt/tank/docker/claude-code-stack
2026-04-04 14:34:56 -04:00
2026-04-04 15:09:27 -04:00
# Upload files, then:
cp claude-code-stack.env .env
cp claude-code-stack-docker-compose.yml docker-compose.yml
cp claude-agents-ui-Dockerfile Dockerfile
nano .env # Set your API key
2026-04-04 14:34:56 -04:00
2026-04-04 15:09:27 -04:00
docker-compose build
docker-compose up -d
```
2026-04-04 14:34:56 -04:00
2026-04-04 15:09:27 -04:00
### Method 3: MCP
2026-04-04 14:34:56 -04:00
```bash
2026-04-04 15:09:27 -04:00
pip install httpx
python deploy-mcp.py --mcp-url https://mcp.wilddragon.net/mcp --pool tank
2026-04-04 14:34:56 -04:00
```
2026-04-04 15:09:27 -04:00
---
## Useful Commands
2026-04-04 14:34:56 -04:00
```bash
2026-04-04 15:09:27 -04:00
# View all logs
docker-compose logs -f
2026-04-04 14:34:56 -04:00
2026-04-04 15:09:27 -04:00
# View just the UI logs
docker-compose logs -f agents-ui
2026-04-04 14:34:56 -04:00
2026-04-04 15:09:27 -04:00
# Check auth status
docker-compose exec agents-ui claude auth status
2026-04-04 14:34:56 -04:00
2026-04-04 15:09:27 -04:00
# Re-authenticate (interactive OAuth)
docker-compose exec agents-ui claude auth login
2026-04-04 14:34:56 -04:00
2026-04-04 15:09:27 -04:00
# Restart a service
docker-compose restart agents-ui
2026-04-04 14:34:56 -04:00
2026-04-04 15:09:27 -04:00
# Pull latest images
docker-compose pull & & docker-compose up -d
2026-04-04 14:34:56 -04:00
2026-04-04 15:09:27 -04:00
# Stop everything
docker-compose down
2026-04-04 14:34:56 -04:00
2026-04-04 15:09:27 -04:00
# Stop and remove volumes (WARNING: deletes all data)
docker-compose down -v
2026-04-04 14:34:56 -04:00
```
2026-04-04 15:09:27 -04:00
---
2026-04-04 14:34:56 -04:00
2026-04-04 15:09:27 -04:00
## Resource Requirements
2026-04-04 14:34:56 -04:00
2026-04-04 15:09:27 -04:00
| Tier | RAM | CPU | Disk |
|------|-----|-----|------|
| Minimum | 2 GB | 2 cores | 10 GB |
| Recommended | 4 GB | 4 cores | 20 GB |
| Optimal | 8 GB+ | 8+ cores | 50 GB+ |
2026-04-04 14:34:56 -04:00
2026-04-04 15:09:27 -04:00
---
2026-04-04 14:34:56 -04:00
2026-04-04 15:09:27 -04:00
## Security Notes
2026-04-04 14:34:56 -04:00
2026-04-04 15:09:27 -04:00
- Change `POSTGRES_PASSWORD` from the default before production
- Generate a proper `SESSION_SECRET` : `openssl rand -base64 32`
- The `.env` file is chmod 600 — never commit it to version control
- The `claude-config` volume contains your API credentials — back it up securely
- Consider restricting Nginx to internal network access only
2026-04-04 14:34:56 -04:00
2026-04-04 15:09:27 -04:00
---
2026-04-04 14:34:56 -04:00
2026-04-04 15:09:27 -04:00
## Links
2026-04-04 14:34:56 -04:00
2026-04-04 15:09:27 -04:00
- [Agents UI source ](https://github.com/Ngxba/claude-code-agents-ui )
- [Claude Code docs ](https://docs.anthropic.com/en/docs/claude-code )
- [Anthropic console ](https://console.anthropic.com/ )
2026-04-04 14:34:56 -04:00
---
2026-04-04 15:09:27 -04:00
**Version:** 1.1.0 | **Updated:** 2026-04-04 | **Compatibility:** TrueNAS SCALE, Docker Compose 3.8+