production

package
v0.72.2 Latest Latest
Warning

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

Go to latest
Published: Dec 9, 2025 License: AGPL-3.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ReadBranchPreference

func ReadBranchPreference(oramaDir string) string

ReadBranchPreference reads the stored branch preference from disk

func SaveBranchPreference

func SaveBranchPreference(oramaDir, branch string) error

SaveBranchPreference saves the branch preference to disk

func ValidateClusterSecret

func ValidateClusterSecret(secret string) error

ValidateClusterSecret ensures a cluster secret is 32 bytes of hex

Types

type ArchitectureDetector

type ArchitectureDetector struct{}

ArchitectureDetector detects the system architecture

func (*ArchitectureDetector) Detect

func (ad *ArchitectureDetector) Detect() (string, error)

Detect returns the detected architecture as a string usable for downloads

type BinaryInstaller

type BinaryInstaller struct {
	// contains filtered or unexported fields
}

BinaryInstaller handles downloading and installing external binaries

func NewBinaryInstaller

func NewBinaryInstaller(arch string, logWriter io.Writer) *BinaryInstaller

NewBinaryInstaller creates a new binary installer

func (*BinaryInstaller) GetClusterPeerMultiaddr

func (bi *BinaryInstaller) GetClusterPeerMultiaddr(clusterPath string, nodeIP string) (string, error)

GetClusterPeerMultiaddr reads the IPFS Cluster peer ID and returns its multiaddress Returns format: /ip4/<ip>/tcp/9098/p2p/<cluster-peer-id>

func (*BinaryInstaller) InitializeIPFSClusterConfig

func (bi *BinaryInstaller) InitializeIPFSClusterConfig(clusterPath, clusterSecret string, ipfsAPIPort int, clusterPeers []string) error

InitializeIPFSClusterConfig initializes IPFS Cluster configuration (unified - no bootstrap/node distinction) This runs `ipfs-cluster-service init` to create the service.json configuration file. For existing installations, it ensures the cluster secret is up to date. clusterPeers should be in format: ["/ip4/<ip>/tcp/9098/p2p/<cluster-peer-id>"]

func (*BinaryInstaller) InitializeIPFSRepo

func (bi *BinaryInstaller) InitializeIPFSRepo(ipfsRepoPath string, swarmKeyPath string, apiPort, gatewayPort, swarmPort int, ipfsPeer *IPFSPeerInfo) error

InitializeIPFSRepo initializes an IPFS repository for a node (unified - no bootstrap/node distinction) If ipfsPeer is provided, configures Peering.Peers for peer discovery in private networks

func (*BinaryInstaller) InitializeRQLiteDataDir

func (bi *BinaryInstaller) InitializeRQLiteDataDir(dataDir string) error

InitializeRQLiteDataDir initializes RQLite data directory

func (*BinaryInstaller) InstallAnyoneClient added in v0.72.0

func (bi *BinaryInstaller) InstallAnyoneClient() error

InstallAnyoneClient installs the anyone-client npm package globally

func (*BinaryInstaller) InstallDeBrosBinaries

func (bi *BinaryInstaller) InstallDeBrosBinaries(branch string, oramaHome string, skipRepoUpdate bool) error

InstallDeBrosBinaries clones and builds DeBros binaries

func (*BinaryInstaller) InstallGo

func (bi *BinaryInstaller) InstallGo() error

InstallGo downloads and installs Go toolchain

func (*BinaryInstaller) InstallIPFS

func (bi *BinaryInstaller) InstallIPFS() error

InstallIPFS downloads and installs IPFS (Kubo) Follows official steps from https://docs.ipfs.tech/install/command-line/

func (*BinaryInstaller) InstallIPFSCluster

func (bi *BinaryInstaller) InstallIPFSCluster() error

InstallIPFSCluster downloads and installs IPFS Cluster Service

func (*BinaryInstaller) InstallOlric

func (bi *BinaryInstaller) InstallOlric() error

InstallOlric downloads and installs Olric server

func (*BinaryInstaller) InstallRQLite

func (bi *BinaryInstaller) InstallRQLite() error

InstallRQLite downloads and installs RQLite

func (*BinaryInstaller) InstallSystemDependencies

func (bi *BinaryInstaller) InstallSystemDependencies() error

InstallSystemDependencies installs system-level dependencies via apt

func (*BinaryInstaller) ResolveBinaryPath

func (bi *BinaryInstaller) ResolveBinaryPath(binary string, extraPaths ...string) (string, error)

ResolveBinaryPath finds the fully-qualified path to a required executable

type ConfigGenerator

type ConfigGenerator struct {
	// contains filtered or unexported fields
}

ConfigGenerator manages generation of node, gateway, and service configs

func NewConfigGenerator

func NewConfigGenerator(oramaDir string) *ConfigGenerator

NewConfigGenerator creates a new config generator

func (*ConfigGenerator) GenerateGatewayConfig

func (cg *ConfigGenerator) GenerateGatewayConfig(peerAddresses []string, enableHTTPS bool, domain string, olricServers []string) (string, error)

GenerateGatewayConfig generates gateway.yaml configuration

func (*ConfigGenerator) GenerateNodeConfig

func (cg *ConfigGenerator) GenerateNodeConfig(peerAddresses []string, vpsIP string, joinAddress string, domain string, enableHTTPS bool) (string, error)

GenerateNodeConfig generates node.yaml configuration (unified architecture)

func (*ConfigGenerator) GenerateOlricConfig

func (cg *ConfigGenerator) GenerateOlricConfig(serverBindAddr string, httpPort int, memberlistBindAddr string, memberlistPort int, memberlistEnv string) (string, error)

GenerateOlricConfig generates Olric configuration

type Dependency

type Dependency struct {
	Name        string
	Command     string
	Optional    bool
	InstallHint string
}

Dependency represents an external binary dependency

type DependencyChecker

type DependencyChecker struct {
	// contains filtered or unexported fields
}

DependencyChecker validates external tool availability

func NewDependencyChecker

func NewDependencyChecker(skipOptional bool) *DependencyChecker

NewDependencyChecker creates a new checker

func (*DependencyChecker) CheckAll

func (dc *DependencyChecker) CheckAll() ([]Dependency, error)

CheckAll validates all required dependencies

type ExternalToolChecker

type ExternalToolChecker struct{}

ExternalToolChecker validates external tool versions and availability

func (*ExternalToolChecker) CheckAnonAvailable

func (etc *ExternalToolChecker) CheckAnonAvailable() bool

CheckAnonAvailable checks if Anon is available (optional)

func (*ExternalToolChecker) CheckGoAvailable

func (etc *ExternalToolChecker) CheckGoAvailable() bool

CheckGoAvailable checks if Go is installed

func (*ExternalToolChecker) CheckIPFSAvailable

func (etc *ExternalToolChecker) CheckIPFSAvailable() bool

CheckIPFSAvailable checks if IPFS is available in PATH

func (*ExternalToolChecker) CheckIPFSClusterAvailable

func (etc *ExternalToolChecker) CheckIPFSClusterAvailable() bool

CheckIPFSClusterAvailable checks if IPFS Cluster Service is available

func (*ExternalToolChecker) CheckOlricAvailable

func (etc *ExternalToolChecker) CheckOlricAvailable() bool

CheckOlricAvailable checks if Olric Server is available

func (*ExternalToolChecker) CheckRQLiteAvailable

func (etc *ExternalToolChecker) CheckRQLiteAvailable() bool

CheckRQLiteAvailable checks if RQLite is available

type FilesystemProvisioner

type FilesystemProvisioner struct {
	// contains filtered or unexported fields
}

FilesystemProvisioner manages directory creation and permissions

func NewFilesystemProvisioner

func NewFilesystemProvisioner(oramaHome string) *FilesystemProvisioner

NewFilesystemProvisioner creates a new provisioner

func (*FilesystemProvisioner) EnsureDirectoryStructure

func (fp *FilesystemProvisioner) EnsureDirectoryStructure() error

EnsureDirectoryStructure creates all required directories (unified structure)

func (*FilesystemProvisioner) FixOwnership

func (fp *FilesystemProvisioner) FixOwnership() error

FixOwnership changes ownership of .orama directory to debros user

type IPFSClusterPeerInfo added in v0.72.0

type IPFSClusterPeerInfo struct {
	PeerID string   // Cluster peer ID (different from IPFS peer ID)
	Addrs  []string // Cluster multiaddresses (e.g., /ip4/x.x.x.x/tcp/9098)
}

IPFSClusterPeerInfo contains IPFS Cluster peer information for cluster peer discovery

type IPFSPeerInfo added in v0.72.0

type IPFSPeerInfo struct {
	PeerID string
	Addrs  []string
}

IPFSPeerInfo holds IPFS peer information for configuring Peering.Peers

type OSDetector

type OSDetector struct{}

OSDetector detects the Linux distribution

func (*OSDetector) Detect

func (od *OSDetector) Detect() (*OSInfo, error)

Detect returns information about the detected OS

func (*OSDetector) IsSupportedOS

func (od *OSDetector) IsSupportedOS(info *OSInfo) bool

IsSupportedOS checks if the OS is supported for production deployment

type OSInfo

type OSInfo struct {
	ID      string // ubuntu, debian, etc.
	Version string // 22.04, 24.04, 12, etc.
	Name    string // Full name: "ubuntu 24.04"
}

OSInfo contains detected operating system information

type PortChecker added in v0.72.0

type PortChecker struct{}

PortChecker checks if ports are available or in use

func NewPortChecker added in v0.72.0

func NewPortChecker() *PortChecker

NewPortChecker creates a new port checker

func (*PortChecker) IsPortInUse added in v0.72.0

func (pc *PortChecker) IsPortInUse(port int) bool

IsPortInUse checks if a specific port is already in use

func (*PortChecker) IsPortInUseOnHost added in v0.72.0

func (pc *PortChecker) IsPortInUseOnHost(host string, port int) bool

IsPortInUseOnHost checks if a port is in use on a specific host

type PrivilegeChecker

type PrivilegeChecker struct{}

PrivilegeChecker validates root access and user context

func (*PrivilegeChecker) CheckLinuxOS

func (pc *PrivilegeChecker) CheckLinuxOS() error

CheckLinuxOS verifies the process is running on Linux

func (*PrivilegeChecker) CheckRoot

func (pc *PrivilegeChecker) CheckRoot() error

CheckRoot verifies the process is running as root

type ProductionSetup

type ProductionSetup struct {
	NodePeerID string // Captured during Phase3 for later display
	// contains filtered or unexported fields
}

ProductionSetup orchestrates the entire production deployment

func NewProductionSetup

func NewProductionSetup(oramaHome string, logWriter io.Writer, forceReconfigure bool, branch string, skipRepoUpdate bool, skipResourceChecks bool) *ProductionSetup

NewProductionSetup creates a new production setup orchestrator

func (*ProductionSetup) IsUpdate

func (ps *ProductionSetup) IsUpdate() bool

IsUpdate detects if this is an update to an existing installation

func (*ProductionSetup) LogSetupComplete

func (ps *ProductionSetup) LogSetupComplete(peerID string)

LogSetupComplete logs completion information

func (*ProductionSetup) Phase1CheckPrerequisites

func (ps *ProductionSetup) Phase1CheckPrerequisites() error

Phase1CheckPrerequisites performs initial environment validation

func (*ProductionSetup) Phase2ProvisionEnvironment

func (ps *ProductionSetup) Phase2ProvisionEnvironment() error

Phase2ProvisionEnvironment sets up users and filesystems

func (*ProductionSetup) Phase2bInstallBinaries

func (ps *ProductionSetup) Phase2bInstallBinaries() error

Phase2bInstallBinaries installs external binaries and DeBros components

func (*ProductionSetup) Phase2cInitializeServices

func (ps *ProductionSetup) Phase2cInitializeServices(peerAddresses []string, vpsIP string, ipfsPeer *IPFSPeerInfo, ipfsClusterPeer *IPFSClusterPeerInfo) error

Phase2cInitializeServices initializes service repositories and configurations ipfsPeer can be nil for the first node, or contain peer info for joining nodes ipfsClusterPeer can be nil for the first node, or contain IPFS Cluster peer info for joining nodes

func (*ProductionSetup) Phase3GenerateSecrets

func (ps *ProductionSetup) Phase3GenerateSecrets() error

Phase3GenerateSecrets generates shared secrets and keys

func (*ProductionSetup) Phase4GenerateConfigs

func (ps *ProductionSetup) Phase4GenerateConfigs(peerAddresses []string, vpsIP string, enableHTTPS bool, domain string, joinAddress string) error

Phase4GenerateConfigs generates node, gateway, and service configs

func (*ProductionSetup) Phase5CreateSystemdServices

func (ps *ProductionSetup) Phase5CreateSystemdServices(enableHTTPS bool) error

Phase5CreateSystemdServices creates and enables systemd units enableHTTPS determines the RQLite Raft port (7002 when SNI is enabled, 7001 otherwise)

type ResourceChecker

type ResourceChecker struct{}

ResourceChecker validates system resources for production deployment

func NewResourceChecker

func NewResourceChecker() *ResourceChecker

NewResourceChecker creates a new resource checker

func (*ResourceChecker) CheckCPU

func (rc *ResourceChecker) CheckCPU() error

CheckCPU validates sufficient CPU cores (minimum 2 cores)

func (*ResourceChecker) CheckDiskSpace

func (rc *ResourceChecker) CheckDiskSpace(path string) error

CheckDiskSpace validates sufficient disk space (minimum 10GB free)

func (*ResourceChecker) CheckRAM

func (rc *ResourceChecker) CheckRAM() error

CheckRAM validates sufficient RAM (minimum 2GB total)

type SecretGenerator

type SecretGenerator struct {
	// contains filtered or unexported fields
}

SecretGenerator manages generation of shared secrets and keys

func NewSecretGenerator

func NewSecretGenerator(oramaDir string) *SecretGenerator

NewSecretGenerator creates a new secret generator

func (*SecretGenerator) EnsureClusterSecret

func (sg *SecretGenerator) EnsureClusterSecret() (string, error)

EnsureClusterSecret gets or generates the IPFS Cluster secret

func (*SecretGenerator) EnsureNodeIdentity

func (sg *SecretGenerator) EnsureNodeIdentity() (peer.ID, error)

EnsureNodeIdentity gets or generates the node's LibP2P identity (unified - no bootstrap/node distinction)

func (*SecretGenerator) EnsureSwarmKey

func (sg *SecretGenerator) EnsureSwarmKey() ([]byte, error)

EnsureSwarmKey gets or generates the IPFS private swarm key

func (*SecretGenerator) SaveConfig

func (sg *SecretGenerator) SaveConfig(filename string, content string) error

SaveConfig writes a configuration file to disk

type StateDetector

type StateDetector struct {
	// contains filtered or unexported fields
}

StateDetector checks for existing production state

func NewStateDetector

func NewStateDetector(oramaDir string) *StateDetector

NewStateDetector creates a state detector

func (*StateDetector) CheckBinaryInstallation

func (sd *StateDetector) CheckBinaryInstallation() error

CheckBinaryInstallation checks if required binaries are in PATH

func (*StateDetector) HasIPFSData

func (sd *StateDetector) HasIPFSData() bool

HasIPFSData checks if IPFS repo is initialized (unified path)

func (*StateDetector) HasRQLiteData

func (sd *StateDetector) HasRQLiteData() bool

HasRQLiteData checks if RQLite data exists (unified path)

func (*StateDetector) HasSecrets

func (sd *StateDetector) HasSecrets() bool

HasSecrets checks if cluster secret and swarm key exist

func (*StateDetector) IsConfigured

func (sd *StateDetector) IsConfigured() bool

IsConfigured checks if basic configs exist

type SystemdController

type SystemdController struct {
	// contains filtered or unexported fields
}

SystemdController manages systemd service operations

func NewSystemdController

func NewSystemdController() *SystemdController

NewSystemdController creates a new controller

func (*SystemdController) DaemonReload

func (sc *SystemdController) DaemonReload() error

DaemonReload reloads the systemd daemon

func (*SystemdController) EnableService

func (sc *SystemdController) EnableService(name string) error

EnableService enables a service to start on boot

func (*SystemdController) RestartService

func (sc *SystemdController) RestartService(name string) error

RestartService restarts a service

func (*SystemdController) StartService

func (sc *SystemdController) StartService(name string) error

StartService starts a service immediately

func (*SystemdController) StatusService

func (sc *SystemdController) StatusService(name string) (bool, error)

StatusService gets the status of a service

func (*SystemdController) StopService

func (sc *SystemdController) StopService(name string) error

StopService stops a service

func (*SystemdController) WriteServiceUnit

func (sc *SystemdController) WriteServiceUnit(name string, content string) error

WriteServiceUnit writes a systemd unit file

type SystemdServiceGenerator

type SystemdServiceGenerator struct {
	// contains filtered or unexported fields
}

SystemdServiceGenerator generates systemd unit files

func NewSystemdServiceGenerator

func NewSystemdServiceGenerator(oramaHome, oramaDir string) *SystemdServiceGenerator

NewSystemdServiceGenerator creates a new service generator

func (*SystemdServiceGenerator) GenerateAnyoneClientService added in v0.72.0

func (ssg *SystemdServiceGenerator) GenerateAnyoneClientService() string

GenerateAnyoneClientService generates the Anyone Client SOCKS5 proxy systemd unit

func (*SystemdServiceGenerator) GenerateGatewayService

func (ssg *SystemdServiceGenerator) GenerateGatewayService() string

GenerateGatewayService generates the DeBros Gateway systemd unit

func (*SystemdServiceGenerator) GenerateIPFSClusterService

func (ssg *SystemdServiceGenerator) GenerateIPFSClusterService(clusterBinary string) string

GenerateIPFSClusterService generates the IPFS Cluster systemd unit

func (*SystemdServiceGenerator) GenerateIPFSService

func (ssg *SystemdServiceGenerator) GenerateIPFSService(ipfsBinary string) string

GenerateIPFSService generates the IPFS daemon systemd unit

func (*SystemdServiceGenerator) GenerateNodeService

func (ssg *SystemdServiceGenerator) GenerateNodeService() string

GenerateNodeService generates the DeBros Node systemd unit

func (*SystemdServiceGenerator) GenerateOlricService

func (ssg *SystemdServiceGenerator) GenerateOlricService(olricBinary string) string

GenerateOlricService generates the Olric systemd unit

func (*SystemdServiceGenerator) GenerateRQLiteService

func (ssg *SystemdServiceGenerator) GenerateRQLiteService(rqliteBinary string, httpPort, raftPort int, joinAddr string, advertiseIP string) string

GenerateRQLiteService generates the RQLite systemd unit

type UserProvisioner

type UserProvisioner struct {
	// contains filtered or unexported fields
}

UserProvisioner manages system user creation and sudoers setup

func NewUserProvisioner

func NewUserProvisioner(username, home, shell string) *UserProvisioner

NewUserProvisioner creates a new user provisioner

func (*UserProvisioner) CreateUser

func (up *UserProvisioner) CreateUser() error

CreateUser creates the system user

func (*UserProvisioner) SetupSudoersAccess

func (up *UserProvisioner) SetupSudoersAccess(invokerUser string) error

SetupSudoersAccess creates sudoers rule for the invoking user

func (*UserProvisioner) UserExists

func (up *UserProvisioner) UserExists() bool

UserExists checks if the system user exists

Jump to

Keyboard shortcuts

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