mirror of
https://github.com/DeBrosOfficial/network.git
synced 2025-12-13 02:48:49 +00:00
Merge pull request #64 from DeBrosOfficial/nightly
feat: enhance service management and configuration options
This commit is contained in:
commit
cc74a8f135
2
Makefile
2
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)'
|
||||
|
||||
@ -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: []
|
||||
|
||||
@ -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")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user