diff --git a/Makefile b/Makefile index d4d9195..2f9826c 100644 --- a/Makefile +++ b/Makefile @@ -21,7 +21,7 @@ test-e2e: .PHONY: build clean test run-node run-node2 run-node3 run-example deps tidy fmt vet lint clear-ports -VERSION := 0.53.1 +VERSION := 0.53.3 COMMIT ?= $(shell git rev-parse --short HEAD 2>/dev/null || echo unknown) DATE ?= $(shell date -u +%Y-%m-%dT%H:%M:%SZ) LDFLAGS := -X 'main.version=$(VERSION)' -X 'main.commit=$(COMMIT)' -X 'main.date=$(DATE)' diff --git a/pkg/cli/config_commands.go b/pkg/cli/config_commands.go index 4ae5674..23fed88 100644 --- a/pkg/cli/config_commands.go +++ b/pkg/cli/config_commands.go @@ -422,6 +422,9 @@ database: rqlite_port: %d rqlite_raft_port: %d rqlite_join_address: "%s" + cluster_sync_interval: "30s" + peer_inactivity_limit: "24h" + min_cluster_size: 1 discovery: %s @@ -466,6 +469,9 @@ database: rqlite_port: %d rqlite_raft_port: %d rqlite_join_address: "" + cluster_sync_interval: "30s" + peer_inactivity_limit: "24h" + min_cluster_size: 1 discovery: bootstrap_peers: [] diff --git a/pkg/cli/setup.go b/pkg/cli/setup.go index ad527f1..b78045b 100644 --- a/pkg/cli/setup.go +++ b/pkg/cli/setup.go @@ -960,19 +960,46 @@ WantedBy=multi-user.target } func startServices() { - fmt.Printf("🚀 Starting services...\n") + fmt.Printf("🚀 Starting/Restarting services...\n") - // Start node - if err := exec.Command("systemctl", "start", "debros-node").Run(); err != nil { - fmt.Fprintf(os.Stderr, "⚠️ Failed to start node service: %v\n", err) - } else { - fmt.Printf(" ✓ Node service started\n") + // Helper function to start or restart a service + startOrRestartService := func(serviceName string) { + // Check if service is active/running + checkCmd := exec.Command("systemctl", "is-active", "--quiet", serviceName) + isRunning := checkCmd.Run() == nil + + if isRunning { + // Service is running, restart it + fmt.Printf(" Restarting %s service...\n", serviceName) + if err := exec.Command("systemctl", "restart", serviceName).Run(); err != nil { + fmt.Fprintf(os.Stderr, "⚠️ Failed to restart %s service: %v\n", serviceName, err) + } else { + fmt.Printf(" ✓ %s service restarted\n", serviceName) + } + } else { + // Service is not running, start it + fmt.Printf(" Starting %s service...\n", serviceName) + if err := exec.Command("systemctl", "start", serviceName).Run(); err != nil { + fmt.Fprintf(os.Stderr, "⚠️ Failed to start %s service: %v\n", serviceName, err) + } else { + fmt.Printf(" ✓ %s service started\n", serviceName) + } + } } - // Start gateway - if err := exec.Command("systemctl", "start", "debros-gateway").Run(); err != nil { - fmt.Fprintf(os.Stderr, "⚠️ Failed to start gateway service: %v\n", err) - } else { - fmt.Printf(" ✓ Gateway service started\n") + // Start or restart node service + startOrRestartService("debros-node") + + // Start or restart gateway service + startOrRestartService("debros-gateway") + + // Also restart Anon service if it's running (to pick up any config changes) + if exec.Command("systemctl", "is-active", "--quiet", "anon").Run() == nil { + fmt.Printf(" Restarting Anon service to pick up config changes...\n") + if err := exec.Command("systemctl", "restart", "anon").Run(); err != nil { + fmt.Fprintf(os.Stderr, "⚠️ Failed to restart Anon service: %v\n", err) + } else { + fmt.Printf(" ✓ Anon service restarted\n") + } } }