mirror of
https://github.com/rcourtman/Pulse.git
synced 2026-11-28 16:58:31 +01:00
Docker operators need to diagnose service failures and change one image without losing the source that owns a running application. Bind approved updates to the registered Compose file or Git base, then show the running image and fresh HTTP evidence after rollout. Keep log access opt-in, mute container alerts per runtime, and connect the Docker installer and demo to the application workflow.
58 lines
2.2 KiB
Go
58 lines
2.2 KiB
Go
package dockeragent
|
|
|
|
// Command represents a control instruction issued by Pulse to the Docker agent.
|
|
type Command struct {
|
|
ID string `json:"id"`
|
|
Type string `json:"type"`
|
|
Payload map[string]any `json:"payload,omitempty"`
|
|
}
|
|
|
|
// ReportResponse captures the server response for a docker report submission.
|
|
type ReportResponse struct {
|
|
Success bool `json:"success"`
|
|
Commands []Command `json:"commands,omitempty"`
|
|
LogTail *LogTailRequest `json:"logTail,omitempty"`
|
|
}
|
|
|
|
// CommandAck is sent by the agent to confirm the result of a control command.
|
|
type CommandAck struct {
|
|
AgentID string `json:"agentId"`
|
|
Status string `json:"status"`
|
|
Message string `json:"message,omitempty"`
|
|
Payload map[string]any `json:"payload,omitempty"`
|
|
}
|
|
|
|
const (
|
|
// CommandTypeStop instructs the agent to stop reporting and shut down.
|
|
CommandTypeStop = "stop"
|
|
// CommandTypeUpdateContainer instructs the agent to update a specific container to its latest image.
|
|
CommandTypeUpdateContainer = "update_container"
|
|
// CommandTypeUpdateAll instructs the agent to update all containers with updates available.
|
|
CommandTypeUpdateAll = "update_all"
|
|
// CommandTypeCheckUpdates instructs the agent to clear its registry cache and check for updates immediately.
|
|
CommandTypeCheckUpdates = "check_updates"
|
|
|
|
// CommandStatusAcknowledged indicates a command was received and is in progress.
|
|
CommandStatusAcknowledged = "acknowledged"
|
|
// CommandStatusInProgress indicates an intermediate progress update during command execution.
|
|
CommandStatusInProgress = "in_progress"
|
|
// CommandStatusCompleted indicates the command completed successfully.
|
|
CommandStatusCompleted = "completed"
|
|
// CommandStatusFailed indicates the command failed.
|
|
CommandStatusFailed = "failed"
|
|
)
|
|
|
|
// LogTailRequest names an exact daemon container and an expiring request.
|
|
// It is accepted only from the primary report destination on opted-in hosts.
|
|
type LogTailRequest struct {
|
|
ID string `json:"id"`
|
|
HostID string `json:"hostId"`
|
|
ContainerID string `json:"containerId"`
|
|
}
|
|
type LogTailResult struct {
|
|
LogTailRequest
|
|
Lines []string `json:"lines,omitempty"`
|
|
Truncated bool `json:"truncated,omitempty"`
|
|
Unavailable bool `json:"unavailable,omitempty"`
|
|
}
|