fieldwitness/deploy/live-usb/build.sh
Aaron D. Lee 496198d49a
Some checks failed
CI / lint (push) Failing after 55s
CI / typecheck (push) Failing after 31s
Add three-tier deployment infrastructure
Platform pivot from Raspberry Pi to three-tier model:
- Tier 1: Bootable Debian Live USB for field reporters
- Tier 2: Docker/K8s org server for newsrooms
- Tier 3: Docker/K8s federation relay for VPS

Tier 1 — Live USB (deploy/live-usb/):
- build.sh: live-build based image builder for amd64
- Package list: Python + system deps + minimal GUI (openbox + Firefox)
- Install hook: creates venv, pip installs soosef[web,cli,attest,...]
- Hardening hook: disable swap/coredumps, UFW, auto-login to web UI
- systemd service with security hardening (NoNewPrivileges, ProtectSystem)
- Auto-opens Firefox kiosk to http://127.0.0.1:5000 on boot

Tier 2+3 — Docker (deploy/docker/):
- Multi-stage Dockerfile with two targets:
  - server: full web UI + stego + attestation + federation (Tier 2)
  - relay: lightweight FastAPI attestation API only (Tier 3)
- docker-compose.yml with both services and persistent volumes
- .dockerignore for clean builds

Kubernetes (deploy/kubernetes/):
- namespace.yaml, server-deployment.yaml, relay-deployment.yaml
- PVCs, services, health checks, resource limits
- Single-writer strategy (Recreate, not RollingUpdate) for SQLite safety
- README with architecture diagram and deployment instructions

Config presets (deploy/config-presets/):
- low-threat.json: press freedom country (no killswitch, 30min sessions)
- medium-threat.json: restricted press (48h deadman, USB monitoring)
- high-threat.json: conflict zone (12h deadman, tamper monitoring, 5min sessions)
- critical-threat.json: targeted surveillance (127.0.0.1 only, 6h deadman, 3min sessions)

Deployment guide rewritten for three-tier model with RPi as legacy appendix.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-01 22:52:38 -04:00

48 lines
1.1 KiB
Bash
Executable File

#!/usr/bin/env bash
# Build a bootable Debian Live USB image with SooSeF pre-installed.
#
# Prerequisites:
# apt install live-build
#
# Usage:
# cd deploy/live-usb
# sudo ./build.sh
#
# Output: live-image-amd64.hybrid.iso (flash to USB with dd or Balena Etcher)
set -euo pipefail
SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
SOOSEF_ROOT="$(cd "$SCRIPT_DIR/../.." && pwd)"
echo "=== SooSeF Live USB Image Builder ==="
echo "Source: $SOOSEF_ROOT"
echo
cd "$SCRIPT_DIR"
# Clean previous builds
lb clean 2>/dev/null || true
# Configure live-build
lb config \
--distribution bookworm \
--architectures amd64 \
--binary-images iso-hybrid \
--memtest none \
--bootappend-live "boot=live components locales=en_US.UTF-8 keyboard-layouts=us" \
--apt-indices false \
--security true \
--updates true
# Build
echo "Building image (this takes 10-20 minutes)..."
lb build
echo
echo "=== Build complete ==="
echo "Image: $(ls -lh live-image-*.iso 2>/dev/null || echo 'Check for .iso file')"
echo
echo "Flash to USB:"
echo " sudo dd if=live-image-amd64.hybrid.iso of=/dev/sdX bs=4M status=progress"
echo " (replace /dev/sdX with your USB device)"