Files
silo/Makefile
Forbes 88d1ab1f97 refactor(storage): remove MinIO backend, filesystem-only storage
Remove the MinIO/S3 storage backend entirely. The filesystem backend is
fully implemented, already used in production, and a migrate-storage tool
exists for any remaining MinIO deployments to migrate beforehand.

Changes:
- Delete MinIO client implementation (internal/storage/storage.go)
- Delete migrate-storage tool (cmd/migrate-storage, scripts/migrate-storage.sh)
- Remove MinIO service, volumes, and env vars from all Docker Compose files
- Simplify StorageConfig: remove Endpoint, AccessKey, SecretKey, Bucket,
  UseSSL, Region fields; add SILO_STORAGE_ROOT_DIR env override
- Change all SQL COALESCE defaults from 'minio' to 'filesystem'
- Add migration 020 to update column defaults to 'filesystem'
- Remove minio-go/v7 dependency (go mod tidy)
- Update all config examples, setup scripts, docs, and tests
2026-02-19 14:36:22 -06:00

188 lines
5.4 KiB
Makefile

.PHONY: build run test test-integration clean migrate fmt lint \
docker-build docker-up docker-down docker-logs docker-ps \
docker-clean docker-rebuild \
web-install web-dev web-build
# =============================================================================
# Local Development
# =============================================================================
# Build all binaries (frontend + backend)
build: web-build
go build -o silo ./cmd/silo
go build -o silod ./cmd/silod
go build -o silorunner ./cmd/silorunner
# Run the API server locally
run:
go run ./cmd/silod -config config.yaml
# Run the CLI
cli:
go run ./cmd/silo $(ARGS)
# Run unit tests (integration tests skipped without TEST_DATABASE_URL)
test:
go test -v ./...
# Run all tests including integration tests (requires PostgreSQL)
test-integration:
TEST_DATABASE_URL="postgres://silo:silodev@localhost:5432/silo_test?sslmode=disable" go test -v -count=1 ./...
# Clean build artifacts
clean:
rm -f silo silod silorunner
rm -f *.out
rm -rf web/dist
# Format code
fmt:
go fmt ./...
goimports -w .
# Lint code
lint:
golangci-lint run
# Tidy dependencies
tidy:
go mod tidy
# =============================================================================
# Database
# =============================================================================
# Run database migrations (requires SILO_DB_* environment variables)
migrate:
./scripts/init-db.sh
# Connect to database (requires psql)
db-shell:
PGPASSWORD=$${SILO_DB_PASSWORD:-silodev} psql -h $${SILO_DB_HOST:-localhost} -U $${SILO_DB_USER:-silo} -d $${SILO_DB_NAME:-silo}
# =============================================================================
# Docker
# =============================================================================
# Build Docker image
docker-build:
docker build -t silo:latest -f build/package/Dockerfile .
# Start the full stack (postgres + silo)
docker-up:
docker compose -f deployments/docker-compose.yaml up -d
# Start with rebuild
docker-up-build:
docker compose -f deployments/docker-compose.yaml up -d --build
# Stop the stack
docker-down:
docker compose -f deployments/docker-compose.yaml down
# Stop and remove volumes (WARNING: deletes data)
docker-clean:
docker compose -f deployments/docker-compose.yaml down -v
# View logs
docker-logs:
docker compose -f deployments/docker-compose.yaml logs -f
# View logs for specific service
docker-logs-silo:
docker compose -f deployments/docker-compose.yaml logs -f silo
docker-logs-postgres:
docker compose -f deployments/docker-compose.yaml logs -f postgres
# Show running containers
docker-ps:
docker compose -f deployments/docker-compose.yaml ps
# Rebuild and restart
docker-rebuild: docker-down docker-build docker-up
# Shell into silo container
docker-shell:
docker compose -f deployments/docker-compose.yaml exec silo /bin/sh
# =============================================================================
# API Testing
# =============================================================================
# Test health endpoint
api-health:
curl -s http://localhost:8080/health | jq .
# Test ready endpoint
api-ready:
curl -s http://localhost:8080/ready | jq .
# List schemas
api-schemas:
curl -s http://localhost:8080/api/schemas | jq .
# List items
api-items:
curl -s http://localhost:8080/api/items | jq .
# Create sample item
api-create-item:
curl -s -X POST http://localhost:8080/api/items \
-H "Content-Type: application/json" \
-d '{"schema":"kindred-rd","project":"CS100","category":"F01","material":"316","description":"Test screw"}' | jq .
# =============================================================================
# Web Frontend
# =============================================================================
web-install:
cd web && npm ci
web-dev:
cd web && npm run dev
web-build:
cd web && npm run build
# =============================================================================
# Help
# =============================================================================
help:
@echo "Silo Makefile targets:"
@echo ""
@echo "Local Development:"
@echo " build - Build CLI and server binaries"
@echo " run - Run API server locally"
@echo " cli ARGS=... - Run CLI with arguments"
@echo " test - Run unit tests (integration tests skip without DB)"
@echo " test-integration - Run all tests including integration (needs PostgreSQL)"
@echo " fmt - Format code"
@echo " lint - Run linter"
@echo " tidy - Tidy go.mod"
@echo ""
@echo "Docker:"
@echo " docker-build - Build Docker image"
@echo " docker-up - Start full stack (postgres + silo)"
@echo " docker-down - Stop the stack"
@echo " docker-clean - Stop and remove volumes (deletes data)"
@echo " docker-logs - View all logs"
@echo " docker-ps - Show running containers"
@echo " docker-rebuild - Rebuild and restart"
@echo ""
@echo "Database:"
@echo " migrate - Run database migrations"
@echo " db-shell - Connect to database with psql"
@echo ""
@echo "API Testing:"
@echo " api-health - Test health endpoint"
@echo " api-schemas - List schemas"
@echo " api-items - List items"
@echo " api-create-item - Create a test item"
@echo ""
@echo "Web Frontend:"
@echo " web-install - Install npm dependencies"
@echo " web-dev - Start Vite dev server"
@echo " web-build - Build production bundle"