urapt is a self-hostable APT repository server with a companion CLI for pushing and managing Debian .deb packages. Server (urapt-server): - REST API + APT endpoint, SQLite storage (pure-Go modernc driver, no CGO) - .deb files stored content-addressed on disk, reference-counted for dedup - Server-managed RSA-4096 OpenPGP signing key (ProtonMail/go-crypto) - APT indices (Release/InRelease/Packages[.gz/.xz]) generated on demand from the DB, cached in memory, signed with the server key - Full APT model: repositories -> distributions -> components -> architectures - Bearer-token auth for REST; HTTP Basic auth for private-repo APT reads - First registrant becomes admin; repo-scoped permissions (read/write/read-write/admin) plus owner and server-admin roles - Multipart package push with control-field extraction, list/show/delete, pool serving, blob ref-count cleanup - Audit log CLI (urapt): - register/login/logout/whoami, token management - repo/distro/component/arch CRUD, member management - push/pull/ls/show/rm for packages - apt-config helper that emits apt setup commands (key, sources.list, auth.conf for private repos) Packaging & docs: - Dockerfile (multi-stage distroless), docker-compose.yml, sample config - README quick start, architecture overview, config reference, security notes - PLAN.md design blueprint, CHANGELOG.md, GPL-3.0 LICENSE - GitHub Actions CI (test, lint, cross-build for linux/darwin amd64/arm64) - Makefile release target producing static binaries + tarballs + checksums Tests cover the data-access layer, auth/permission checks, APT index generation, .deb parsing, GPG signing, the REST API, and the typed API client. Verified end-to-end on a Raspberry Pi (arm64) pushing and installing a real package.
70 lines
2.1 KiB
Makefile
70 lines
2.1 KiB
Makefile
BINARY_SERVER := urapt-server
|
|
BINARY_CLI := urapt
|
|
GO := go
|
|
LDFLAGS := -s -w
|
|
|
|
# Version is injected into the binary via -X. Falls back to the git describe
|
|
# output (tag or commit), then to "dev" when not in a git checkout.
|
|
VERSION ?= $(shell git describe --tags --always --dirty 2>/dev/null || echo dev)
|
|
RELEASE_LDFLAGS := -s -w -X urapt/shared/version.Version=$(VERSION)
|
|
|
|
# Release targets: <goos>-<goarch>. Windows is omitted (no apt client there).
|
|
RELEASE_TARGETS := linux-amd64 linux-arm64 darwin-amd64 darwin-arm64
|
|
|
|
.PHONY: all build build-server build-cli test vet fmt lint run-server run-cli clean tidy release release-binaries checksums
|
|
|
|
all: build
|
|
|
|
build: build-server build-cli
|
|
|
|
build-server:
|
|
$(GO) build -ldflags "$(LDFLAGS)" -o $(BINARY_SERVER) ./cmd/urapt-server
|
|
|
|
build-cli:
|
|
$(GO) build -ldflags "$(LDFLAGS)" -o $(BINARY_CLI) ./cmd/urapt
|
|
|
|
test:
|
|
$(GO) test ./...
|
|
|
|
vet:
|
|
$(GO) vet ./...
|
|
|
|
fmt:
|
|
$(GO) fmt ./...
|
|
|
|
lint: vet
|
|
@command -v golangci-lint >/dev/null 2>&1 && golangci-lint run ./... || echo "golangci-lint not installed; skipping"
|
|
|
|
run-server: build-server
|
|
./$(BINARY_SERVER)
|
|
|
|
run-cli: build-cli
|
|
./$(BINARY_CLI)
|
|
|
|
tidy:
|
|
$(GO) mod tidy
|
|
|
|
clean:
|
|
rm -f $(BINARY_SERVER) $(BINARY_CLI)
|
|
rm -rf bin/ dist/
|
|
|
|
# release builds static, CGO-free binaries for all release targets into dist/,
|
|
# bundles each pair (server + CLI) into a tar.gz, and produces a checksums file.
|
|
release: release-binaries checksums
|
|
|
|
release-binaries:
|
|
@mkdir -p dist
|
|
@for target in $(RELEASE_TARGETS); do \
|
|
os=$${target%-*}; \
|
|
arch=$${target#*-}; \
|
|
echo "==> building $$os/$$arch"; \
|
|
GOOS=$$os GOARCH=$$arch CGO_ENABLED=0 $(GO) build -trimpath -ldflags "$(RELEASE_LDFLAGS)" -o dist/$(BINARY_SERVER)-$$os-$$arch ./cmd/urapt-server; \
|
|
GOOS=$$os GOARCH=$$arch CGO_ENABLED=0 $(GO) build -trimpath -ldflags "$(RELEASE_LDFLAGS)" -o dist/$(BINARY_CLI)-$$os-$$arch ./cmd/urapt; \
|
|
tar -czf dist/urapt-$(VERSION)-$$os-$$arch.tar.gz -C dist $(BINARY_SERVER)-$$os-$$arch $(BINARY_CLI)-$$os-$$arch; \
|
|
done
|
|
@echo "==> release artifacts in dist/"
|
|
|
|
checksums:
|
|
@cd dist && sha256sum *.tar.gz > checksums-$(VERSION).txt
|
|
@echo "==> wrote dist/checksums-$(VERSION).txt"
|