Infrastructure

Mac Mini Setup

Run Commerce Index on a Mac Mini for a self-hosted, cost-effective deployment. Complete guide from hardware to production-ready setup.

Hardware Requirements

Minimum: Mac Mini M2
  • 8GB Unified Memory
  • 256GB SSD
  • Runs Mistral 7B for intent classification
  • Handles up to ~50 merchants
Recommended: Mac Mini M4
  • 16GB+ Unified Memory
  • 512GB SSD
  • Runs Llama 3 8B and Mistral 7B simultaneously
  • Handles up to ~200 merchants

Step 1: Install Docker Desktop

Download and install Docker Desktop for Mac. Ensure it is running before proceeding.

Step 2: Install Dependencies via Homebrew

# Install Homebrew (if not already installed)
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"

# Install required services
brew install mongodb-community redis ollama

Step 3: Clone Repository & Run Setup

# Clone the OpenClaw repository
git clone https://github.com/commerce-index/openclaw.git
cd openclaw

# Run setup with macmini mode
./setup.sh macmini

Step 5: Configure Environment

# .env configuration for Mac Mini
MONGODB_URI=mongodb://localhost:27017/openclaw
REDIS_URL=redis://localhost:6379
CI_API_URL=https://api.commerceindex.ai
OLLAMA_URL=http://localhost:11434
TELEGRAM_BOT_TOKEN=your_telegram_bot_token
WHATSAPP_PHONE_ID=your_whatsapp_phone_id
WHATSAPP_TOKEN=your_whatsapp_token
ANTHROPIC_API_KEY=your_anthropic_api_key  # fallback LLM
NODE_ENV=production
PORT=3000
LOG_LEVEL=info

Step 6: Start Services

# Start all services
docker-compose up -d

# Verify all containers are running
docker-compose ps

# Expected output:
# NAME              STATUS    PORTS
# openclaw-api      running   0.0.0.0:3000->3000/tcp
# openclaw-worker   running
# mongodb           running   0.0.0.0:27017->27017/tcp
# redis             running   0.0.0.0:6379->6379/tcp

Step 7: Set Up Cloudflare Tunnel

Cloudflare Tunnel provides a secure way to expose your local services to the internet without opening ports on your router.

# Install cloudflared
brew install cloudflare/cloudflare/cloudflared

# Authenticate with Cloudflare
cloudflared tunnel login

# Create the tunnel
cloudflared tunnel create ci-admin

# Configure ingress rules (~/.cloudflared/config.yml)
tunnel: <your-tunnel-id>
credentials-file: /Users/<you>/.cloudflared/<tunnel-id>.json

ingress:
  - hostname: api.yourdomain.com
    service: http://localhost:3000
  - hostname: admin.yourdomain.com
    service: http://localhost:3001
  - service: http_status:404

# Route DNS
cloudflared tunnel route dns ci-admin api.yourdomain.com
cloudflared tunnel route dns ci-admin admin.yourdomain.com

# Start the tunnel
cloudflared tunnel run ci-admin

Step 8: Auto-Start on Boot (launchd)

Configure macOS launchd to automatically start Commerce Index services when the Mac Mini boots up.

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN"
  "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
  <key>Label</key>
  <string>com.commerceindex.openclaw</string>
  <key>ProgramArguments</key>
  <array>
    <string>/usr/local/bin/docker-compose</string>
    <string>-f</string>
    <string>/Users/admin/openclaw/docker-compose.yml</string>
    <string>up</string>
    <string>-d</string>
  </array>
  <key>RunAtLoad</key>
  <true/>
  <key>KeepAlive</key>
  <false/>
  <key>WorkingDirectory</key>
  <string>/Users/admin/openclaw</string>
  <key>StandardOutPath</key>
  <string>/Users/admin/openclaw/logs/launchd.log</string>
  <key>StandardErrorPath</key>
  <string>/Users/admin/openclaw/logs/launchd-error.log</string>
</dict>
</plist>

<!-- Save as ~/Library/LaunchAgents/com.commerceindex.openclaw.plist -->
<!-- Then load it: -->
<!-- launchctl load ~/Library/LaunchAgents/com.commerceindex.openclaw.plist -->

Step 9: Pull Ollama Models

# Pull recommended models
ollama pull mistral:7b        # Intent classification (~4GB)
ollama pull llama3:8b          # Text generation (~4.7GB)

# Verify models are available
ollama list

# Expected output:
# NAME            SIZE     MODIFIED
# mistral:7b      4.1 GB   Just now
# llama3:8b       4.7 GB   Just now

Step 10: Verify Installation

# Test the API health endpoint
curl http://localhost:3000/health

# Expected response:
# {
#   "status": "ok",
#   "version": "1.0.0",
#   "services": {
#     "mongodb": "connected",
#     "redis": "connected",
#     "ollama": "connected"
#   },
#   "uptime": 42
# }

Cost Analysis

Mac Mini M2 starts at $599 one-time, with ongoing costs of approximately $25-55/month depending on your configuration.

ItemTypeCost
Mac Mini M2 (8GB)
One-time
$599
Mac Mini M4 (16GB)
One-time
$799
Electricity (~15W avg)
Monthly
~$3-5
Cloudflare Tunnel
Monthly
Free
Domain name
Monthly
~$1-2
Internet (existing)
Monthly
$0
Claude API (fallback)
Monthly
~$5-15
MongoDB Atlas (optional)
Monthly
~$15-30

What's Next?