Music-Credit Graph
Study Lab

Learn the underlying tools and distributed-systems concepts separately from the decisions made for this particular music-credit graph.
Progress stays local

Project build plan

Project decisions are labeled as decisions—not universal truths. The architecture should remain understandable, recoverable, and useful even when the home cluster is unavailable.

1. Goal and product sequence

The project turns music-release credits into evidence-backed paths between artists. It begins with a private seed derived from a personal record collection, expands through adjacent catalog credits, and then scales toward a broader catalog graph.

  1. Static MVP: daily or curated challenges, precomputed evidence paths, and published findings.
  2. Committed phase two: bounded arbitrary two-artist search through a live API.
  3. Later modes: manual relay, hidden contributor, role constraints, and collection-inspired challenges.

2. Logical roles

Role Responsibility in this build Important distinction
Infrastructure control host Runs Ansible and applies repeatable host configuration. An Ansible control node is not the same concept as a Swarm manager, even when one machine performs both roles.
Swarm manager and application-state host Maintains Swarm state; pins PostgreSQL, Redis, canonical snapshots, API, and publishing services. The first version intentionally uses one manager and is therefore not control-plane high availability.
Four Raspberry Pi 3B workers Run bounded, independent worker jobs against versioned read-only graph snapshots. All four should use a 64-bit lightweight OS so production images can target linux/arm64.
Optional workstation-class build node Accelerates full ingest, compaction, image development, and expensive analysis. It may join for heavy work but is not required for public uptime.

3. Selected architecture—with explicit tradeoffs

Selected

Ansible + Docker Swarm

Ansible configures hosts; Swarm places and reconciles containerized services across nodes.

Tradeoff: simpler than a Kubernetes control plane, but less ecosystem depth and only one initial manager.

Selected

Redis + RQ for operational jobs

Independent, retryable tasks such as scoring, validation, challenge generation, and path batches use RQ.

Tradeoff: deliberately simpler than Celery or a coordinated Dask graph.

Optional study

Dask Distributed

Dask is introduced later for a workload whose tasks have real dependencies or benefit from distributed collections and futures.

Selected

Parquet + DuckDB + PostgreSQL

Parquet is the durable analytical layer, DuckDB transforms and validates it, and PostgreSQL stores mutable application state.

Leading design

Memory-mapped adjacency arrays

Compact integer arrays are the current production direction, not a final commitment. They must beat simpler libraries on memory, speed, evidence lookup, and operational complexity.

Selected

Static-first public delivery

The core public experience remains available independently of the home API. Live search degrades gracefully when unavailable.

4. Data and graph flow

Catalog source snapshots
Streaming Python parse
Normalized Parquet
DuckDB transforms
Versioned graph snapshots

The graph starts as a bipartite artist–release graph so every path can retain release-level evidence. An artist-only projection may be derived for selected analyses, but it should not replace the evidence-bearing source graph.

5. Stateful services and snapshot placement

Swarm schedules containers; it does not automatically turn local disks into distributed storage. PostgreSQL, Redis, and canonical graph files are therefore constrained to the state host and backed up there. Workers receive immutable, checksummed graph snapshots and must reject jobs that request a different snapshot version.

Recovery posture: with one manager, worker services may keep running after manager loss, but cluster management requires recovery. The mitigation is documented state backup, reproducible Ansible configuration, versioned data artifacts, and a public application that does not require the cluster.

6. Public and private data boundary

Public Private
Logical roles, tool choices, algorithms, aggregate findings, derived catalog paths, and the fact that four Raspberry Pi 3B workers participate. Collection membership, exact inventory, hostnames, addressing, switch/router models, port maps, mount paths, credentials, deployment commands, backups, and incident notes.

Discogs releases its monthly catalog data dumps—releases, artist names, and credits—under CC0, while collection membership and other user-associated data are restricted. Separately, API access is governed by the Discogs API Terms of Use. The collection is therefore a private seed; public outputs should use derived catalog facts and should follow applicable notices and linking requirements.

7. Alternatives considered

Decision Selected Why not the main alternatives?
Multi-node services Docker Swarm Compose is single-host; K3s adds valuable Kubernetes learning but more control-plane concepts and overhead than this first build needs.
Background work RQ Celery is more feature-rich but heavier; Dask is better when tasks form a dependency graph rather than a queue of mostly independent jobs.
Analytical storage Parquet + DuckDB Putting all normalized credits in PostgreSQL would work, but makes immutable analytical snapshots and broad scans less portable.
Graph execution Benchmark-gated compact arrays NetworkX is ideal for fixtures but object-heavy at scale; a graph database adds a server and query model before measurements show it is needed.
Public availability Static first A live-only application would make home connectivity, maintenance, and power part of the public reliability contract.

8. Implementation phases

Phase Exit condition
Baseline 64-bit Pi OS, repeatable Ansible bootstrap, wired connectivity, storage, and recovery notes.
Swarm skeleton One multi-architecture service runs successfully on every worker, and manager-state backup is tested.
Collection slice Private collection seed plus one-hop catalog expansion produces a manually verified evidence path.
Durable contracts Parquet schema, role taxonomy, stable IDs, manifests, provenance, and PostgreSQL search are versioned.
Medium graph RQ batches, snapshot distribution, challenge generation, and performance measurements work repeatedly.
Graph benchmark gate NetworkX fixtures validate results; compact arrays are compared with at least one optimized graph library before final selection.
Full scale Full-catalog ingest, compact publication, rollback, and reproducible rebuild complete within acceptable resource limits.
Static release Daily challenge and findings remain useful with the home API disabled.
Live search Arbitrary paths are bounded, cached, evidence-backed, observable, and resilient to service unavailability.