Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/cloudflare/shellflip
Graceful process restarts in Rust
https://github.com/cloudflare/shellflip
graceful-shutdown process restart rust server systemd
Last synced: about 20 hours ago
JSON representation
Graceful process restarts in Rust
- Host: GitHub
- URL: https://github.com/cloudflare/shellflip
- Owner: cloudflare
- License: bsd-3-clause
- Created: 2023-03-31T09:27:18.000Z (almost 2 years ago)
- Default Branch: main
- Last Pushed: 2024-11-21T18:15:38.000Z (2 months ago)
- Last Synced: 2025-01-31T00:28:54.742Z (2 days ago)
- Topics: graceful-shutdown, process, restart, rust, server, systemd
- Language: Rust
- Homepage: https://blog.cloudflare.com/oxy-the-journey-of-graceful-restarts/
- Size: 50.8 KB
- Stars: 268
- Watchers: 7
- Forks: 9
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# shellflip
[![crates.io](https://img.shields.io/crates/v/shellflip.svg)](https://crates.io/crates/shellflip)
[![docs.rs](https://docs.rs/shellflip/badge.svg)](https://docs.rs/shellflip)Graceful process restarts in Rust.
This crate facilitates upgrading or reconfiguring a service without disrupting existing connections.
This is achieved by forking the process and communicating a small amount of state between the old
and new processes; once the new process has started successfully the old process may terminate.This crate has the following goals:
* No old code keeps running after a successful upgrade (and inevitable shutdown of the old process)
* The new process has a grace period for performing initialisation
* Crashing during initialisation is OK
* Only a single upgrade is ever run in parallel
* It is possible for the user/process initiating the upgrade to know if the upgrade succeededInspired by the [tableflip](https://github.com/cloudflare/tableflip) go package but not a direct
replacement.# Using the library
A full example is given in the [restarter example service](examples/restarter.rs).
The main struct of interest is `RestartConfig` which has methods for detecting or initiating
restart. For shutting down a restarted process, the `ShutdownCoordinator` provides the means for
both signalling a shutdown event to spawned tasks, and awaiting their completion.## License
BSD licensed. See the [LICENSE](LICENSE) file for details.
π¦γ( ΒΊ _ ΒΊγ) - respect crables!