Crates.io | server-starter-listener |
lib.rs | server-starter-listener |
version | 0.2.0 |
source | src |
created_at | 2019-11-16 12:24:52.758535 |
updated_at | 2019-11-24 13:17:17.201449 |
description | Server::Starter listener for hot deploy application |
homepage | |
repository | https://github.com/krrrr38/server-starter-listener-rs |
max_upload_size | |
id | 181791 |
size | 98,088 |
Get Server::Starter listeners for rust application
This crate providers start_server / start_server listeners for rust server applications.
use actix_web::{HttpServer, App};
use server_starter_listener::{listeners, ServerStarterListener};
let listener = listeners().unwrap().pop().unwrap();
match listener {
ServerStarterListener::Tcp(listener) => {
HttpServer::new(|| App::new()).listen(listener).unwrap().run().unwrap();
}
_ => unimplemented!(),
}
You need to start application using start_server / start_server.
> start_server --port=80 -- your_server_binary
Now you can do hot-deploy by send SIGHUP
to start_server
process.
start_server
share file descriptor to new process and send SIGTERM
to old process.
Some additional info here
License: MIT OR Apache-2.0