# NMC Knowledge Base — Outline Setup Runbook
**Phase 1: Local Docker (Mac)**
Built: 2026-04-02 | Owner: Mike | Builder: Harvey

---

## Prerequisites

1. **Install Docker Desktop** (Apple Silicon)
   - Download: https://www.docker.com/products/docker-desktop/
   - Choose "Mac with Apple Silicon"
   - Install, launch, sign in (free account fine)
   - Verify: `docker --version` in Terminal

2. **Open Terminal** and `cd` to this directory:
   ```
   cd /Users/harvey/.openclaw/workspace/outline
   ```

---

## Step 1 — Generate Secrets

Run this in Terminal to generate 3 strong secrets:
```bash
echo "SECRET_KEY=$(openssl rand -hex 32)"
echo "UTILS_SECRET=$(openssl rand -hex 32)"
echo "PG_PASS=$(openssl rand -hex 16)"
echo "REDIS_PASS=$(openssl rand -hex 16)"
echo "MINIO_PASS=$(openssl rand -hex 16)"
```
Copy the output — you'll need it in the next step.

---

## Step 2 — Create .env File

```bash
cp .env.template .env
```

Open `.env` in any text editor and fill in:
- `SECRET_KEY` → paste your SECRET_KEY value
- `UTILS_SECRET` → paste your UTILS_SECRET value
- `POSTGRES_PASSWORD` → paste your PG_PASS value (replace in BOTH places: POSTGRES_PASSWORD and DATABASE_URL)
- `REDIS_PASSWORD` → paste your REDIS_PASS value (replace in BOTH places: REDIS_PASSWORD and REDIS_URL)
- `MINIO_ROOT_PASSWORD` → paste your MINIO_PASS value (replace in BOTH places: MINIO_ROOT_PASSWORD and AWS_SECRET_ACCESS_KEY)

**For authentication (easiest — email magic link):**
- `SMTP_PASSWORD` → your Gmail app password (in `~/.openclaw/secrets/gmail-app-password.txt`)
- Leave SLACK_ and GOOGLE_ fields blank for now

---

## Step 3 — Start Outline

```bash
docker compose up -d
```

First run downloads images (~800MB). Give it 2-3 minutes.

Watch logs:
```bash
docker compose logs -f outline
```

Wait for: `Listening on port 3000`

---

## Step 4 — First Login

Open: **http://localhost:3300**

- Click "Continue with email"
- Enter your email (mike@nomorechores.com)
- Check email for magic link
- Set your name: Mike Ziarko
- You're in!

---

## Step 5 — Create Collections

In Outline sidebar, click "New Collection" and create these 4:

| Collection | Who | Permissions |
|---|---|---|
| **Internal Ops** | Mike + Abigael | Members only, read/write |
| **Leah KB** | Mike + Harvey (API) | Members only, read/write |
| **Contractor Handbook** | Contractors (guests) | Read-only |
| **Customer Help Center** | Anyone | Public |

---

## Step 6 — Import Existing KB Content

Harvey has prepared content to import. Run:
```bash
python3 ../scripts/outline-import.py --collection "Leah KB"
```

This imports from `~/nmc-phone/leah-kb.html` and the complaint SOPs.

Alternatively, manual import: In any Collection, click "Import" → paste HTML or Markdown.

---

## Step 7 — Generate Harvey's API Token

1. In Outline: click your avatar → Settings → API → Create New Token
2. Name it: `Harvey`
3. Copy the token
4. Save it: `echo "TOKEN_HERE" > ~/.openclaw/secrets/outline-api-token.txt`
5. In `.env`, set `OUTLINE_API_TOKEN=` to the same value

Test Harvey's access:
```bash
python3 ../scripts/outline-reader.py --test
```

---

## Step 8 — Validate

- [ ] Log in successfully with magic link
- [ ] Create one test document in Internal Ops
- [ ] Upload one image (tests MinIO storage)
- [ ] Run `python3 ../scripts/outline-reader.py --search "cleaning"` and get results
- [ ] Review the UI — does it feel right for Abigael to use?

---

## Phase 2 Options (decide after Phase 1)

| Option | Cost | Effort | Best for |
|---|---|---|---|
| **Hetzner VPS (self-hosted)** | ~$6/mo | 2h setup | Full control, cheapest |
| **getoutline.com** | $10/user/mo | 15 min | Zero ops, managed |
| **Railway** | ~$5/mo | 1h setup | Easy deploy, auto SSL |

Custom domain options: `kb.nomorechores.com` (internal feel) or `help.nomorechores.com` (customer-facing).

---

## Quick Commands

```bash
# Start
docker compose up -d

# Stop (keeps data)
docker compose down

# View logs
docker compose logs -f outline

# Restart just Outline
docker compose restart outline

# Full reset (DESTROYS ALL DATA)
docker compose down -v
```

---

## Troubleshooting

**"Port 3300 already in use"** → Change the port in docker-compose.yml (left side of `3300:3000`)

**Login email not arriving** → Check spam. Or test SMTP: `python3 -c "import smtplib; ..."` (Harvey can help)

**Storage errors** → MinIO might still be starting. Wait 30s and retry.

**Database errors** → `docker compose down -v && docker compose up -d` (fresh start)
