Files
baby-nas/Makefile
T
darroyo 27a52d2986 feat: add mergerfs mover and snapraid integration
New 'Almacenamiento' page with:
- Auto-detection of rsync, mergerfs, snapraid binaries and mergerfs mount
- Configurable pool settings (source/dest, macOS cleanup, rsync flags)
- Mergerfs mover with dry-run preview and live SSE output streaming
- SnapRAID diff/sync/scrub/check with live SSE output
- Async job system (1 concurrent job) with SSE streaming
- Job history table

Backend:
- internal/storage/ package with capabilities, mergerfs, snapraid, jobs
- storage_config and storage_jobs DB tables (migration 0008)
- GET/PUT /api/storage/config, GET /api/storage/capabilities
- POST/GET /api/storage/jobs, GET /api/storage/jobs/{id}/stream
- Storage operations disabled when NASCTL_EXEC_SYSTEM=false

Closes #new-feature
2026-07-06 23:23:22 -04:00

47 lines
1.9 KiB
Makefile

BINARY=nasctl
VERSION?=0.7.0
GO?=go
LDFLAGS=-s -w -X github.com/darroyo/nasctl/internal/web.Version=$(VERSION) -X github.com/darroyo/nasctl/internal/web.Commit=$(shell git rev-parse --short HEAD 2>/dev/null || echo unknown)
BUILD_FLAGS=CGO_ENABLED=0
.PHONY: build build-all frontend run package clean tidy test
frontend:
cd web && npm install && npm run build
build: frontend
$(BUILD_FLAGS) $(GO) build -ldflags "$(LDFLAGS)" -o bin/$(BINARY) ./cmd/nasctl
# build-go builds the binary without rebuilding the frontend (dist must exist).
build-go:
$(BUILD_FLAGS) $(GO) build -ldflags "$(LDFLAGS)" -o bin/$(BINARY) ./cmd/nasctl
build-all: frontend
$(BUILD_FLAGS) GOOS=linux GOARCH=amd64 $(GO) build -ldflags "$(LDFLAGS)" -o bin/$(BINARY)-linux-amd64 ./cmd/nasctl
$(BUILD_FLAGS) GOOS=linux GOARCH=arm64 $(GO) build -ldflags "$(LDFLAGS)" -o bin/$(BINARY)-linux-arm64 ./cmd/nasctl
run: build
NASCTL_DB=$${NASCTL_DB:-./.data/nasctl.db} \
NASCTL_SMB_CONF=$${NASCTL_SMB_CONF:-./.data/smb.conf} \
NASCTL_EXPORTS=$${NASCTL_EXPORTS:-./.data/exports} \
NASCTL_EXEC_SYSTEM=false \
./bin/$(BINARY) --addr :8080
package: build-all
@mkdir -p dist/deb/usr/local/bin dist/deb/etc/systemd/system dist/deb/DEBIAN
cp bin/$(BINARY)-linux-amd64 dist/deb/usr/local/bin/$(BINARY)
cp systemd/nasctl.service dist/deb/etc/systemd/system/$(BINARY).service
printf 'Package: nasctl\nVersion: $(VERSION)\nSection: utils\nPriority: optional\nArchitecture: amd64\nMaintainer: nasctl\nDescription: Monolithic NAS control plane\n' > dist/deb/DEBIAN/control
printf '#!/bin/sh\nset -e\ninstall -d /var/lib/nasctl\nsystemctl daemon-reload\nsystemctl enable nasctl.service || true\nsystemctl try-restart nasctl.service\n' > dist/deb/DEBIAN/postinst
chmod 0755 dist/deb/DEBIAN/postinst
dpkg-deb --build dist/deb dist/nasctl_$(VERSION)_amd64.deb
clean:
rm -rf bin dist .data web/node_modules web/.tsbuild
tidy:
$(GO) mod tidy
test:
$(GO) test ./...