mirror of
https://github.com/rcourtman/Pulse.git
synced 2026-04-28 11:30:15 +00:00
Docker container URL preserved on update (#1054): container updates recreate the container with a new runtime ID. The agent now includes {oldContainerId, newContainerId} in the completion ACK payload; the server uses this to copy persisted metadata (custom URLs, descriptions, tags) to the new ID so nothing is lost. Migration is a copy, not a move, so rollback scenarios still find metadata under the original ID. Reduce metrics.db write amplification (#1124): add a UNIQUE index on (resource_type, resource_id, metric_type, timestamp, tier) so rollup reprocessing after a failed checkpoint uses INSERT OR IGNORE instead of creating duplicate rows. Existing duplicates are deduplicated once on startup if the index creation would otherwise fail. Also sets wal_autocheckpoint(500) to checkpoint the WAL more frequently, preventing unbounded WAL growth. Fixes #1054 Fixes #1124
40 lines
1.6 KiB
Go
40 lines
1.6 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"`
|
|
}
|
|
|
|
// CommandAck is sent by the agent to confirm the result of a control command.
|
|
type CommandAck struct {
|
|
HostID string `json:"hostId"`
|
|
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"
|
|
// 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"
|
|
)
|