Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@ help:
@echo " make mcp-telemetry-build - Build and restart the go mcp telemetry server"
@echo " make mcp-pods-build - Build and restart the go mcp pods server"
@echo " make mcp-hub-build - Build and restart the go mcp hub server"
@echo " make all-build - Build and restart all Go services"
@echo " make service-build - Build and restart all go services"
@echo " make mcp-build - Build and restart all MCP servers"
@echo ""
@echo "Host Tier (Systemd & Secrets):"
@echo " make install-services - Install all systemd units"
Expand Down
2 changes: 1 addition & 1 deletion cmd/web/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import (
)

func main() {
if err := web.Build("../../internal/web", "../../dist"); err != nil {
if err := web.Build("./internal/web", "./dist"); err != nil {
log.Fatalf("Site generation failed: %v", err)
}
fmt.Println("Site generated successfully in dist/")
Expand Down
11 changes: 7 additions & 4 deletions internal/mcp/providers/hub.go
Original file line number Diff line number Diff line change
Expand Up @@ -153,13 +153,16 @@ func (p *HubProvider) InspectPlatform(ctx context.Context) (map[string]interface
}

services, _ := p.ListHostServices(ctx)
runningCount := 0
healthyCount := 0
for _, s := range services {
if s.Active == "active" {
runningCount++
// Count as healthy if:
// 1. Service is 'active' (running)
// 2. Service is 'inactive' but the substate is 'dead' (successfully completed oneshot)
if s.Active == "active" || (s.Active == "inactive" && s.Sub == "dead") {
healthyCount++
}
}
summary["host_services_running"] = fmt.Sprintf("%d/%d", runningCount, len(p.targetServices))
summary["host_services_healthy"] = fmt.Sprintf("%d/%d", healthyCount, len(p.targetServices))

return summary, nil
}
6 changes: 3 additions & 3 deletions internal/mcp/providers/hub_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,7 @@ func TestHubProvider_InspectPlatform(t *testing.T) {
kubectlErr: errors.New("connection refused"),
mockSvcOut: "ActiveState=inactive\nSubState=dead\nActiveEnterTimestamp=",
wantK3s: "unreachable",
wantSvc: "0/4",
wantSvc: "4/4",
},
}

Expand Down Expand Up @@ -237,8 +237,8 @@ func TestHubProvider_InspectPlatform(t *testing.T) {
if got["k3s_status"] != tt.wantK3s {
t.Errorf("k3s_status = %v, want %v", got["k3s_status"], tt.wantK3s)
}
if got["host_services_running"] != tt.wantSvc {
t.Errorf("host_services_running = %v, want %v", got["host_services_running"], tt.wantSvc)
if got["host_services_healthy"] != tt.wantSvc {
t.Errorf("host_services_healthy = %v, want %v", got["host_services_healthy"], tt.wantSvc)
}
})
}
Expand Down
45 changes: 28 additions & 17 deletions makefiles/go.mk
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Go Project Configuration
GO_PACKAGES = ./cmd/... ./internal/...

.PHONY: format test test-cov update vet vuln-scan setup-tailwind web-build proxy-build ingestion-build mcp-telemetry-build mcp-pods-build mcp-hub-build all-build
.PHONY: format test test-cov update vet vuln-scan setup-tailwind web-build proxy-build ingestion-build mcp-telemetry-build mcp-pods-build mcp-hub-build service-build mcp-build

format:
@echo "Formatting Go code..." && \
Expand Down Expand Up @@ -29,46 +29,57 @@ vuln-scan:
go run golang.org/x/vuln/cmd/govulncheck@latest $(GO_PACKAGES)

setup-tailwind:
@echo "Downloading tailwind css cli v4..." && \
@echo "Downloading tailwind css cli..." && \
curl -sL https://github.com/tailwindlabs/tailwindcss/releases/latest/download/tailwindcss-linux-x64 -o tailwindcss && \
chmod +x tailwindcss

web-build: setup-tailwind
@echo "Running web build..." && \
@echo "Generating static site..." && \
rm -rf dist && \
mkdir -p dist && \
(cd cmd/web && go build -o ../../web-ssg .) && \
(cd cmd/web && ../../web-ssg) && \
go run ./cmd/web && \
./tailwindcss -i ./internal/web/templates/input.css -o ./dist/styles.css --minify && \
rm web-ssg && \
rm tailwindcss

proxy-build:
@echo "Updating Proxy..." && \
cd cmd/proxy && go build -o ../../bin/proxy_server . && \
sudo systemctl restart proxy.service
go build -o ./bin/proxy_server ./cmd/proxy && \
sudo install -m 755 ./bin/proxy_server /usr/local/bin/proxy_server && \
sudo systemctl restart proxy.service && \
rm ./bin/proxy_server

ingestion-build:
@echo "Updating ingestion service..." && \
cd cmd/ingestion && go build -o ../../bin/ingestion . && \
sudo systemctl restart ingestion.timer
@echo "Updating Ingestion..." && \
go build -o ./bin/ingestion ./cmd/ingestion && \
sudo install -m 755 ./bin/ingestion /usr/local/bin/ingestion && \
sudo systemctl restart ingestion.service && \
rm ./bin/ingestion

mcp-telemetry-build:
@echo "Updating mcp-telemetry..." && \
cd cmd/mcp-telemetry && go build -o ../../bin/mcp_telemetry .
go build -o ./bin/mcp_telemetry ./cmd/mcp-telemetry && \
sudo install -m 755 ./bin/mcp_telemetry /usr/local/bin/mcp_telemetry && \
rm ./bin/mcp_telemetry

mcp-pods-build:
@echo "Updating mcp-pods..." && \
cd cmd/mcp-pods && go build -o ../../bin/mcp_pods .
go build -o ./bin/mcp_pods ./cmd/mcp-pods && \
sudo install -m 755 ./bin/mcp_pods /usr/local/bin/mcp_pods && \
rm ./bin/mcp_pods

mcp-hub-build:
@echo "Updating mcp-hub..." && \
cd cmd/mcp-hub && go build -o ../../bin/mcp_hub .
go build -o ./bin/mcp_hub ./cmd/mcp-hub && \
sudo install -m 755 ./bin/mcp_hub /usr/local/bin/mcp_hub && \
rm ./bin/mcp_hub

all-build:
service-build:
@echo "Building all services..." && \
make proxy-build && \
make ingestion-build && \
make ingestion-build

mcp-build:
@echo "Building all MCP Servers..." && \
make mcp-telemetry-build && \
make mcp-pods-build && \
make mcp-hub-build
make mcp-hub-build
2 changes: 1 addition & 1 deletion systemd/ingestion.service
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ Type=oneshot
User=server2
WorkingDirectory=/home/server2/software/observability-hub
EnvironmentFile=/home/server2/software/observability-hub/.env
ExecStart=/home/server2/software/observability-hub/bin/ingestion
ExecStart=/usr/local/bin/ingestion
StandardOutput=journal
StandardError=journal

Expand Down
2 changes: 1 addition & 1 deletion systemd/proxy.service
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ Type=simple
User=server2
WorkingDirectory=/home/server2/software/observability-hub
EnvironmentFile=/home/server2/software/observability-hub/.env
ExecStart=/home/server2/software/observability-hub/bin/proxy_server
ExecStart=/usr/local/bin/proxy_server
Restart=always
RestartSec=5
StandardOutput=journal
Expand Down