Skip to content

Remove Valkey and run background jobs in process - #593

Merged
MUFFANUJ merged 7 commits into
nebari-dev:ux-rework-devfrom
MUFFANUJ:removeValkey
Sep 25, 2026
Merged

MUFFANUJ merged 7 commits into
nebari-dev:ux-rework-devfrom
MUFFANUJ:removeValkey

Conversation

@MUFFANUJ

@MUFFANUJ MUFFANUJ commented Sep 24, 2026 •

Copy link
Copy Markdown
Member

Reference Issues or PRs

Closes #586

What does this implement/fix?

Put a x in the boxes that apply

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds a feature)
  • Breaking change (fix or feature that would cause existing features not to work as expected)
  • Documentation Update
  • Code style update (formatting, renaming)
  • Refactoring (no functional changes, no API changes)
  • Build related changes
  • Other (please describe):

Testing

  • Did you test the pull request locally?
  • Did you add new tests?

Documentation

Updated server setup documentation with in-memory job processing, restart recovery, shutdown behavior, and migration instructions. Updated architecture documentation and diagrams to remove Valkey and external workers.

Access-centered content checklist

Text styling

  • The content is written with plain language (where relevant).
  • If there are headers, they use the proper header tags (with only one level-one header: H1 or # in markdown).
  • All links describe where they link to (for example, check the Nebari website).
  • This content adheres to the Nebari style guides.

Non-text content

  • All content is represented as text (for example, images need alt text, and videos need captions or descriptive transcripts).
  • If there are emojis, there are not more than three in a row.
  • Don't use flashing GIFs or videos.
  • If the content were to be read as plain text, it still makes sense, and no information is missing.

Any other comments?

Removes the Valkey queue, distributed log transport, standalone worker modes, related configuration and dependencies, and external worker services from Compose. Background jobs now run serially using the in-memory queue and log broker. The queue retains only pending work; job history and logs remain in the database.

Adds startup recovery to mark interrupted jobs and unfinished workspace transitions as failed so users can retry. Server and desktop shutdown now cancel the worker and wait up to 40 seconds for cleanup and final writes. Worker exit closes all log streams, including pending jobs and late subscriptions. Compose selects the correct server build target and allows a 45-second shutdown grace period. Includes migration documentation and regression tests.

Question: Recovery assumes one running instance per database. Starting another instance against the same database can mark live jobs as failed, even if its HTTP listener subsequently fails to bind. How likely is this scenario, and should exclusive database ownership be enforced here or handled separately?

List of breaking changes (for future referene)

  • Removed queue configuration: Remove queue.type and queue.valkey_addr from configuration files, and NEBI_QUEUE_TYPE / NEBI_QUEUE_VALKEY_ADDR from deployment environments. Nebi now always uses the in-memory queue.
  • Removed component modes: Remove --mode / -m (server, worker, or both) from nebi-server and nebi-web commands. Both binaries now run the API and background worker together.
  • Removed Valkey and external workers: Update deployments to remove Nebi-specific Valkey services, standalone worker services, and their dependencies. Job distribution and live log streaming through Valkey are no longer supported.
  • Deployment topology: Each Nebi instance now owns its in-memory queue and log broker. Deployments relying on separate API/worker processes or shared queues across replicas need updating; the documented configuration is one Nebi instance per database.
  • Pending work during upgrades: Allow queued and running jobs to finish before upgrading. The in-memory queue does not survive restarts or automatically replay unfinished jobs. Persisted job records and logs remain in the database.

Concurrency is configurable through worker.max_parallel_jobs or NEBI_WORKER_MAX_PARALLEL_JOBS, defaulting to half the available CPU cores, with a minimum of one.

The team server still executes background jobs. Moving execution exclusively to clients was not part of this PR. Startup recovery and lifecycle improvements were also excluded from this PR.

@pmeier pmeier left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thanks Anuj. Added some comments.

Comment thread docs/src/content/docs/server-setup.md Resolved
Comment thread internal/queue/memory.go Resolved
Comment thread internal/queue/queue.go Resolved
Comment thread internal/worker/worker.go Resolved
Comment thread app.go Outdated

// Publish lifecycle handles atomically with starting the worker. If the
// window closed during initialization, do not start background work.
a.lifecycleMu.Lock()

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Please explain why we need to add all this functionality here although this PR is meant to remove stuff.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

This adds explicit lifecycle management for the in-process worker: on desktop shutdown, we cancel jobs, reject new submissions, and wait for cleanup and final status/log writes before Wails exits. Since initialization runs in a goroutine, the mutex also prevents shutdown from missing a worker that is still starting, or initialization from starting one after shutdown.
To clarify the scope: the desktop already used an in-memory queue before this PR, so this fixes an existing shutdown gap rather than being strictly required by removing Valkey. I included it to give the in-process worker a complete shutdown lifecycle.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Please factor this out into a separate PR. I agree this is needed, but out of scope for the valkey removal.

@MUFFANUJ MUFFANUJ Sep 25, 2026 •

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

I will create a new PR once this is merged with these changes thanks!.

Comment thread docker-compose.dev.yml Resolved
@pmeier

pmeier commented Sep 24, 2026

Copy link
Copy Markdown
Member

@MUFFANUJ GH didn't do what I wanted. The requested changes are #593 (comment)

@MUFFANUJ
MUFFANUJ requested a review from pmeier September 25, 2026 04:58
Comment thread internal/service/job.go Resolved
Comment thread internal/worker/worker.go Resolved
@pmeier

pmeier commented Sep 25, 2026

Copy link
Copy Markdown
Member

@MUFFANUJ please add a comment to #589 regarding the removed config options as well as the removed Valkey functionality in general.

@MUFFANUJ
MUFFANUJ merged commit d02176e into nebari-dev:ux-rework-dev Sep 25, 2026
7 checks passed
@MUFFANUJ
MUFFANUJ deleted the removeValkey branch September 25, 2026 10:40
@MUFFANUJ

Copy link
Copy Markdown
Member Author

We could close this?

@pmeier

pmeier commented Sep 30, 2026

Copy link
Copy Markdown
Member

@MUFFANUJ What do you mean by "close" here? The PR is merged already.

@MUFFANUJ

MUFFANUJ commented Sep 30, 2026 •

Copy link
Copy Markdown
Member Author

@MUFFANUJ What do you mean by "close" here? The PR is merged already.

thats strange i commented on the issue, since that was open

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants