#deployment #server #tcp-listener

server-starter-listener

Server::Starter listener for hot deploy application

5 releases

0.2.0 Nov 24, 2019
0.1.2 Nov 24, 2019
0.1.1 Nov 16, 2019
0.1.0 Nov 16, 2019

#1 in #deploy

MIT/Apache

17KB
129 lines

Crates.io server-starter-listener at docs.rs Build Status

server-starter-listener-rs

Get Server::Starter listeners for rust application

This crate providers start_server / start_server listeners for rust server applications.

Examples

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.

Current version: Crates.io

Some additional info here

License: MIT OR Apache-2.0

Dependencies

~2.1–3MB
~55K SLoC