Feature Request: Graceful Reloads and Maintenance Mode

Open
#709 0 comments 1 reaction 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
5/5
Estimated time
Over a week
Newbie friendliness
25/100
Issue type
Feature
Clarity
Mostly clear
Activity status
Active
Tech stack
rust
Domain
backend, devops

Research direction

Start by reading the existing graceful shutdown lifecycle and the application entry point; the issue does not name their files. Then investigate how the server manages listening sockets, process startup, and maintenance responses. Done means graceful reloads and persistent maintenance mode work as described, including startup failure recovery and draining requests; the scope requires design across several lifecycle and deployment concerns.

Written by the indexing model from the issue text.

Description

Motivation

One of the advantages of traditional Laravel applications is the simplicity of deploying updates to production.

It would be great for Laravel Rust to provide native graceful reloads and maintenance mode, allowing developers to deploy applications on a VPS or bare-metal server without requiring blue/green reverse proxy configs, containers, or external deployment orchestration.

Since Laravel Rust already supports graceful shutdown, these features could build upon the existing application lifecycle.

1. Graceful Reloads

Introduce a command such as:

laravel reload

Alternatively, support sending a SIGUSR2 signal to the running application.

The reload mechanism would:

  • Start a new process using the updated binary.
  • Pass the existing listening sockets to the new process.
  • Wait until the new application has successfully booted.
  • Stop accepting new connections in the old process.
  • Allow the new process to handle all incoming connections.
  • Gracefully drain existing requests and connections in the old process.
  • Terminate the old process once draining is complete.

If the new process fails to initialize, the old process should continue serving traffic without interruption.

2. Maintenance Mode

Introduce commands similar to Laravel PHP:

laravel down
laravel up

Maintenance mode could provide:

  • A customizable maintenance page.
  • HTTP 503 responses for incoming requests (configurable with a parameter so 200 also works)
  • JSON responses for API requests.
  • Configurable Retry-After headers.
  • Secret-based maintenance mode bypass.
  • Persistent maintenance state across process reloads and restarts.
  • Graceful draining of existing application requests.
  • Pausing application-managed queue workers and scheduled tasks where applicable.

Ideally, the down command should optionally wait until all active application requests and relevant background jobs have finished, allowing database migrations to run safely without concurrent application activity.

laravel down --wait

Maintenance responses should be served before executing application middleware or accessing the database.

3. Example Deployment Workflows

Zero-downtime deployment

For deployments that do not introduce breaking changes:

git pull
cargo build --release

# Atomically replace the production binary
mv myapp.new myapp

laravel reload
Deployment requiring maintenance

For deployments involving breaking database migrations or other incompatible changes:

git pull
cargo build --release

laravel down --wait

# Atomically replace the production binary
mv myapp.new myapp

# Run database migrations using the new release

laravel reload
laravel up

Throughout this process, visitors would receive a maintenance page rather than connection errors or application exceptions.

If migrations or the reload fail, the application should remain in maintenance mode until the issue is resolved.

Implementation Considerations

  • Listening socket inheritance to preserve the TCP accept queue.
  • Readiness handshake between old and new processes.
  • Integration with the existing graceful shutdown lifecycle.
  • Persistent maintenance state shared between application processes.
  • Proper handling of WebSockets, SSE, and long-lived connections.
  • Coordination with queue workers and scheduled tasks.
  • Compatibility with process supervisors such as systemd.
  • Prevention of overlapping reload operations.
  • Recovery when a new binary fails to initialize.

Benefits

  • Native zero-downtime deployments.
  • Safe maintenance windows for breaking database migrations.
  • Minimal infrastructure requirements.
  • No dropped in-flight requests during normal deployments.
  • Familiar deployment experience for existing Laravel PHP developers.
  • Consistent application lifecycle management.
  • Simpler self-hosted production environments.
Dominant language
Rust
Stars
847
Forks
174
Avg merge
5h 40m
Merged PRs (30d)
167

Getting set up

This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from laravel/rust-framework

All issues in laravel/rust-framework

Similar issues

More Rust issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.