119 lines
3.9 KiB
Makefile
119 lines
3.9 KiB
Makefile
.PHONY: build build-web run run-manager run-runner cleanup cleanup-manager cleanup-runner kill-all clean-bin clean-web test help install
|
|
|
|
# Build the jiggablend binary (includes embedded web UI)
|
|
build: clean-bin build-web
|
|
go build -o bin/jiggablend ./cmd/jiggablend
|
|
|
|
# Build for Linux (cross-compile)
|
|
build-linux: clean-bin build-web
|
|
GOOS=linux GOARCH=amd64 go build -o bin/jiggablend ./cmd/jiggablend
|
|
|
|
# Build web UI
|
|
build-web: clean-web
|
|
cd web && npm install && npm run build
|
|
|
|
# Cleanup manager logs
|
|
cleanup-manager:
|
|
@echo "Cleaning up manager logs..."
|
|
@rm -rf logs/manager.log 2>/dev/null || true
|
|
@echo "Manager cleanup complete"
|
|
|
|
# Cleanup runner logs
|
|
cleanup-runner:
|
|
@echo "Cleaning up runner logs..."
|
|
@rm -rf logs/runner*.log 2>/dev/null || true
|
|
@echo "Runner cleanup complete"
|
|
|
|
# Cleanup both manager and runner logs
|
|
cleanup: cleanup-manager cleanup-runner
|
|
|
|
# Kill all jiggablend processes
|
|
kill-all:
|
|
@echo "Not implemented"
|
|
|
|
# Run manager and runner in parallel (for testing)
|
|
run: cleanup build init-test
|
|
@echo "Starting manager and runner in parallel..."
|
|
@echo "Press Ctrl+C to stop both..."
|
|
@trap 'kill $$MANAGER_PID $$RUNNER_PID 2>/dev/null; exit' INT TERM; \
|
|
bin/jiggablend manager & \
|
|
MANAGER_PID=$$!; \
|
|
sleep 2; \
|
|
bin/jiggablend runner --api-key=jk_r0_test_key_123456789012345678901234567890 & \
|
|
RUNNER_PID=$$!; \
|
|
wait $$MANAGER_PID $$RUNNER_PID
|
|
|
|
# Run manager server
|
|
run-manager: cleanup-manager build init-test
|
|
bin/jiggablend manager
|
|
|
|
# Run runner
|
|
run-runner: cleanup-runner build
|
|
bin/jiggablend runner --api-key=jk_r0_test_key_123456789012345678901234567890
|
|
|
|
# Initialize for testing (first run setup)
|
|
init-test: build
|
|
@echo "Initializing test configuration..."
|
|
bin/jiggablend manager config enable localauth
|
|
bin/jiggablend manager config set fixed-apikey jk_r0_test_key_123456789012345678901234567890 -f -y
|
|
bin/jiggablend manager config add user test@example.com testpassword --admin -f -y
|
|
@echo "Test configuration complete!"
|
|
@echo "fixed api key: jk_r0_test_key_123456789012345678901234567890"
|
|
@echo "test user: test@example.com"
|
|
@echo "test password: testpassword"
|
|
|
|
# Clean bin build artifacts
|
|
clean-bin:
|
|
rm -rf bin/
|
|
|
|
# Clean web build artifacts
|
|
clean-web:
|
|
rm -rf web/dist/
|
|
|
|
# Run tests
|
|
test:
|
|
go test ./... -timeout 30s
|
|
|
|
# Install to /usr/local/bin
|
|
install: build
|
|
sudo cp bin/jiggablend /usr/local/bin/
|
|
|
|
# Show help
|
|
help:
|
|
@echo "Jiggablend Build and Run Makefile"
|
|
@echo ""
|
|
@echo "Build targets:"
|
|
@echo " build - Build jiggablend binary with embedded web UI"
|
|
@echo " build-linux - Cross-compile for Linux amd64"
|
|
@echo " build-web - Build web UI only"
|
|
@echo ""
|
|
@echo "Run targets:"
|
|
@echo " run - Run manager and runner in parallel (for testing)"
|
|
@echo " run-manager - Run manager server"
|
|
@echo " run-runner - Run runner with test API key"
|
|
@echo " init-test - Initialize test configuration (run once)"
|
|
@echo ""
|
|
@echo "Cleanup targets:"
|
|
@echo " cleanup - Clean all logs"
|
|
@echo " cleanup-manager - Clean manager logs"
|
|
@echo " cleanup-runner - Clean runner logs"
|
|
@echo " kill-all - Kill all running jiggablend processes"
|
|
@echo ""
|
|
@echo "Other targets:"
|
|
@echo " clean-bin - Clean build artifacts"
|
|
@echo " clean-web - Clean web build artifacts"
|
|
@echo " test - Run Go tests"
|
|
@echo " install - Install to /usr/local/bin"
|
|
@echo " help - Show this help"
|
|
@echo ""
|
|
@echo "CLI Usage:"
|
|
@echo " jiggablend manager serve - Start the manager server"
|
|
@echo " jiggablend runner - Start a runner"
|
|
@echo " jiggablend manager config show - Show configuration"
|
|
@echo " jiggablend manager config enable localauth"
|
|
@echo " jiggablend manager config add user --email=x --password=y"
|
|
@echo " jiggablend manager config add apikey --name=mykey"
|
|
@echo " jiggablend manager config set fixed-apikey <key>"
|
|
@echo " jiggablend manager config list users"
|
|
@echo " jiggablend manager config list apikeys"
|