Complete implementation of the Synor Storage Layer (L2) for decentralized content storage. This enables permanent, censorship-resistant storage of any file type including Next.js apps, Flutter apps, and arbitrary data. Core modules: - cid.rs: Content addressing with Blake3/SHA256 hashing (synor1... format) - chunker.rs: File chunking for parallel upload/download (1MB chunks) - erasure.rs: Reed-Solomon erasure coding (10+4 shards) for fault tolerance - proof.rs: Storage proofs with Merkle trees for verification - deal.rs: Storage deals and market economics (3 pricing tiers) Infrastructure: - node/: Storage node service with P2P networking and local storage - gateway/: HTTP gateway for browser access with LRU caching - Docker deployment with nginx load balancer Architecture: - Operates as L2 alongside Synor L1 blockchain - Storage proofs verified on-chain for reward distribution - Can lose 4 shards per chunk and still recover data - Gateway URLs: /synor1<cid> for content access All 28 unit tests passing.
140 lines
3.4 KiB
YAML
140 lines
3.4 KiB
YAML
# Synor Storage Layer - Docker Compose
|
|
# Decentralized storage network components
|
|
|
|
version: '3.9'
|
|
|
|
services:
|
|
# Storage Node 1
|
|
storage-node-1:
|
|
build:
|
|
context: .
|
|
dockerfile: docker/storage-node/Dockerfile
|
|
container_name: synor-storage-node-1
|
|
hostname: storage-node-1
|
|
restart: unless-stopped
|
|
environment:
|
|
- RUST_LOG=info
|
|
- NODE_ID=storage-node-1
|
|
- L1_RPC=http://synor-node-1:8545
|
|
volumes:
|
|
- storage-node-1-data:/data/storage
|
|
- ./docker/storage-node/config.toml:/config/config.toml:ro
|
|
ports:
|
|
- "4101:4001" # P2P
|
|
- "5101:5001" # API
|
|
- "8101:8080" # Gateway
|
|
networks:
|
|
- synor-storage-net
|
|
- synor-testnet
|
|
depends_on:
|
|
- synor-node-1
|
|
healthcheck:
|
|
test: ["CMD", "curl", "-f", "http://localhost:5001/health"]
|
|
interval: 30s
|
|
timeout: 10s
|
|
retries: 3
|
|
start_period: 10s
|
|
|
|
# Storage Node 2
|
|
storage-node-2:
|
|
build:
|
|
context: .
|
|
dockerfile: docker/storage-node/Dockerfile
|
|
container_name: synor-storage-node-2
|
|
hostname: storage-node-2
|
|
restart: unless-stopped
|
|
environment:
|
|
- RUST_LOG=info
|
|
- NODE_ID=storage-node-2
|
|
- L1_RPC=http://synor-node-1:8545
|
|
- BOOTSTRAP_NODES=/dns4/storage-node-1/tcp/4001
|
|
volumes:
|
|
- storage-node-2-data:/data/storage
|
|
- ./docker/storage-node/config.toml:/config/config.toml:ro
|
|
ports:
|
|
- "4102:4001"
|
|
- "5102:5001"
|
|
- "8102:8080"
|
|
networks:
|
|
- synor-storage-net
|
|
- synor-testnet
|
|
depends_on:
|
|
- storage-node-1
|
|
healthcheck:
|
|
test: ["CMD", "curl", "-f", "http://localhost:5001/health"]
|
|
interval: 30s
|
|
timeout: 10s
|
|
retries: 3
|
|
start_period: 10s
|
|
|
|
# Storage Node 3
|
|
storage-node-3:
|
|
build:
|
|
context: .
|
|
dockerfile: docker/storage-node/Dockerfile
|
|
container_name: synor-storage-node-3
|
|
hostname: storage-node-3
|
|
restart: unless-stopped
|
|
environment:
|
|
- RUST_LOG=info
|
|
- NODE_ID=storage-node-3
|
|
- L1_RPC=http://synor-node-1:8545
|
|
- BOOTSTRAP_NODES=/dns4/storage-node-1/tcp/4001
|
|
volumes:
|
|
- storage-node-3-data:/data/storage
|
|
- ./docker/storage-node/config.toml:/config/config.toml:ro
|
|
ports:
|
|
- "4103:4001"
|
|
- "5103:5001"
|
|
- "8103:8080"
|
|
networks:
|
|
- synor-storage-net
|
|
- synor-testnet
|
|
depends_on:
|
|
- storage-node-1
|
|
healthcheck:
|
|
test: ["CMD", "curl", "-f", "http://localhost:5001/health"]
|
|
interval: 30s
|
|
timeout: 10s
|
|
retries: 3
|
|
start_period: 10s
|
|
|
|
# Public Gateway (load-balanced entry point)
|
|
storage-gateway:
|
|
image: nginx:alpine
|
|
container_name: synor-storage-gateway
|
|
hostname: storage-gateway
|
|
restart: unless-stopped
|
|
volumes:
|
|
- ./docker/storage-gateway/nginx.conf:/etc/nginx/nginx.conf:ro
|
|
ports:
|
|
- "8180:80" # Public gateway
|
|
- "8181:443" # HTTPS (if configured)
|
|
networks:
|
|
- synor-storage-net
|
|
depends_on:
|
|
- storage-node-1
|
|
- storage-node-2
|
|
- storage-node-3
|
|
healthcheck:
|
|
test: ["CMD", "wget", "-q", "--spider", "http://localhost/health"]
|
|
interval: 15s
|
|
timeout: 5s
|
|
retries: 3
|
|
|
|
volumes:
|
|
storage-node-1-data:
|
|
driver: local
|
|
storage-node-2-data:
|
|
driver: local
|
|
storage-node-3-data:
|
|
driver: local
|
|
|
|
networks:
|
|
synor-storage-net:
|
|
driver: bridge
|
|
ipam:
|
|
config:
|
|
- subnet: 172.21.0.0/16
|
|
synor-testnet:
|
|
external: true
|