Deploy Edge Server in a completely offline environment where devices sync directly with each other using peer-to-peer protocols, without any cloud or internet connectivity.

Use Cases

  • Air-gapped networks: Secure facilities with no external connectivity
  • Edge computing: Factory floors, warehouses, or retail environments
  • Privacy-first deployments: Keep all data local to your network

Basic Configuration

This configuration creates a local mesh network using mDNS for automatic peer discovery:
resources:
  mesh_db:
    resource_type: DittoDatabase
    db_id: "12345678-1234-4123-1234-123456789012"
    device_name: "mesh-node-01"
    auth:
      small_peer_only:
        offline_license_token: "YOUR_OFFLINE_LICENSE"
    transport_config:
      peer_to_peer:
        lan_enabled: true
        lan_mdns_enabled: true  # Auto-discover peers
        lan_multicast_enabled: true
        ble_enabled: false  # Enable if needed for mobile devices

logging:
  ditto_log_config:
    level: info

Advanced Configuration with Static Peers

For networks where mDNS is unavailable or blocked, configure known peers explicitly:
resources:
  # Central hub node
  hub_db:
    resource_type: DittoDatabase
    db_id: "87654321-4321-4123-4321-210987654321"
    device_name: "central-hub"
    auth:
      small_peer_only:
        offline_license_token: "YOUR_OFFLINE_LICENSE"
    persistence_dir:
      path: "/data/ditto-hub"
    transport_config:
      # Accept incoming connections
      listen_config:
        tcp_listen:
          enable: true
          ip: "0.0.0.0"
          port: 4040
      peer_to_peer:
        lan_enabled: true
        lan_mdns_enabled: false  # Disable auto-discovery
    subscriptions:
      - "SELECT * FROM sensors"
      - "SELECT * FROM alerts WHERE priority >= 3"

  # HTTP API for local access
  hub_api:
    resource_type: HttpServer
    db_id: "87654321-4321-4123-4321-210987654321"
    base_path: "api"
    listen_addr: "0.0.0.0:8080"
    http_api: true

  # Edge node configuration (connect to hub)
  edge_db:
    resource_type: DittoDatabase
    db_id: "87654321-4321-4123-4321-210987654321"  # Same ID to form mesh
    device_name: "edge-node-01"
    auth:
      small_peer_only:
        offline_license_token: "YOUR_OFFLINE_LICENSE"
    transport_config:
      connect_config:
        known_tcp_servers:
          - "192.168.1.100:4040"  # Hub IP address
        retry_interval_msec: 5000
      peer_to_peer:
        lan_enabled: true
        lan_mdns_enabled: false

Multi-Transport Mesh

Enable multiple transports for maximum connectivity in challenging environments:
resources:
  resilient_db:
    resource_type: DittoDatabase
    db_id: "11111111-2222-4333-4444-555555555555"
    device_name: "multi-transport-node"
    auth:
      small_peer_only:
        offline_license_token: "YOUR_OFFLINE_LICENSE"
    transport_config:
      # Enable all peer-to-peer transports
      peer_to_peer:
        ble_enabled: true         # For mobile devices
        lan_enabled: true         # For network connectivity
        lan_mdns_enabled: true    # For automatic discovery
        lan_multicast_enabled: true
      # Also listen for TCP connections
      listen_config:
        tcp_listen:
          enable: true
          ip: "0.0.0.0"
          port: 4040
      # Connect to known peers
      connect_config:
        known_tcp_servers:
          - "gateway.local:4040"
        known_ws_servers:
          - "ws://backup.local:8080"
        retry_interval_msec: 10000

Best Practices

Network Configuration

  1. Use static IPs for critical nodes to ensure reliable connections
  2. Test connectivity between nodes using standard network tools before deployment

Licensing

  1. Obtain offline licenses from Ditto support for SmallPeerOnly mode
  2. Track license expiration dates and plan renewals
  3. Test license validation in your deployment environment

Monitoring

  1. Enable logging at appropriate levels for troubleshooting
  2. Use health check endpoints to monitor node status
  3. Track mesh topology to ensure all nodes are connected

Data Management

  1. Configure subscriptions carefully to avoid syncing unnecessary data
  2. Plan storage capacity for each node based on expected data volume
  3. Implement data retention policies at the application level

Troubleshooting

Peers Not Discovering Each Other

If using mDNS discovery:
transport_config:
  peer_to_peer:
    lan_enabled: true
    lan_mdns_enabled: true  # Must be true
Check:
  • Firewall allows UDP port 5353
  • Nodes are on the same network segment
  • mDNS/Bonjour services are running

Connection Refused Errors

For TCP connections:
listen_config:
  tcp_listen:
    enable: true
    ip: "0.0.0.0"  # Accept from any interface
    port: 4040     # Ensure unique port
Verify:
  • Port is not already in use
  • Firewall allows the configured port
  • IP address is correct in known_tcp_servers