Skip to content

Conversation

@kaspersjo
Copy link
Contributor

@kaspersjo kaspersjo commented Oct 7, 2025

This PR adds a background reconcile job for deployments and removes all automatic project resets.
There's also a new River queue middleware added for better observability instrumentation of the background jobs.

Checklist:

  • Covered by tests
  • Ran it and it works as intended
  • Reviewed the diff before requesting a review
  • Checked for unhandled edge cases
  • Linked the issues it closes
  • Checked if the docs need to be updated. If so, create a separate Linear DOCS issue
  • Intend to cherry-pick into the release branch
  • I'm proud of this work!
@kaspersjo kaspersjo force-pushed the reconcile-deployment branch 2 times, most recently from 81ad2d7 to 63a5352 Compare October 28, 2025 13:21
@kaspersjo kaspersjo marked this pull request as ready for review October 28, 2025 20:30
@kaspersjo kaspersjo force-pushed the reconcile-deployment branch from a532425 to f4526b1 Compare October 30, 2025 14:25
Comment on lines +46 to +71
case database.DeploymentStatusRunning:
// Check current status to either start or update the deployment
if depl.Status == database.DeploymentStatusRunning {
// Update the deployment status to updating
depl, err = w.admin.DB.UpdateDeploymentStatus(ctx, depl.ID, database.DeploymentStatusUpdating, "Updating...")
if err != nil {
return err
}

// Update the deployment by updating its runtime instance and resources.
err := w.admin.UpdateDeploymentInner(ctx, depl)
if err != nil {
return err
}
} else {
// Update the deployment status to pending
depl, err = w.admin.DB.UpdateDeploymentStatus(ctx, depl.ID, database.DeploymentStatusPending, "Provisioning...")
if err != nil {
return err
}

// Initialize the deployment (by provisioning a runtime and creating an instance on it)
err := w.admin.StartDeploymentInner(ctx, depl)
if err != nil {
return err
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does the DeploymentStatusError need special handling here? Or is it safe to call StartDeploymentInner for that?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No special handling needed, it's safe since we go through the whole idempotent provisioning flow in StartDeploymentInner without assuming anything is already provisioned or otherwise healthy.

Copy link
Contributor

@begelundmuller begelundmuller left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@kaspersjo kaspersjo merged commit 425511f into main Nov 24, 2025
18 of 20 checks passed
@kaspersjo kaspersjo deleted the reconcile-deployment branch November 24, 2025 14:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

3 participants