Quick Start
This guide walks you through deploying BigBrotr using Docker Compose. You’ll have a fully functional Nostr archiving system running in minutes.
Prerequisites
Section titled “Prerequisites”- Docker and Docker Compose installed
- Git for cloning the repository
- At least 4GB RAM recommended
- 10GB+ disk space for initial data
Step 1: Clone the Repository
Section titled “Step 1: Clone the Repository”git clone https://github.com/bigbrotr/bigbrotr.gitcd bigbrotrStep 2: Configure Environment
Section titled “Step 2: Configure Environment”Navigate to the BigBrotr implementation and create your environment file:
cd implementations/bigbrotrcp .env.example .envEdit the .env file to set your database password:
# Required: Set a secure passwordDB_PASSWORD=your_secure_password_here
# Optional: For NIP-66 write testsMONITOR_PRIVATE_KEY=your_hex_private_keyStep 3: Start Services
Section titled “Step 3: Start Services”Launch all services with Docker Compose:
docker-compose up -dThis starts the following services:
| Service | Description | Port |
|---|---|---|
| postgres | PostgreSQL 16 database | 5432 |
| pgbouncer | Connection pooling | 6432 |
| tor | SOCKS5 proxy for .onion relays | 9050 |
| initializer | Database bootstrap (one-shot) | - |
| finder | Relay discovery | - |
| monitor | Health monitoring | - |
| synchronizer | Event collection | - |
Step 4: Verify Deployment
Section titled “Step 4: Verify Deployment”Watch the initializer complete:
docker-compose logs -f initializerYou should see output indicating successful schema verification and relay seeding:
INFO initializer: schema_verified extensions=2 tables=7 procedures=6 views=1INFO initializer: relays_seeded count=8865INFO initializer: initialization_completeCheck all services are running:
docker-compose psStep 5: Access the Database
Section titled “Step 5: Access the Database”Connect to PostgreSQL to verify data:
docker-compose exec postgres psql -U admin -d bigbrotrCheck relay count:
SELECT COUNT(*) FROM relays;-- Expected: ~8865 initially
SELECT network, COUNT(*) FROM relays GROUP BY network;-- Shows clearnet vs tor distributionCheck latest relay metadata:
SELECT relay_url, nip66_openable, nip66_readableFROM relay_metadata_latestWHERE nip66_openable = trueLIMIT 10;What Happens Next?
Section titled “What Happens Next?”After initialization, the services operate continuously:
- Finder discovers new relays every hour from nostr.watch APIs
- Monitor checks relay health every hour (NIP-11/NIP-66)
- Synchronizer collects events every 15 minutes from readable relays
Common Operations
Section titled “Common Operations”View Service Logs
Section titled “View Service Logs”# All servicesdocker-compose logs -f
# Specific servicedocker-compose logs -f synchronizerStop Services
Section titled “Stop Services”docker-compose downReset Everything
Section titled “Reset Everything”docker-compose downrm -rf data/postgresdocker-compose up -dRestart a Service
Section titled “Restart a Service”docker-compose restart monitorUsing LilBrotr (Lightweight)
Section titled “Using LilBrotr (Lightweight)”For a lightweight deployment that indexes events without storing tags and content (~60% disk savings):
cd implementations/lilbrotrcp .env.example .envnano .env # Set DB_PASSWORDdocker-compose up -dLilBrotr uses different ports to avoid conflicts:
- PostgreSQL: 5433
- PGBouncer: 6433
- Tor: 9051
See Implementations for detailed comparison.
Manual Deployment (Without Docker)
Section titled “Manual Deployment (Without Docker)”For development or custom deployments:
# Create virtual environmentpython3 -m venv .venvsource .venv/bin/activate
# Install dependenciespip install -r requirements.txt
# Set environmentexport DB_PASSWORD=your_secure_password
# Run services (from implementations/bigbrotr/)cd implementations/bigbrotrpython -m services initializerpython -m services finder &python -m services monitor &python -m services synchronizer &Next Steps
Section titled “Next Steps”- Learn about the Architecture
- Explore individual Services
- Understand the Database Schema
- Customize Configuration