Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add maintenance mode for upgrades #2211

Merged
merged 31 commits into from
Nov 14, 2024
Merged

Conversation

iamKunalGupta
Copy link
Member

@iamKunalGupta iamKunalGupta commented Nov 1, 2024

  • Introduces Maintenance mode (status is available via dynamic config: PEERDB_MAINTENANCE_MODE_ENABLED)
  • Maintenance mode consists of 2 Workflows:
    • StartMaintenance - for pre-upgrade, responsible for
      • Waiting for running snapshots
      • Updating dynamic config to true
      • Pausing and backing up currently running mirrors
    • EndMaintenance - for post-upgrade, responsible for
      • Resuming backed up mirrors
      • Updating dynamic config to false
  • During the upgrade (between Start and End), mirrors cannot be mutated/created in any way,
  • There is also an instance info API which returns Ready/Maintenance which can be used for UI changes later.

There are 2 ways to trigger these 2 workflows:

  1. API call to flow-api
  2. Running the new maintenance entrypoint with the respective args

A new task queue is added so that the maintenance tasks can be spun up even during pre-upgrade hooks (from version earlier than ones containing this PR) and this also ensures that always the latest version of the maintenance flows run irrespective of the old version.

@iamKunalGupta iamKunalGupta marked this pull request as ready for review November 1, 2024 04:16
@iamKunalGupta iamKunalGupta requested a review from a team November 1, 2024 04:24
@iamKunalGupta iamKunalGupta changed the title feat: add maintenance mode feat: add maintenance mode for upgrades Nov 1, 2024
flow/activities/maintenance_activity.go Outdated Show resolved Hide resolved
logEvery time.Duration,
alertEvery time.Duration,
) (protos.FlowStatus, error) {
// In case a mirror was just kicked off, it shows up in the running state, we wait for a bit before checking for snapshot
Copy link
Contributor

Choose a reason for hiding this comment

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

this really shouldn't happen, seems like a bug

protos/route.proto Outdated Show resolved Hide resolved
flow/activities/maintenance_activity.go Outdated Show resolved Hide resolved
flow/activities/maintenance_activity.go Outdated Show resolved Hide resolved
flow/activities/maintenance_activity.go Outdated Show resolved Hide resolved
flow/activities/maintenance_activity.go Outdated Show resolved Hide resolved
flow/cmd/maintenance.go Outdated Show resolved Hide resolved
docker-bake.hcl Show resolved Hide resolved
flow/cmd/handler.go Show resolved Hide resolved
@iamKunalGupta iamKunalGupta enabled auto-merge (squash) November 14, 2024 14:50
@iamKunalGupta iamKunalGupta merged commit 42b0208 into main Nov 14, 2024
10 checks passed
@iamKunalGupta iamKunalGupta deleted the feat/maintenance-mode branch November 14, 2024 14:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add maintenance mode for upgrades
3 participants