From 2b17bcdaa214e834586fbb342c58f47c47909a1d Mon Sep 17 00:00:00 2001 From: anonpenguin23 Date: Tue, 11 Nov 2025 16:23:26 +0200 Subject: [PATCH] refactor: remove RQLite as a separate service management entity - Updated production command handling to reflect that RQLite is now managed internally by the node process, eliminating the need for separate service definitions and binary paths. - Adjusted logging and service management functions to streamline operations and improve clarity regarding RQLite's integration. - Enhanced log file creation to be node-type specific, ensuring only relevant logs are generated based on the node type being installed. --- CHANGELOG.md | 14 +++++++++ Makefile | 2 +- pkg/cli/prod_commands.go | 20 +++++------- pkg/environments/production/orchestrator.go | 34 +++++---------------- pkg/environments/production/provisioner.go | 24 ++++++++++----- 5 files changed, 45 insertions(+), 49 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 52ab937..70af0d5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -13,6 +13,20 @@ The format is based on [Keep a Changelog][keepachangelog] and adheres to [Semant ### Deprecated ### Fixed +## [0.69.4] - 2025-11-11 + +### Added +\n +### Changed +- RQLite database management is now integrated directly into the main node process, removing separate RQLite systemd services (debros-rqlite-*). +- Improved log file provisioning to only create necessary log files based on the node type being installed (bootstrap or node). + +### Deprecated + +### Removed + +### Fixed +\n ## [0.69.3] - 2025-11-11 ### Added diff --git a/Makefile b/Makefile index 3479b83..5f48f6f 100644 --- a/Makefile +++ b/Makefile @@ -19,7 +19,7 @@ test-e2e: .PHONY: build clean test run-node run-node2 run-node3 run-example deps tidy fmt vet lint clear-ports install-hooks kill -VERSION := 0.69.3 +VERSION := 0.69.4 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/prod_commands.go b/pkg/cli/prod_commands.go index 9aa0370..5b2f113 100644 --- a/pkg/cli/prod_commands.go +++ b/pkg/cli/prod_commands.go @@ -330,8 +330,7 @@ func handleProdUpgrade(args []string) { "debros-ipfs-cluster-node.service", "debros-ipfs-bootstrap.service", "debros-ipfs-node.service", - "debros-rqlite-bootstrap.service", - "debros-rqlite-node.service", + // Note: RQLite is managed by node process, not as separate service "debros-olric.service", } for _, svc := range services { @@ -515,7 +514,7 @@ func handleProdUpgrade(args []string) { services := []string{ "debros-ipfs-bootstrap", "debros-ipfs-cluster-bootstrap", - "debros-rqlite-bootstrap", + // Note: RQLite is managed by node process, not as separate service "debros-olric", "debros-node-bootstrap", "debros-gateway", @@ -541,8 +540,7 @@ func handleProdStatus() { "debros-ipfs-node", "debros-ipfs-cluster-bootstrap", "debros-ipfs-cluster-node", - "debros-rqlite-bootstrap", - "debros-rqlite-node", + // Note: RQLite is managed by node process, not as separate service "debros-olric", "debros-node-bootstrap", "debros-node-node", @@ -555,11 +553,9 @@ func handleProdStatus() { "debros-ipfs-node": "IPFS Daemon (Node)", "debros-ipfs-cluster-bootstrap": "IPFS Cluster (Bootstrap)", "debros-ipfs-cluster-node": "IPFS Cluster (Node)", - "debros-rqlite-bootstrap": "RQLite Database (Bootstrap)", - "debros-rqlite-node": "RQLite Database (Node)", "debros-olric": "Olric Cache Server", - "debros-node-bootstrap": "DeBros Node (Bootstrap)", - "debros-node-node": "DeBros Node (Node)", + "debros-node-bootstrap": "DeBros Node (Bootstrap) - includes RQLite", + "debros-node-node": "DeBros Node (Node) - includes RQLite", "debros-gateway": "DeBros Gateway", } @@ -626,8 +622,7 @@ func getProductionServices() []string { "debros-node-node", "debros-node-bootstrap", "debros-olric", - "debros-rqlite-bootstrap", - "debros-rqlite-node", + // Note: RQLite is managed by node process, not as separate service "debros-ipfs-cluster-bootstrap", "debros-ipfs-cluster-node", "debros-ipfs-bootstrap", @@ -748,8 +743,7 @@ func handleProdUninstall() { "debros-node-node", "debros-node-bootstrap", "debros-olric", - "debros-rqlite-bootstrap", - "debros-rqlite-node", + // Note: RQLite is managed by node process, not as separate service "debros-ipfs-cluster-bootstrap", "debros-ipfs-cluster-node", "debros-ipfs-bootstrap", diff --git a/pkg/environments/production/orchestrator.go b/pkg/environments/production/orchestrator.go index 457d0d6..94bc975 100644 --- a/pkg/environments/production/orchestrator.go +++ b/pkg/environments/production/orchestrator.go @@ -415,10 +415,7 @@ func (ps *ProductionSetup) Phase5CreateSystemdServices(nodeType string, vpsIP st if err != nil { return fmt.Errorf("ipfs-cluster-service binary not available: %w", err) } - rqliteBinary, err := ps.binaryInstaller.ResolveBinaryPath("rqlited", "/usr/local/bin/rqlited", "/usr/bin/rqlited") - if err != nil { - return fmt.Errorf("rqlited binary not available: %w", err) - } + // Note: rqlited binary is not needed as a separate service - node manages RQLite internally olricBinary, err := ps.binaryInstaller.ResolveBinaryPath("olric-server", "/usr/local/bin/olric-server", "/usr/bin/olric-server") if err != nil { return fmt.Errorf("olric-server binary not available: %w", err) @@ -440,25 +437,8 @@ func (ps *ProductionSetup) Phase5CreateSystemdServices(nodeType string, vpsIP st } ps.logf(" ✓ IPFS Cluster service created: %s", clusterUnitName) - // RQLite service with join address for non-bootstrap nodes - rqliteJoinAddr := "" - if nodeType != "bootstrap" && vpsIP != "" { - rqliteJoinAddr = vpsIP + ":7001" - } - - // Log the advertise configuration for verification - advertiseIP := vpsIP - if advertiseIP == "" { - advertiseIP = "127.0.0.1" - } - ps.logf(" RQLite will advertise: %s (advertise IP: %s)", rqliteJoinAddr, advertiseIP) - - rqliteUnit := ps.serviceGenerator.GenerateRQLiteService(nodeType, rqliteBinary, 5001, 7001, rqliteJoinAddr, advertiseIP) - rqliteUnitName := fmt.Sprintf("debros-rqlite-%s.service", nodeType) - if err := ps.serviceController.WriteServiceUnit(rqliteUnitName, rqliteUnit); err != nil { - return fmt.Errorf("failed to write RQLite service: %w", err) - } - ps.logf(" ✓ RQLite service created: %s", rqliteUnitName) + // Note: RQLite is managed internally by the node process, not as a separate systemd service + ps.logf(" ℹ️ RQLite will be managed by the node process") // Olric service olricUnit := ps.serviceGenerator.GenerateOlricService(olricBinary) @@ -488,8 +468,8 @@ func (ps *ProductionSetup) Phase5CreateSystemdServices(nodeType string, vpsIP st } ps.logf(" ✓ Systemd daemon reloaded") - // Enable services - services := []string{unitName, clusterUnitName, rqliteUnitName, "debros-olric.service", nodeUnitName, "debros-gateway.service"} + // Enable services (RQLite is managed by node, not as separate service) + services := []string{unitName, clusterUnitName, "debros-olric.service", nodeUnitName, "debros-gateway.service"} for _, svc := range services { if err := ps.serviceController.EnableService(svc); err != nil { ps.logf(" ⚠️ Failed to enable %s: %v", svc, err) @@ -501,8 +481,8 @@ func (ps *ProductionSetup) Phase5CreateSystemdServices(nodeType string, vpsIP st // Start services in dependency order ps.logf(" Starting services...") - // Start infrastructure first (IPFS, RQLite, Olric) - infraServices := []string{unitName, rqliteUnitName, "debros-olric.service"} + // Start infrastructure first (IPFS, Olric) - RQLite is managed by node + infraServices := []string{unitName, "debros-olric.service"} for _, svc := range infraServices { if err := ps.serviceController.StartService(svc); err != nil { ps.logf(" ⚠️ Failed to start %s: %v", svc, err) diff --git a/pkg/environments/production/provisioner.go b/pkg/environments/production/provisioner.go index afb38d0..e9afcfb 100644 --- a/pkg/environments/production/provisioner.go +++ b/pkg/environments/production/provisioner.go @@ -55,18 +55,26 @@ func (fp *FilesystemProvisioner) EnsureDirectoryStructure(nodeType string) error } // Create log files with correct permissions so systemd can write to them + // Only create logs for the specific nodeType being installed logsDir := filepath.Join(fp.debrosDir, "logs") logFiles := []string{ "olric.log", "gateway.log", - "ipfs-bootstrap.log", - "ipfs-cluster-bootstrap.log", - "rqlite-bootstrap.log", - "node-bootstrap.log", - "ipfs-node.log", - "ipfs-cluster-node.log", - "rqlite-node.log", - "node-node.log", + } + + // Add node-type-specific log files only if nodeType is specified + if nodeType == "bootstrap" { + logFiles = append(logFiles, + "ipfs-bootstrap.log", + "ipfs-cluster-bootstrap.log", + "node-bootstrap.log", + ) + } else if nodeType == "node" { + logFiles = append(logFiles, + "ipfs-node.log", + "ipfs-cluster-node.log", + "node-node.log", + ) } for _, logFile := range logFiles {