Documentation ¶
Index ¶
- Constants
- func LoadConfigFromFile(path string) (*config.SmartNodeConfig, error)
- func SaveConfig(cfg *config.SmartNodeConfig, directory string, filename string) error
- func SyncRatioToPercent(in float64) float64
- type Client
- func (c *Client) CheckIfContainerExists(containerName string) (bool, error)
- func (c *Client) CreateUserDir() error
- func (c *Client) DeleteImage(imageName string) error
- func (c *Client) DeleteVolume(volumeName string) error
- func (c *Client) DockerSystemPrune(deleteAllImages bool) error
- func (c *Client) GetAllDockerImages() ([]DockerImage, error)
- func (c *Client) GetClientVolumeName(containerName, volumeTarget string) (string, error)
- func (c *Client) GetClientVolumeSource(containerName string, volumeTarget string) (string, error)
- func (c *Client) GetComposeImages(composeFiles []string) ([]string, error)
- func (c *Client) GetDirSizeViaEcMigrator(container string, targetDir string) (uint64, error)
- func (c *Client) GetDocker() (*docker.Client, error)
- func (c *Client) GetDockerContainerShutdownTime(containerName string) (time.Time, error)
- func (c *Client) GetDockerImage(containerName string) (string, error)
- func (c *Client) GetDockerStatus(containerName string) (string, error)
- func (c *Client) GetServiceVersion() (string, error)
- func (c *Client) GetVolumeSize(volumeName string) (int64, error)
- func (c *Client) InstallService(verbose bool, noDeps bool, version string, path string, useLocalInstaller bool) error
- func (c *Client) InstallUpdateTracker(verbose bool, version string, useLocalInstaller bool) error
- func (c *Client) LoadBackupConfig() (*config.SmartNodeConfig, error)
- func (c *Client) LoadConfig() (*config.SmartNodeConfig, bool, error)
- func (c *Client) PauseService(composeFiles []string) error
- func (c *Client) PrintNodeLogs(composeFiles []string, tail string, logPaths ...string) error
- func (c *Client) PrintServiceCompose(composeFiles []string) error
- func (c *Client) PrintServiceLogs(composeFiles []string, tail string, serviceNames ...string) error
- func (c *Client) PrintServiceStats(composeFiles []string) error
- func (c *Client) PrintServiceStatus(composeFiles []string) error
- func (c *Client) PurgeAllKeys(composeFiles []string) error
- func (c *Client) RemoveContainer(containerName string) error
- func (c *Client) RestartContainer(containerName string) error
- func (c *Client) RunEcMigrator(container string, volume string, targetDir string, mode string) error
- func (c *Client) RunNethermindPruneStarter(executionContainerName string, pruneStarterContainerName string) error
- func (c *Client) RunPruneProvisioner(container string, volume string) error
- func (c *Client) SaveConfig(cfg *config.SmartNodeConfig) error
- func (c *Client) StartContainer(containerName string) error
- func (c *Client) StartService(composeFiles []string) error
- func (c *Client) StopContainer(containerName string) error
- func (c *Client) StopService(composeFiles []string) error
- func (c *Client) TerminateService(composeFiles []string, configPath string) error
- func (c *Client) UpdateAlertmanagerConfiguration(cfg *config.SmartNodeConfig) error
- func (c *Client) UpdateGrafanaDatabaseConfiguration(cfg *config.SmartNodeConfig) error
- func (c *Client) UpdatePrometheusConfiguration(cfg *config.SmartNodeConfig) error
- type DockerImage
Constants ¶
const ( InstallerName string = "install.sh" UpdateTrackerInstallerName string = "install-update-tracker.sh" InstallerURL string = "https://github.com/rocket-pool/smartnode/releases/download/%s/" + InstallerName UpdateTrackerURL string = "https://github.com/rocket-pool/smartnode/releases/download/%s/" + UpdateTrackerInstallerName SettingsFile string = "user-settings.yml" BackupSettingsFile string = "user-settings-backup.yml" )
Config
Variables ¶
This section is empty.
Functions ¶
func LoadConfigFromFile ¶
func LoadConfigFromFile(path string) (*config.SmartNodeConfig, error)
Loads a config without updating it if it exists
func SaveConfig ¶
func SaveConfig(cfg *config.SmartNodeConfig, directory string, filename string) error
Saves a config
func SyncRatioToPercent ¶
When printing sync percents, we should avoid printing 100%. This function is only called if we're still syncing, and the `%0.2f` token will round up if we're above 99.99%.
Types ¶
type Client ¶
type Client struct { Api *client.ApiClient Context *context.SmartNodeContext Logger *slog.Logger // contains filtered or unexported fields }
Rocket Pool client
func NewClientFromCtx ¶
Create new Rocket Pool client from CLI context
func (*Client) CheckIfContainerExists ¶
Check if a container with the provided name exists
func (*Client) CreateUserDir ¶
Create the user config directory
func (*Client) DeleteVolume ¶
Deletes a volume
func (*Client) DockerSystemPrune ¶
Derived from https://github.com/docker/cli/blob/ced099660009713e0e845eeb754e6050dbaa45d0/cli/command/system/prune.go#L71
func (*Client) GetAllDockerImages ¶
func (c *Client) GetAllDockerImages() ([]DockerImage, error)
Returns all Docker images on the system
func (*Client) GetClientVolumeName ¶
Gets the name of the client volume
func (*Client) GetClientVolumeSource ¶
Gets the absolute file path of the client volume
func (*Client) GetComposeImages ¶
Returns the images used by each service in compose file in "repository:tag" format (assuming that is the format specified in the compose files)
func (*Client) GetDirSizeViaEcMigrator ¶
Gets the size of the target directory via the EC migrator for importing, which should have the same permissions as exporting
func (*Client) GetDockerContainerShutdownTime ¶
Get the time that the given container shut down
func (*Client) GetDockerImage ¶
Get the current Docker image used by the given container
func (*Client) GetDockerStatus ¶
Get the current Docker image used by the given container
func (*Client) GetServiceVersion ¶
Get the Rocket Pool service version
func (*Client) GetVolumeSize ¶
Gets the disk usage of the given volume
func (*Client) InstallService ¶
func (c *Client) InstallService(verbose bool, noDeps bool, version string, path string, useLocalInstaller bool) error
Install the Rocket Pool service
func (*Client) InstallUpdateTracker ¶
Install the update tracker
func (*Client) LoadBackupConfig ¶
func (c *Client) LoadBackupConfig() (*config.SmartNodeConfig, error)
Load the backup config
func (*Client) LoadConfig ¶
func (c *Client) LoadConfig() (*config.SmartNodeConfig, bool, error)
Load the config Returns the RocketPoolConfig and whether or not it was newly generated
func (*Client) PauseService ¶
Pause the Rocket Pool service
func (*Client) PrintNodeLogs ¶
Print the daemon logs
func (*Client) PrintServiceCompose ¶
Print the Rocket Pool service compose config
func (*Client) PrintServiceLogs ¶
Print the Rocket Pool service logs
func (*Client) PrintServiceStats ¶
Print the Rocket Pool service stats
func (*Client) PrintServiceStatus ¶
Print the Rocket Pool service status
func (*Client) PurgeAllKeys ¶
Deletes the node wallet and all validator keys, and restarts the Docker containers
func (*Client) RemoveContainer ¶
Deletes a container
func (*Client) RestartContainer ¶
Restart a container
func (*Client) RunEcMigrator ¶
func (c *Client) RunEcMigrator(container string, volume string, targetDir string, mode string) error
Runs the EC migrator
func (*Client) RunNethermindPruneStarter ¶
func (c *Client) RunNethermindPruneStarter(executionContainerName string, pruneStarterContainerName string) error
Runs the prune provisioner
func (*Client) RunPruneProvisioner ¶
Runs the prune provisioner
func (*Client) SaveConfig ¶
func (c *Client) SaveConfig(cfg *config.SmartNodeConfig) error
Save the config
func (*Client) StartContainer ¶
Start a container
func (*Client) StartService ¶
Start the Rocket Pool service
func (*Client) StopContainer ¶
Shut down a container
func (*Client) StopService ¶
Stop the Rocket Pool service
func (*Client) TerminateService ¶
Stop the Rocket Pool service and remove the config folder
func (*Client) UpdateAlertmanagerConfiguration ¶
func (c *Client) UpdateAlertmanagerConfiguration(cfg *config.SmartNodeConfig) error
Load the alerting configuration templates, do the template variable substitutions, and save them.
func (*Client) UpdateGrafanaDatabaseConfiguration ¶
func (c *Client) UpdateGrafanaDatabaseConfiguration(cfg *config.SmartNodeConfig) error
Load the Grafana config template, do a template variable substitution, and save it
func (*Client) UpdatePrometheusConfiguration ¶
func (c *Client) UpdatePrometheusConfiguration(cfg *config.SmartNodeConfig) error
Load the Prometheus template, do a template variable substitution, and save it
type DockerImage ¶
func (*DockerImage) String ¶
func (img *DockerImage) String() string