client

package
v2.0.0-dev2.0...-efbdfda Latest Latest
Warning

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

Go to latest
Published: Apr 16, 2024 License: GPL-3.0 Imports: 35 Imported by: 16

Documentation

Index

Constants

View Source
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

func SyncRatioToPercent(in float64) float64

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

func NewClientFromCtx(c *cli.Context) *Client

Create new Rocket Pool client from CLI context without checking for sync status Only use this function from commands that may work if the Daemon service doesn't exist Most users should call NewClientFromCtx(c).WithStatus() or NewClientFromCtx(c).WithReady()

func (*Client) CheckIfContainerExists

func (c *Client) CheckIfContainerExists(containerName string) (bool, error)

Check if a container with the provided name exists

func (*Client) DeleteImage

func (c *Client) DeleteImage(imageName string) error

Deletes an image

func (*Client) DeleteVolume

func (c *Client) DeleteVolume(volumeName string) error

Deletes a volume

func (*Client) GetAllDockerImages

func (c *Client) GetAllDockerImages() ([]DockerImage, error)

Returns all Docker images on the system

func (*Client) GetClientVolumeName

func (c *Client) GetClientVolumeName(containerName, volumeTarget string) (string, error)

Gets the name of the client volume

func (*Client) GetClientVolumeSource

func (c *Client) GetClientVolumeSource(containerName string, volumeTarget string) (string, error)

Gets the absolute file path of the client volume

func (*Client) GetComposeImages

func (c *Client) GetComposeImages(composeFiles []string) ([]string, error)

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

func (c *Client) GetDirSizeViaEcMigrator(container string, targetDir string) (uint64, error)

Gets the size of the target directory via the EC migrator for importing, which should have the same permissions as exporting

func (*Client) GetDocker

func (c *Client) GetDocker() (*docker.Client, error)

Get the Docker client

func (*Client) GetDockerContainerShutdownTime

func (c *Client) GetDockerContainerShutdownTime(containerName string) (time.Time, error)

Get the time that the given container shut down

func (*Client) GetDockerImage

func (c *Client) GetDockerImage(containerName string) (string, error)

Get the current Docker image used by the given container

func (*Client) GetDockerStatus

func (c *Client) GetDockerStatus(containerName string) (string, error)

Get the current Docker image used by the given container

func (*Client) GetServiceVersion

func (c *Client) GetServiceVersion() (string, error)

Get the Rocket Pool service version

func (*Client) GetVolumeSize

func (c *Client) GetVolumeSize(volumeName string) (int64, error)

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

func (c *Client) InstallUpdateTracker(verbose bool, version string, useLocalInstaller bool) error

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

func (c *Client) PauseService(composeFiles []string) error

Pause the Rocket Pool service

func (*Client) PrintNodeLogs

func (c *Client) PrintNodeLogs(composeFiles []string, tail string, logPaths ...string) error

Print the daemon logs

func (*Client) PrintServiceCompose

func (c *Client) PrintServiceCompose(composeFiles []string) error

Print the Rocket Pool service compose config

func (*Client) PrintServiceLogs

func (c *Client) PrintServiceLogs(composeFiles []string, tail string, serviceNames ...string) error

Print the Rocket Pool service logs

func (*Client) PrintServiceStats

func (c *Client) PrintServiceStats(composeFiles []string) error

Print the Rocket Pool service stats

func (*Client) PrintServiceStatus

func (c *Client) PrintServiceStatus(composeFiles []string) error

Print the Rocket Pool service status

func (*Client) PurgeAllKeys

func (c *Client) PurgeAllKeys(composeFiles []string) error

Deletes the node wallet and all validator keys, and restarts the Docker containers

func (*Client) RemoveContainer

func (c *Client) RemoveContainer(containerName string) error

Deletes a container

func (*Client) RestartContainer

func (c *Client) RestartContainer(containerName string) error

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

func (c *Client) RunPruneProvisioner(container string, volume string) error

Runs the prune provisioner

func (*Client) SaveConfig

func (c *Client) SaveConfig(cfg *config.SmartNodeConfig) error

Save the config

func (*Client) StartContainer

func (c *Client) StartContainer(containerName string) error

Start a container

func (*Client) StartService

func (c *Client) StartService(composeFiles []string) error

Start the Rocket Pool service

func (*Client) StopContainer

func (c *Client) StopContainer(containerName string) error

Shut down a container

func (*Client) StopService

func (c *Client) StopService(composeFiles []string) error

Stop the Rocket Pool service

func (*Client) TerminateService

func (c *Client) TerminateService(composeFiles []string, configPath string) error

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

type DockerImage struct {
	ID            string
	RepositoryTag string
}

func (*DockerImage) String

func (img *DockerImage) String() string

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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