This repository was archived by the owner on Feb 12, 2026. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
126 lines (110 loc) · 4.22 KB
/
Makefile
File metadata and controls
126 lines (110 loc) · 4.22 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
.PHONY: help build run test test-coverage clean dev install-tools fmt lint install uninstall run-cluster stop-cluster
# Default target
help:
@echo "Podling - Container Orchestrator"
@echo ""
@echo "Available targets:"
@echo " make build - Build all binaries"
@echo " make run - Run the master controller"
@echo " make dev - Run with hot reloading (Air)"
@echo " make test - Run tests"
@echo " make test-coverage - Run tests with coverage"
@echo " make test-race - Run tests with race detector"
@echo " make fmt - Format code"
@echo " make lint - Run linter"
@echo " make clean - Clean build artifacts"
@echo " make install-tools - Install development tools"
@echo " make install - Install binaries to /usr/local/bin"
@echo " make uninstall - Remove installed binaries"
@echo " make run-cluster - Run master + 2 workers in background"
@echo " make stop-cluster - Stop all running podling processes"
# Build all binaries
build:
@echo "Building master..."
@go build -o bin/podling-master ./cmd/master
@echo "Building worker..."
@go build -o bin/podling-worker ./cmd/worker
@echo "Building CLI..."
@go build -o bin/podling ./cmd/podling
@echo "Build complete!"
# Run master controller
run:
@go run ./cmd/master
# Development mode with hot reloading
dev:
@air
# Run all tests
test:
@go test -v ./...
# Run tests with coverage
test-coverage:
@go test -v -coverprofile=coverage.out ./...
@go tool cover -html=coverage.out -o coverage.html
@echo "Coverage report generated: coverage.html"
# Run tests with race detector
test-race:
@go test -race -v ./...
# Format code
fmt:
@gofmt -s -w .
@go mod tidy
# Run linter (requires golangci-lint)
lint:
@golangci-lint run ./...
# Clean build artifacts
clean:
@rm -rf bin/ tmp/ coverage.out coverage.html
@echo "Cleaned build artifacts"
# Install development tools
install-tools:
@echo "Installing development tools..."
@go install github.com/air-verse/air@latest
@go install github.com/golangci/golangci-lint/cmd/golangci-lint@latest
@echo "Tools installed successfully!"
# Download dependencies
deps:
@go mod download
@go mod verify
# Install binaries to /usr/local/bin
install: build
@echo "Installing binaries to /usr/local/bin..."
@sudo cp bin/podling /usr/local/bin/podling
@sudo cp bin/podling-master /usr/local/bin/podling-master
@sudo cp bin/podling-worker /usr/local/bin/podling-worker
@echo "✓ Installed successfully!"
@echo "You can now use: podling, podling-master, podling-worker"
# Remove installed binaries
uninstall:
@echo "Removing installed binaries..."
@sudo rm -f /usr/local/bin/podling
@sudo rm -f /usr/local/bin/podling-master
@sudo rm -f /usr/local/bin/podling-worker
@echo "✓ Uninstalled successfully!"
# Run cluster with all logs streaming
run-cluster:
@echo "Starting Podling cluster..."
@go build -o bin/podling-master ./cmd/master
@go build -o bin/podling-worker ./cmd/worker
@echo "Starting master..."
@./bin/podling-master > /tmp/podling-master.log 2>&1 & echo $$! > /tmp/podling-master.pid
@sleep 3
@echo "Starting workers..."
@./bin/podling-worker -node-id=worker-1 -port=8071 > /tmp/podling-worker-1.log 2>&1 & echo $$! > /tmp/podling-worker-1.pid
@./bin/podling-worker -node-id=worker-2 -port=8072 > /tmp/podling-worker-2.log 2>&1 & echo $$! > /tmp/podling-worker-2.pid
@sleep 1
@echo "✓ Cluster started!"
@echo " Master: http://localhost:8070"
@echo " Worker 1: http://localhost:8071"
@echo " Worker 2: http://localhost:8072"
@echo ""
@echo "Streaming logs (Ctrl+C to stop)..."
@tail -f /tmp/podling-master.log /tmp/podling-worker-1.log /tmp/podling-worker-2.log
# Stop all podling processes
stop-cluster:
@echo "Stopping Podling cluster..."
@if [ -f /tmp/podling-master.pid ]; then kill $$(cat /tmp/podling-master.pid) 2>/dev/null || true; rm /tmp/podling-master.pid; fi
@if [ -f /tmp/podling-worker-1.pid ]; then kill $$(cat /tmp/podling-worker-1.pid) 2>/dev/null || true; rm /tmp/podling-worker-1.pid; fi
@if [ -f /tmp/podling-worker-2.pid ]; then kill $$(cat /tmp/podling-worker-2.pid) 2>/dev/null || true; rm /tmp/podling-worker-2.pid; fi
@pkill -f podling-master || true
@pkill -f podling-worker || true
@echo "✓ Cluster stopped!"