Documentation
¶
Overview ¶
Package client is the Go client for the Jokku API, used by the CLI and the git hook. It reaches the API over the local unix socket or over SSH.
Index ¶
- Constants
- func IsNotFound(err error) bool
- func ParseGitRemote(remote string) (dest, app string, ok bool)
- type Client
- func (c *Client) AddDatabaseUser(ctx context.Context, engine, name string, req types.AddDatabaseUserRequest) (*types.DatabaseUser, error)
- func (c *Client) AddSSHKey(ctx context.Context, name, publicKey string) (*types.SSHKey, error)
- func (c *Client) App(ctx context.Context, app string) (*types.App, error)
- func (c *Client) Apps(ctx context.Context) ([]types.App, error)
- func (c *Client) Auth(ctx context.Context, app string) (*types.AuthSettings, error)
- func (c *Client) AuthShares(ctx context.Context, app string) ([]types.AuthShare, error)
- func (c *Client) AuthUsers(ctx context.Context) ([]types.AuthUser, error)
- func (c *Client) BackupDestinations(ctx context.Context) ([]types.BackupDestination, error)
- func (c *Client) BackupKey(ctx context.Context) (*types.BackupKey, error)
- func (c *Client) BackupReport(ctx context.Context, app string) ([]types.VolumeBackups, error)
- func (c *Client) BackupsOverview(ctx context.Context) (*types.BackupsOverview, error)
- func (c *Client) CloneApp(ctx context.Context, app, newName string) error
- func (c *Client) ClusterBackups(ctx context.Context) (*types.VolumeBackups, error)
- func (c *Client) ClusterStatus(ctx context.Context) (*types.ClusterStatus, error)
- func (c *Client) Config(ctx context.Context, app string) (map[string]string, error)
- func (c *Client) CreateApp(ctx context.Context, app string) (*types.App, error)
- func (c *Client) CreateAuthShare(ctx context.Context, app string, req types.CreateShareRequest) (*types.AuthShare, error)
- func (c *Client) CreateAuthUser(ctx context.Context, req types.AuthUserRequest) (*types.AuthUserResult, error)
- func (c *Client) CreateBackupDestination(ctx context.Context, req types.CreateBackupDestinationRequest) (*types.BackupDestination, error)
- func (c *Client) CreateBackupKey(ctx context.Context) (*types.BackupKey, error)
- func (c *Client) CreateDatabase(ctx context.Context, engine string, req types.CreateDatabaseRequest, ...) error
- func (c *Client) CreateEdge(ctx context.Context, req types.CreateEdgeRequest) (*types.Edge, error)
- func (c *Client) CreateExternal(ctx context.Context, req types.ExternalRequest) (*types.External, error)
- func (c *Client) CreateJoinToken(ctx context.Context, req types.CreateJoinTokenRequest) (*types.JoinToken, error)
- func (c *Client) CreateVolume(ctx context.Context, app string, req types.CreateVolumeRequest) (*types.Volume, error)
- func (c *Client) Database(ctx context.Context, engine, name string) (*types.Database, error)
- func (c *Client) DatabaseStats(ctx context.Context) ([]types.DatabaseStats, error)
- func (c *Client) DatabaseUserPassword(ctx context.Context, engine, name, user string) (*types.DatabaseUser, error)
- func (c *Client) DatabaseUsers(ctx context.Context, engine, name string) ([]types.DatabaseUser, error)
- func (c *Client) Databases(ctx context.Context, engine string) ([]types.Database, error)
- func (c *Client) DeleteAuthShare(ctx context.Context, app, id string) error
- func (c *Client) DeleteAuthUser(ctx context.Context, name string) error
- func (c *Client) DeleteBackupDestination(ctx context.Context, name string) error
- func (c *Client) DeleteRegistryLogin(ctx context.Context, server string) error
- func (c *Client) Deploy(ctx context.Context, app, source, ref string, tarball io.Reader, ...) error
- func (c *Client) DeployImage(ctx context.Context, app, image string, onEvent func(types.Event)) error
- func (c *Client) Deploys(ctx context.Context, app string) ([]types.Deploy, error)
- func (c *Client) DestroyApp(ctx context.Context, app string) error
- func (c *Client) DestroyDatabase(ctx context.Context, engine, name string) error
- func (c *Client) DestroyExternal(ctx context.Context, name string) error
- func (c *Client) DestroyVolume(ctx context.Context, app, name string) error
- func (c *Client) DiscardOldCopy(ctx context.Context, app, name string) error
- func (c *Client) Domains(ctx context.Context, app string) (*types.Domains, error)
- func (c *Client) Edges(ctx context.Context) ([]types.Edge, error)
- func (c *Client) EnsureGitRepo(ctx context.Context, app string) (string, error)
- func (c *Client) Enter(ctx context.Context, app, process string) (io.ReadWriteCloser, error)
- func (c *Client) Events(ctx context.Context, app string, limit int) ([]types.ClusterEvent, error)
- func (c *Client) ExportVolume(ctx context.Context, app, name string, live bool, w io.Writer) error
- func (c *Client) ExposeDatabase(ctx context.Context, engine, name string, req types.ExposeDatabaseRequest) (*types.Database, error)
- func (c *Client) External(ctx context.Context, name string) (*types.External, error)
- func (c *Client) Externals(ctx context.Context) ([]types.External, error)
- func (c *Client) Firewall(ctx context.Context) (*types.Firewall, error)
- func (c *Client) Formation(ctx context.Context, app string) ([]types.Process, error)
- func (c *Client) ImportVolume(ctx context.Context, app, name string, clear, keepOwners bool, ...) error
- func (c *Client) Instances(ctx context.Context, app string) ([]types.Instance, error)
- func (c *Client) Latency(ctx context.Context) (*types.Latency, error)
- func (c *Client) LinkDatabase(ctx context.Context, engine, name string, req types.LinkDatabaseRequest, ...) error
- func (c *Client) Logs(ctx context.Context, app string, o types.LogOptions, onEvent func(types.Event)) error
- func (c *Client) MountVolume(ctx context.Context, app, name string, m types.VolumeMount) (*types.Volume, error)
- func (c *Client) MoveVolume(ctx context.Context, app, name, node string) (*types.Volume, error)
- func (c *Client) NetTests(ctx context.Context) (*types.NetTests, error)
- func (c *Client) Node(ctx context.Context, name string) (*types.Node, error)
- func (c *Client) Nodes(ctx context.Context) ([]types.Node, error)
- func (c *Client) PS(ctx context.Context, app, action string, onEvent func(types.Event)) error
- func (c *Client) PatchAuth(ctx context.Context, app string, p types.AuthPatch) (*types.AuthSettings, error)
- func (c *Client) PatchAuthUser(ctx context.Context, name string, req types.AuthUserRequest) (*types.AuthUserResult, error)
- func (c *Client) PatchConfig(ctx context.Context, app string, p types.ConfigPatch) (*types.ConfigVars, error)
- func (c *Client) PatchDomains(ctx context.Context, app string, p types.DomainsPatch) (*types.Domains, error)
- func (c *Client) PatchExternal(ctx context.Context, name string, req types.ExternalRequest) (*types.External, error)
- func (c *Client) Properties(ctx context.Context, app, plugin string) (*types.Properties, error)
- func (c *Client) Rebalance(ctx context.Context, req types.RebalanceRequest) (*types.Rebalance, error)
- func (c *Client) RegistryLogins(ctx context.Context) ([]types.RegistryLogin, error)
- func (c *Client) Releases(ctx context.Context, app string) ([]types.Release, error)
- func (c *Client) RemoveDatabaseUser(ctx context.Context, engine, name, user string) error
- func (c *Client) RemoveEdge(ctx context.Context, name string) error
- func (c *Client) RemoveNode(ctx context.Context, name string, force bool) error
- func (c *Client) RemoveSSHKey(ctx context.Context, nameOrFingerprint string, byFingerprint bool) error
- func (c *Client) RenameApp(ctx context.Context, app, newName string) error
- func (c *Client) Requests(ctx context.Context, app string, tail int, follow bool, fn func(types.Request)) error
- func (c *Client) ResizeVolume(ctx context.Context, app, name string, sizeMB int) (*types.Volume, error)
- func (c *Client) Resources(ctx context.Context, app string) (*types.Resources, error)
- func (c *Client) RestoreVolume(ctx context.Context, app, name string, req types.RestoreVolumeRequest, ...) error
- func (c *Client) RunBackup(ctx context.Context, app, name string, onEvent func(types.Event)) error
- func (c *Client) RunClusterBackup(ctx context.Context, onEvent func(types.Event)) error
- func (c *Client) SSHKeys(ctx context.Context) ([]types.SSHKey, error)
- func (c *Client) SaveBackupKey(ctx context.Context) error
- func (c *Client) Scale(ctx context.Context, app string, req types.ScaleRequest) ([]types.Process, error)
- func (c *Client) SetAppLocked(ctx context.Context, app string, locked bool) error
- func (c *Client) SetBuilder(ctx context.Context, app, typ, file string) error
- func (c *Client) SetClusterBackup(ctx context.Context, req types.SetVolumeBackupRequest) (*types.VolumeBackups, error)
- func (c *Client) SetFirewall(ctx context.Context, app string, p types.FirewallPatch) (*types.FirewallSettings, error)
- func (c *Client) SetNodeFlag(ctx context.Context, name, flag string, value bool) (*types.Node, error)
- func (c *Client) SetProperty(ctx context.Context, app, plugin, key, value string) error
- func (c *Client) SetRegistryLogin(ctx context.Context, server, username, password string) error
- func (c *Client) SetResources(ctx context.Context, app string, l types.ResourceLimits) (*types.Resources, error)
- func (c *Client) SetVolumeBackup(ctx context.Context, app, name string, req types.SetVolumeBackupRequest) (*types.VolumeBackups, error)
- func (c *Client) StartNetTest(ctx context.Context, req types.NetTestRequest) (*types.NetTestProgress, error)
- func (c *Client) Unban(ctx context.Context, addr string) (bool, error)
- func (c *Client) UnexposeDatabase(ctx context.Context, engine, name string) error
- func (c *Client) UnlinkDatabase(ctx context.Context, engine, name, app string, noRestart bool, ...) error
- func (c *Client) UnmountVolume(ctx context.Context, app, name string, m types.VolumeMount) (*types.Volume, error)
- func (c *Client) UnsetClusterBackup(ctx context.Context) error
- func (c *Client) UnsetVolumeBackup(ctx context.Context, app, name string) error
- func (c *Client) UpdateNodes(ctx context.Context) error
- func (c *Client) Version(ctx context.Context) (*types.Version, error)
- func (c *Client) Volume(ctx context.Context, app, name string) (*types.Volume, error)
- func (c *Client) VolumeBackups(ctx context.Context, app, name string) (*types.VolumeBackups, error)
- func (c *Client) Volumes(ctx context.Context, app string) ([]types.Volume, error)
- type Error
- type Target
Constants ¶
const DefaultSocket = "/run/jokku/jokku.sock"
DefaultSocket is where the control node's daemon listens.
Variables ¶
This section is empty.
Functions ¶
func IsNotFound ¶
func ParseGitRemote ¶
ParseGitRemote extracts the SSH destination and app from a git remote URL such as "jokku@host:app", "jokku@host:app.git" or "ssh://jokku@host:2222/app".
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
func New ¶
New returns a client for target. actor is sent with every request so the API can record who did what (an SSH key name, for example); it may be empty.
func (*Client) AddDatabaseUser ¶
func (c *Client) AddDatabaseUser(ctx context.Context, engine, name string, req types.AddDatabaseUserRequest) (*types.DatabaseUser, error)
AddDatabaseUser adds a login to a database, returning it with its password and URLs.
func (*Client) AuthShares ¶
func (*Client) BackupDestinations ¶
func (*Client) BackupKey ¶
BackupKey returns the cluster's backup key; IsNotFound until one is made.
func (*Client) BackupReport ¶
BackupReport says where volumes are backed up and how their backups went: one app's, or every app's for app "".
func (*Client) BackupsOverview ¶
BackupsOverview is everything about backups at once, for jokku top.
func (*Client) ClusterBackups ¶
ClusterBackups lists the cluster's own backups, newest first.
func (*Client) ClusterStatus ¶
func (*Client) CreateAuthShare ¶
func (*Client) CreateAuthUser ¶
func (c *Client) CreateAuthUser(ctx context.Context, req types.AuthUserRequest) (*types.AuthUserResult, error)
func (*Client) CreateBackupDestination ¶
func (c *Client) CreateBackupDestination(ctx context.Context, req types.CreateBackupDestinationRequest) (*types.BackupDestination, error)
func (*Client) CreateBackupKey ¶
CreateBackupKey makes the cluster's backup key, or returns the one it has.
func (*Client) CreateDatabase ¶
func (c *Client) CreateDatabase(ctx context.Context, engine string, req types.CreateDatabaseRequest, onEvent func(types.Event)) error
CreateDatabase creates and deploys a database, streaming the deploy.
func (*Client) CreateEdge ¶
CreateEdge adds an edge; the result holds the command that installs it.
func (*Client) CreateExternal ¶
func (*Client) CreateJoinToken ¶
func (*Client) CreateVolume ¶
func (*Client) DatabaseStats ¶
DatabaseStats is what the control node has seen inside every database.
func (*Client) DatabaseUserPassword ¶
func (c *Client) DatabaseUserPassword(ctx context.Context, engine, name, user string) (*types.DatabaseUser, error)
DatabaseUserPassword gives a database's login a new password.
func (*Client) DatabaseUsers ¶
func (c *Client) DatabaseUsers(ctx context.Context, engine, name string) ([]types.DatabaseUser, error)
DatabaseUsers lists a database's logins.
func (*Client) DeleteAuthShare ¶
func (*Client) DeleteAuthUser ¶
func (*Client) DeleteBackupDestination ¶
func (*Client) DeleteRegistryLogin ¶
func (*Client) Deploy ¶
func (c *Client) Deploy(ctx context.Context, app, source, ref string, tarball io.Reader, onEvent func(types.Event)) error
Deploy uploads a source tarball and streams the build and rollout. It returns the deploy's failure, if any.
func (*Client) DeployImage ¶
func (c *Client) DeployImage(ctx context.Context, app, image string, onEvent func(types.Event)) error
DeployImage deploys a registry image (builder:image), which makes the app an image app, and streams the pull and rollout.
func (*Client) DestroyDatabase ¶
func (*Client) DestroyExternal ¶
func (*Client) DestroyVolume ¶
func (*Client) DiscardOldCopy ¶
DiscardOldCopy deletes the copy of a volume's disk a node kept after the volume was restored elsewhere.
func (*Client) EnsureGitRepo ¶
EnsureGitRepo creates the app's bare repo (with its deploy hook) if needed and returns its path on the server.
func (*Client) Enter ¶
Enter opens a session in one of an app's running instances (process "", web or web.2). The caller sends a session.Request first.
func (*Client) ExportVolume ¶
ExportVolume writes a volume's files to w as a .tar.gz. live skips pausing the app.
func (*Client) ExposeDatabase ¶
func (c *Client) ExposeDatabase(ctx context.Context, engine, name string, req types.ExposeDatabaseRequest) (*types.Database, error)
ExposeDatabase lets clients outside reach a database, or changes how.
func (*Client) ImportVolume ¶
func (c *Client) ImportVolume(ctx context.Context, app, name string, clear, keepOwners bool, archive io.Reader) error
ImportVolume restores a volume's files from a tar (gzipped or not) and restarts the app's process that mounts it. clear empties the volume first; keepOwners keeps the archive's owners instead of the volume's.
func (*Client) LinkDatabase ¶
func (c *Client) LinkDatabase(ctx context.Context, engine, name string, req types.LinkDatabaseRequest, onEvent func(types.Event)) error
LinkDatabase links a database to an app, streaming the app's restart.
func (*Client) Logs ¶
func (c *Client) Logs(ctx context.Context, app string, o types.LogOptions, onEvent func(types.Event)) error
Logs streams log lines; with Follow it runs until ctx is done.
func (*Client) MountVolume ¶
func (*Client) MoveVolume ¶
func (*Client) NetTests ¶ added in v0.8.19
NetTests is the network test that is running, if any, and the latest finished ones, newest first.
func (*Client) PatchAuthUser ¶
func (c *Client) PatchAuthUser(ctx context.Context, name string, req types.AuthUserRequest) (*types.AuthUserResult, error)
func (*Client) PatchConfig ¶
func (c *Client) PatchConfig(ctx context.Context, app string, p types.ConfigPatch) (*types.ConfigVars, error)
func (*Client) PatchDomains ¶
func (*Client) PatchExternal ¶
func (*Client) Properties ¶
func (*Client) Rebalance ¶ added in v0.8.21
func (c *Client) Rebalance(ctx context.Context, req types.RebalanceRequest) (*types.Rebalance, error)
Rebalance spreads instances over the nodes, or with DryRun says what would move.
func (*Client) RegistryLogins ¶
func (*Client) RemoveDatabaseUser ¶
RemoveDatabaseUser drops a database's login and ends its sessions.
func (*Client) RemoveNode ¶
func (*Client) RemoveSSHKey ¶
func (*Client) Requests ¶
func (c *Client) Requests(ctx context.Context, app string, tail int, follow bool, fn func(types.Request)) error
Requests streams the HTTP requests the cluster's proxies handle (all apps when app is ""): the last tail, then new ones while following.
func (*Client) ResizeVolume ¶
func (*Client) RestoreVolume ¶
func (c *Client) RestoreVolume(ctx context.Context, app, name string, req types.RestoreVolumeRequest, onEvent func(types.Event)) error
RestoreVolume restores a volume from a backup, streaming its progress.
func (*Client) RunClusterBackup ¶
RunClusterBackup backs the cluster up now, streaming its progress.
func (*Client) SaveBackupKey ¶
SaveBackupKey records that the user saved the backup key.
func (*Client) SetAppLocked ¶
func (*Client) SetBuilder ¶
SetBuilder switches an app to Dockerfile or compose builds (typ), with file the Dockerfile or compose file ("" for the default).
func (*Client) SetClusterBackup ¶
func (c *Client) SetClusterBackup(ctx context.Context, req types.SetVolumeBackupRequest) (*types.VolumeBackups, error)
func (*Client) SetFirewall ¶
func (c *Client) SetFirewall(ctx context.Context, app string, p types.FirewallPatch) (*types.FirewallSettings, error)
SetFirewall changes the firewall's rules, or with an app whether it's on for it.
func (*Client) SetNodeFlag ¶
func (c *Client) SetNodeFlag(ctx context.Context, name, flag string, value bool) (*types.Node, error)
SetNodeFlag sets schedulable, ingress or draining on a node.
func (*Client) SetProperty ¶
func (*Client) SetRegistryLogin ¶
func (*Client) SetResources ¶
func (*Client) SetVolumeBackup ¶
func (c *Client) SetVolumeBackup(ctx context.Context, app, name string, req types.SetVolumeBackupRequest) (*types.VolumeBackups, error)
func (*Client) StartNetTest ¶ added in v0.8.19
func (c *Client) StartNetTest(ctx context.Context, req types.NetTestRequest) (*types.NetTestProgress, error)
StartNetTest starts testing the network between the nodes.
func (*Client) UnexposeDatabase ¶
UnexposeDatabase stops clients outside from reaching a database.
func (*Client) UnlinkDatabase ¶
func (c *Client) UnlinkDatabase(ctx context.Context, engine, name, app string, noRestart bool, onEvent func(types.Event)) error
UnlinkDatabase unlinks a database from an app, streaming its restart.
func (*Client) UnmountVolume ¶
func (c *Client) UnmountVolume(ctx context.Context, app, name string, m types.VolumeMount) (*types.Volume, error)
UnmountVolume removes a mount; an empty path removes the volume's only one.
func (*Client) UnsetVolumeBackup ¶
func (*Client) UpdateNodes ¶
UpdateNodes asks the control node to bring the other nodes to its version.
func (*Client) VolumeBackups ¶
VolumeBackups lists a volume's backups, newest first.