Coordinator Setup

The coordinator runs the darkreach dashboard — an Axum web server that provides the REST API, WebSocket coordination, fleet management, and the real-time UI. Workers connect to it to receive work and report results.

Prerequisites

  • Linux server (Ubuntu 22.04+ recommended)
  • Rust toolchain (1.75+)
  • GMP library (libgmp-dev)
  • PostgreSQL 14+

1. Build from source

bash
# Install dependencies (Ubuntu/Debian)
sudo apt install build-essential libgmp-dev m4 postgresql
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh

# Clone and build
git clone https://github.com/darkreach-ai/darkreach.git
cd darkreach
cargo build --release

2. Configure and run

bash
# Set up PostgreSQL
sudo -u postgres createdb darkreach
export DATABASE_URL="postgres://postgres:password@localhost/darkreach"

# Run the coordinator dashboard
./target/release/darkreach \
  --database-url "$DATABASE_URL" \
  --checkpoint /opt/darkreach/darkreach.checkpoint \
  dashboard --port 7001

The dashboard will be available at http://your-server:7001.

3. Systemd service

For production, run the coordinator as a systemd service with automatic restarts and security hardening.

ini
[Unit]
Description=Darkreach Coordinator (Dashboard)
After=network-online.target
Wants=network-online.target
StartLimitIntervalSec=300
StartLimitBurst=10

[Service]
Type=simple
EnvironmentFile=/opt/darkreach/.env
ExecStart=/usr/local/bin/darkreach \
  --checkpoint /opt/darkreach/darkreach.checkpoint \
  dashboard --port 7001
WorkingDirectory=/opt/darkreach
Restart=always
RestartSec=3

ProtectSystem=strict
ReadWritePaths=/opt/darkreach
ProtectHome=true
NoNewPrivileges=true
PrivateTmp=true

LimitNOFILE=65536
MemoryMax=512M

[Install]
WantedBy=multi-user.target

Install and enable the service:

bash
# Copy binary
sudo cp target/release/darkreach /usr/local/bin/

# Create working directory
sudo mkdir -p /opt/darkreach
echo 'DATABASE_URL=postgres://...' | sudo tee /opt/darkreach/.env

# Install and start service
sudo cp deploy/darkreach-coordinator.service /etc/systemd/system/
sudo systemctl daemon-reload
sudo systemctl enable --now darkreach-coordinator

Configuration Reference

FlagEnv VarDescription
--database-urlDATABASE_URLPostgreSQL connection string
--checkpointCheckpoint file path (default: darkreach.checkpoint)
--portDashboard HTTP port (default: 7001)
--qosSet macOS QoS_CLASS_USER_INITIATED for Rayon threads