feat: pluggable storage backends with Docker volumes and /data/ layout
Introduces the storage.Backend interface for pluggable container mount management. The Docker implementation (DockerBackend) is the MVP — no NFS/SMB/S3, just Docker volumes + bind mounts. /data/ volume layout: /data/worktree/ — bind mount of host worktree (always) /data/repo/ — per-repo Docker volume (when persistent_storage = true) /data/cache/go/ — shared GOMODCACHE volume /data/cache/node/— shared npm cache volume /data/cache/pnpm/— shared pnpm store volume /data/cache/pip/ — shared pip cache volume /data/cache/cargo/— shared Rust cargo cache volume /data/task.json — boot-time brief (existing WriteTaskJSON) Changes: - internal/storage/: Backend interface, DockerBackend, Mount types, ecosystem-to-cache-volume mapping, ConvertMounts helper - container.Pool.Acquire: now accepts []storage.Mount instead of hardcoding a single bind mount — mount list comes from the storage backend - daemon.process(): calls d.Storage.Setup() to build the mount list, passes Ecosystem + PersistentStorage from repo config - config.Repo.PersistentStorage: when true, a named Docker volume (archie-repo-<owner>-<repo>) is mounted at /data/repo and survives task completion - main.go: creates DockerBackend when containers are enabled 21 tests: interface contract, ecosystem cache mounts (go/node/ python/rust/custom), worktree bind mount ordering, persistent storage on/off/empty-owner guard, mount list sort+dedup, adversarial (nonexistent worktree, empty ecosystem, unknown ecosystem). Why: daemon-managed cache volumes mean warm GOMODCACHE/npm cache across tasks. Per-repo persistent volumes preserve expensive build artifacts. The interface leaves room for future backends without rewiring container orchestration.
This commit is contained in:
1 parent
a9a3f7b3f9
commit
7dbb17a4cb
6 files changed
+651
-15
No files matched your search
@@ -21,8 +21,11 @@ import (
|
||||
"github.com/samcharles93/archie-core/internal/events"
|
||||
"github.com/samcharles93/archie-core/internal/forge"
|
||||
"github.com/samcharles93/archie-core/internal/nats"
|
||||
"github.com/moby/moby/client"
|
||||
|
||||
"github.com/samcharles93/archie-core/internal/plugin"
|
||||
"github.com/samcharles93/archie-core/internal/plugin/pluginextract"
|
||||
"github.com/samcharles93/archie-core/internal/storage"
|
||||
"github.com/samcharles93/archie-core/internal/store"
|
||||
"github.com/samcharles93/archie-core/internal/webui"
|
||||
"github.com/samcharles93/archie-core/internal/workflow/skillbuild"
|
||||
@@ -124,6 +127,7 @@ func run() int {
|
||||
|
||||
// Container pool (optional — no containers when [containers] is absent).
|
||||
var containerPool *container.Pool
|
||||
var storeBackend storage.Backend
|
||||
if cfg.Containers.Enabled {
|
||||
containerPool, err = container.NewPool(ctx, container.Config{
|
||||
Image: cfg.Containers.Image,
|
||||
@@ -136,6 +140,14 @@ func run() int {
|
||||
return 1
|
||||
}
|
||||
defer containerPool.Close()
|
||||
|
||||
// Storage backend — Docker volume management for cache mounts.
|
||||
dockerCli, err := client.New(client.FromEnv)
|
||||
if err != nil {
|
||||
log.Error("docker client for storage failed", "err", err)
|
||||
return 1
|
||||
}
|
||||
storeBackend = storage.NewDockerBackend(dockerCli)
|
||||
}
|
||||
|
||||
providers := executionProviders(cfg)
|
||||
@@ -210,6 +222,7 @@ func run() int {
|
||||
Agent: agentRunner,
|
||||
Workflows: registry,
|
||||
PluginRegistry: pluginReg,
|
||||
Storage: storeBackend,
|
||||
Log: log,
|
||||
CustomStages: wfeval.Discover,
|
||||
Nats: natsClient,
|
||||
|
||||
Reference in new issue
Block a user