feat: refactor to ymsctl & yms-daemon

This commit is contained in:
2026-08-17 02:10:10 +08:00
parent 7755da72e7
commit 79f18fcdea
23 changed files with 394 additions and 47 deletions
+7 -1
View File
@@ -33,6 +33,7 @@ type persistedContainerRequest struct {
PreviousPort int `json:"previousPort"`
PreviousContainer string `json:"previousContainer"`
TargetHealthEndpoint string `json:"targetHealthEndpoint"`
StartLog bool `json:"startLog"`
GatewayBeforePath string `json:"gatewayBeforePath"`
GatewayAfterPath string `json:"gatewayAfterPath"`
GatewayReceiptPath string `json:"gatewayReceiptPath"`
@@ -40,7 +41,7 @@ type persistedContainerRequest struct {
// UpdateContainerImage pulls one development image, freezes its repository
// digest, and updates the inactive Docker backend slot.
func (u *Updater) UpdateContainerImage(ctx context.Context, imageReference string, report ProgressReporter) (transaction.Transaction, error) {
func (u *Updater) UpdateContainerImage(ctx context.Context, imageReference string, startLog bool, report ProgressReporter) (transaction.Transaction, error) {
if u.containerExecutor == nil || u.engine == nil {
return transaction.Transaction{}, errors.New("container backend updater is not configured")
}
@@ -138,6 +139,7 @@ func (u *Updater) UpdateContainerImage(ctx context.Context, imageReference strin
TargetPort: targetPort, TargetContainer: targetSlot.ContainerName,
PreviousPort: before.ActivePort, PreviousContainer: previousContainer,
TargetHealthEndpoint: targetSlot.HealthEndpoint,
StartLog: startLog,
GatewayBeforePath: beforePath, GatewayAfterPath: afterPath,
GatewayReceiptPath: filepath.Join(transactionRoot, "gateway.applied"),
}
@@ -294,6 +296,10 @@ func (u *Updater) runContainerUpdate(ctx context.Context, record transaction.Tra
ConfigLocation: deploymentconfig.ContainerConfigLocation,
RestartPolicy: containerengine.RestartPolicy{Name: "no"},
HealthEndpoint: request.TargetHealthEndpoint,
StartLog: request.StartLog,
LogReporter: func(line string) {
reportProgress(report, Progress{TransactionID: record.ID, State: transaction.StateStarting, Message: "CONTAINER LOG " + line})
},
}
switch record.State {
case transaction.StateCreated, transaction.StateValidating, transaction.StatePrepared, transaction.StateStarting: