Skip to main content

Crate autumn_plugin_pingora

Crate autumn_plugin_pingora 

Source
Expand description

A Pingora reverse proxy for Autumn.

ⓘ
use autumn_plugin_pingora::{PingoraPlugin, Route};

#[autumn_web::main]
async fn main() {
    autumn_web::app()
        .routes(routes![index])
        .plugin(PingoraPlugin::new().route(
            Route::new("billing").path_prefix("/billing").upstream("10.0.0.7:8080"),
        ))
        .run()
        .await;
}

The proxy has its own listener. The default is 127.0.0.1:8080 in dev and test, and 0.0.0.0:8080 in other profiles. The proxy sends matched requests to the route’s upstream pool. It sends all other requests to the Autumn app. It adds:

  • round-robin or consistent-hash load balancing,
  • TCP health checks and connect retries,
  • X-Forwarded-* headers,
  • body and connection limits,
  • a pingora indicator in /actuator/health,
  • pingora_proxy_* metrics in /actuator/prometheus,
  • graceful drain on Autumn’s shutdown signal.

See PingoraConfig for the [pingora] section of autumn.toml.

Structs§

ConfigError
A configuration problem. Boot stops.
LifecycleCell
A shared, atomic Lifecycle. The only way to change the state.
PingoraConfig
Settings for the proxy.
PingoraHandle
A handle to the proxy. Clone it freely. It is valid before and after boot.
PingoraPlugin
Runs a Pingora reverse proxy inside an Autumn app.
Resolved
A resolved configuration and the active profile.
Route
One route: a match rule and an upstream pool.
UpstreamHealth
Upstream health for one route.

Enums§

Fallback
Where unmatched requests go.
Lifecycle
The state of the proxy.
LifecycleEvent
An input to the state machine.
PingoraError
A startup failure. Boot stops. The plugin never falls back silently. Autumn shows the message in its boot error.
Selection
How a route picks an upstream.

Constants§

DEFAULT_PORT
The default proxy port.
DEFAULT_SECTION
The default config section.
MAX_CONNECTIONS_LIMIT
Largest max_connections.
PLUGIN_NAME
The name in Plugin::name, logs and errors.