utils

package
v0.102.2-nightly Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 11, 2026 License: AGPL-3.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrServiceNotFound = errors.New("service not found")
View Source
var NamespaceServiceOrder = []string{"rqlite", "olric", "gateway"}

NamespaceServiceOrder defines the dependency order for namespace services. RQLite must start first (database), then Olric (cache), then Gateway (depends on both).

View Source
var ServicePorts = map[string][]PortSpec{
	"debros-gateway": {
		{Name: "Gateway API", Port: constants.GatewayAPIPort},
	},
	"debros-olric": {
		{Name: "Olric HTTP", Port: constants.OlricHTTPPort},
		{Name: "Olric Memberlist", Port: constants.OlricMemberlistPort},
	},
	"debros-node": {
		{Name: "RQLite HTTP", Port: constants.RQLiteHTTPPort},
		{Name: "RQLite Raft", Port: constants.RQLiteRaftPort},
	},
	"debros-ipfs": {
		{Name: "IPFS API", Port: 4501},
		{Name: "IPFS Gateway", Port: 8080},
		{Name: "IPFS Swarm", Port: 4101},
	},
	"debros-ipfs-cluster": {
		{Name: "IPFS Cluster API", Port: 9094},
	},
}

Functions

func EnsurePortsAvailable

func EnsurePortsAvailable(action string, ports []PortSpec) error

EnsurePortsAvailable checks if the specified ports are available. If a port is in use, it identifies the process and gives actionable guidance.

func GetProductionServices

func GetProductionServices() []string

GetProductionServices returns a list of all DeBros production service names that exist, including both global services and namespace-specific services

func IsServiceActive

func IsServiceActive(service string) (bool, error)

IsServiceActive checks if a systemd service is currently active (running)

func IsServiceEnabled

func IsServiceEnabled(service string) (bool, error)

IsServiceEnabled checks if a systemd service is enabled to start on boot

func IsServiceMasked

func IsServiceMasked(service string) (bool, error)

IsServiceMasked checks if a systemd service is masked

func NormalizePeers

func NormalizePeers(peersStr string) ([]string, error)

NormalizePeers normalizes and validates peer multiaddrs

func ResolveServiceName

func ResolveServiceName(alias string) ([]string, error)

ResolveServiceName resolves service aliases to actual systemd service names

func ShowDryRunSummary

func ShowDryRunSummary(vpsIP, domain, branch string, peers []string, joinAddress string, isFirstNode bool, oramaDir string)

ShowDryRunSummary displays what would be done during installation without making changes

func ShowDryRunSummaryWithRelay

func ShowDryRunSummaryWithRelay(vpsIP, domain, branch string, peers []string, joinAddress string, isFirstNode bool, oramaDir string, relayInfo *AnyoneRelayDryRunInfo)

ShowDryRunSummaryWithRelay displays what would be done during installation with optional relay info

func StartServicesOrdered

func StartServicesOrdered(services []string, action string)

StartServicesOrdered starts services respecting namespace dependency order. Namespace services are started in order: rqlite → olric (+ wait) → gateway. Non-namespace services are started after. The action parameter is the systemctl command (e.g., "start" or "restart").

func ValidateDNSRecord

func ValidateDNSRecord(domain, expectedIP string) error

ValidateDNSRecord validates that the domain points to the expected IP address Returns nil if DNS is valid, warning message if DNS doesn't match but continues, or error if DNS lookup fails completely

func ValidateGeneratedConfig

func ValidateGeneratedConfig(oramaDir string) error

ValidateGeneratedConfig loads and validates the generated node configuration

Types

type AnyoneRelayDryRunInfo

type AnyoneRelayDryRunInfo struct {
	Enabled  bool
	Exit     bool
	Nickname string
	Contact  string
	Wallet   string
	ORPort   int
}

AnyoneRelayDryRunInfo contains Anyone relay info for dry-run summary

type IPFSClusterPeerInfo

type IPFSClusterPeerInfo struct {
	PeerID string
	Addrs  []string
}

IPFSClusterPeerInfo contains IPFS Cluster peer information for cluster discovery

type IPFSPeerInfo

type IPFSPeerInfo struct {
	PeerID string
	Addrs  []string
}

IPFSPeerInfo holds IPFS peer information for configuring Peering.Peers

type PortSpec

type PortSpec struct {
	Name string
	Port int
}

PortSpec defines a port and its name for checking availability

func CollectPortsForServices

func CollectPortsForServices(services []string, skipActive bool) ([]PortSpec, error)

CollectPortsForServices returns a list of ports used by the specified services

func DefaultPorts

func DefaultPorts() []PortSpec

DefaultPorts is used for fresh installs/upgrades before unit files exist.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL