Skip to content

Support singleton deploy role for services like Celery Beat #26

@wadewilliams

Description

@wadewilliams

Problem

Services like Celery Beat are singletons — only one instance should run at a time. The current deploy roles don't fit well:

  • app — rolling deploy scales to 2 temporarily, causing duplicate scheduling
  • accessory — never restarted, so it runs stale code after deploy

Current workaround

Using deploy.role=app with deploy.drain=1 to minimize the overlap window. Tasks are assumed idempotent, so brief duplicate scheduling is tolerable.

Proposal

A third deploy role (e.g. singleton or sequential) that does stop-before-start instead of rolling:

  1. Send SIGTERM to the old container, wait for graceful shutdown
  2. Start the new container
  3. Health check the new container

This would be useful for any service where exactly-one-at-a-time semantics matter: beat schedulers, cron runners, lock holders, single-consumer queues.

Alternatives considered

  • celery-redbeat: Distributed lock scheduler that makes beat safe for rolling deploys. Works but adds a dependency to solve a deploy-tool gap.
  • deploy.drain=1: Minimizes overlap but doesn't eliminate it.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions