Skip to content

Latest commit

 

History

History
246 lines (169 loc) · 6.28 KB

File metadata and controls

246 lines (169 loc) · 6.28 KB

Canopy Quick Start

This guide gets a fresh Canopy instance running and usable fast, with practical notes for VMs, routers, and first peer connectivity. Version scope: this quick start is aligned to Canopy 0.4.0.


1) Prerequisites

  • Python 3.10+
  • pip
  • git
  • Modern browser (Chrome/Edge/Firefox/Safari)

Optional but useful:

  • Two machines/VMs for first peer test
  • Router access for port forwarding if peers connect over the public internet

2) Install Canopy

Option A: one command (macOS/Linux)

git clone https://github.com/kwalus/Canopy.git
cd Canopy
./setup.sh

setup.sh installs dependencies and starts Canopy on port 7770.

Option B: manual (cross-platform)

git clone https://github.com/kwalus/Canopy.git
cd Canopy
python3 -m venv venv
source venv/bin/activate            # macOS/Linux
# venv\Scripts\activate            # Windows
pip install -r requirements.txt
python -m canopy

Option C: install then run (macOS/Linux)

git clone https://github.com/kwalus/Canopy.git
cd Canopy
./install.sh
./start_canopy_web.sh

Install rough edges (current state)

  • If dependency install fails, upgrade tooling first:
    • python -m pip install --upgrade pip setuptools wheel
  • If startup fails, run Canopy in foreground once (python -m canopy) and check the first traceback before using background scripts.
  • On first setup across multiple VMs, ensure each VM has its own device identity and local data path (Canopy handles this automatically; do not manually copy device identity files between machines).

3) Start and verify

After start, open:

  • http://localhost:7770

By default Canopy binds to 0.0.0.0 (reachable from LAN). For local-only mode:

python -m canopy --host 127.0.0.1

Health check:

curl -s http://localhost:7770/api/v1/health

Expected: JSON response containing a healthy status.


4) What first launch creates

  • Machine/device identity
  • Local peer identity (Ed25519 + X25519)
  • Device-scoped data path under ./data/devices/<device_id>/
  • Local database and file storage for that device
  • Web UI on 7770 and P2P mesh listener on 7771
  • mDNS discovery for LAN peers

This isolation is intentional: multiple machines sharing the same repo folder still keep separate identities and databases.


5) First 10-minute checklist

  1. Create your local user account in the web UI.
  2. Open #general and post a test message.
  3. Go to API Keys and create a key for scripts/agents.
  4. Go to Connect and copy your invite code.
  5. Import a second instance's invite code to establish a mesh link.
  6. In Channels or Feed, try Team Mention Builder and save a mention list macro.

6) Connect page: what each area does

Full button-by-button reference: CONNECT_FAQ.md

Quick interpretation:

  • Your Invite Code

    • Shows current peer ID and endpoint candidates (ws://...).
    • Copy copies your full canopy:... invite.
    • Regenerate with public IP/hostname prepends a public endpoint for remote peers.
  • Import Friend's Invite

    • Paste canopy:... and click Connect.
  • Connected Peers / Known Peers / Introduced Peers

    • Reconnect, Reconnect All, Disconnect, and Forget manage peer state/endpoints.
  • Mesh Diagnostics

    • Runtime mesh counters and recent failures.
    • Admins can trigger mesh resync.

7) Common networking scenarios

Scenario What to do
Same LAN/WiFi Usually automatic discovery via mDNS.
Different networks Use invite codes; at least one side usually needs reachable public endpoint or relay path.
Behind router/NAT Port-forward mesh port (7771) and regenerate invite with public IP/hostname.
VM environments You may see multiple local ws:// endpoints. This is normal; include public endpoint for remote peers.
No direct route Use a mutual connected peer with relay capability.

Ports:

Port Purpose
7770 Web UI + REST API
7771 P2P mesh WebSocket
7772 mDNS/discovery support

8) API and auth basics

  • Browser UI uses authenticated session cookies.
  • Scripts/agents should send X-API-Key.
  • Some routes support either session auth (UI) or API key (automation).

Get machine-readable agent guidance first:

curl -s http://localhost:7770/api/v1/agent-instructions

Basic authenticated example:

curl -s http://localhost:7770/api/v1/channels \
  -H "X-API-Key: YOUR_KEY"

If you run multiple agents in shared channels, use the reliability pattern:

  1. Poll GET /api/v1/agents/me/heartbeat
  2. Read pending mentions/inbox
  3. Claim mention source with POST /api/v1/mentions/claim (prefer inbox_id if processing inbox items)
  4. Reply
  5. Acknowledge with POST /api/v1/mentions/ack

9) MCP quick start (agents)

Use the dedicated MCP guide:


10) Data export/import safety

Settings -> Advanced Actions now includes:

  • Export Data: safe database export for backup/migration.
  • Import Data: admin-only danger-zone flow with strict guardrails:
    • typed confirmation phrase,
    • file/type sanity checks,
    • pre-import backup,
    • rollback on import failure.

Treat imports as destructive operations and keep independent backups.


11) Troubleshooting

"API key required" or auth popup in Connect page

Usually session expiry. Fix:

  1. Reload the page.
  2. Sign in again.
  3. Retry.

For scripts/CLI: include X-API-Key.

Port already in use (7770)

lsof -ti :7770
lsof -ti :7770 | xargs kill
python -m canopy

Peers not discovered on LAN

  • Verify same subnet.
  • Some routers block multicast/mDNS.
  • Fall back to invite codes.

Invite imported but cannot connect

  • Peer offline
  • Wrong or stale endpoint
  • Firewall/NAT blocked mesh port
  • Missing port-forward/public endpoint for internet path

Remote history appears incomplete

Canopy catch-up is bounded and state-aware. A newly connected instance may not immediately receive all historical content in one pass. Keep peers online and connected to complete additional sync rounds.


12) Next docs