Usage: granian [OPTIONS] APP
APP Application target to serve. [required]
Options:
--host TEXT Host address to bind to [env var:
GRANIAN_HOST; default: (127.0.0.1)]
--port INTEGER Port to bind to. [env var: GRANIAN_PORT;
default: 8000]
--uds PATH Unix Domain Socket to bind to. [env var:
GRANIAN_UDS]
--uds-permissions OCTAL INTEGER
Unix Domain Socket file permissions [env
var: GRANIAN_UDS_PERMISSIONS]
--interface [asgi|asginl|rsgi|wsgi]
Application interface type [env var:
GRANIAN_INTERFACE; default: (rsgi)]
--http [auto|1|2] HTTP version [env var: GRANIAN_HTTP;
default: (auto)]
--ws / --no-ws Enable websockets handling [env var:
GRANIAN_WEBSOCKETS; default: (enabled)]
--workers INTEGER RANGE Number of worker processes [env var:
GRANIAN_WORKERS; default: 1; x>=1]
--blocking-threads INTEGER RANGE
Number of blocking threads (per worker)
[env var: GRANIAN_BLOCKING_THREADS; x>=1]
--blocking-threads-idle-timeout DURATION
The maximum amount of time in seconds (or a
human-readable duration) an idle blocking
thread will be kept alive [env var:
GRANIAN_BLOCKING_THREADS_IDLE_TIMEOUT;
default: 30; 5<=x<=600]
--runtime-threads INTEGER RANGE
Number of runtime threads (per worker) [env
var: GRANIAN_RUNTIME_THREADS; default: 1;
x>=1]
--runtime-blocking-threads INTEGER RANGE
Number of runtime I/O blocking threads (per
worker) [env var:
GRANIAN_RUNTIME_BLOCKING_THREADS; x>=1]
--runtime-mode [auto|mt|st] Runtime mode to use (single/multi threaded)
[env var: GRANIAN_RUNTIME_MODE; default:
(auto)]
--loop [auto|asyncio|rloop|uvloop|winloop]
Event loop implementation [env var:
GRANIAN_LOOP; default: (auto)]
--task-impl [asyncio|rust] Async task implementation to use [env var:
GRANIAN_TASK_IMPL; default: (asyncio)]
--backlog INTEGER RANGE Maximum number of connections to hold in
backlog (globally) [env var:
GRANIAN_BACKLOG; default: 1024; x>=128]
--backpressure INTEGER RANGE Maximum number of requests to process
concurrently (per worker) [env var:
GRANIAN_BACKPRESSURE; default:
(backlog/workers); x>=1]
--http1-buffer-size INTEGER RANGE
Sets the maximum buffer size for HTTP/1
connections [env var:
GRANIAN_HTTP1_BUFFER_SIZE; default: 417792;
x>=8192]
--http1-header-read-timeout INTEGER RANGE
Sets a timeout (in milliseconds) to read
headers [env var:
GRANIAN_HTTP1_HEADER_READ_TIMEOUT; default:
30000; 1<=x<=60000]
--http1-keep-alive / --no-http1-keep-alive
Enables or disables HTTP/1 keep-alive [env
var: GRANIAN_HTTP1_KEEP_ALIVE; default:
(enabled)]
--http1-pipeline-flush / --no-http1-pipeline-flush
Aggregates HTTP/1 flushes to better support
pipelined responses (experimental) [env
var: GRANIAN_HTTP1_PIPELINE_FLUSH; default:
(disabled)]
--http2-adaptive-window / --no-http2-adaptive-window
Sets whether to use an adaptive flow control
for HTTP2 [env var:
GRANIAN_HTTP2_ADAPTIVE_WINDOW; default:
(disabled)]
--http2-initial-connection-window-size INTEGER RANGE
Sets the max connection-level flow control
for HTTP2 [env var: GRANIAN_HTTP2_INITIAL_C
ONNECTION_WINDOW_SIZE; default: 1048576;
x>=1024]
--http2-initial-stream-window-size INTEGER RANGE
Sets the `SETTINGS_INITIAL_WINDOW_SIZE`
option for HTTP2 stream-level flow control
[env var:
GRANIAN_HTTP2_INITIAL_STREAM_WINDOW_SIZE;
default: 1048576; x>=1024]
--http2-keep-alive-interval INTEGER RANGE
Sets an interval (in milliseconds) for HTTP2
Ping frames should be sent to keep a
connection alive [env var:
GRANIAN_HTTP2_KEEP_ALIVE_INTERVAL;
1<=x<=60000]
--http2-keep-alive-timeout DURATION
Sets a timeout (in seconds or a human-
readable duration) for receiving an
acknowledgement of the HTTP2 keep-alive ping
[env var: GRANIAN_HTTP2_KEEP_ALIVE_TIMEOUT;
default: 20; x>=1]
--http2-max-concurrent-streams INTEGER RANGE
Sets the SETTINGS_MAX_CONCURRENT_STREAMS
option for HTTP2 connections [env var:
GRANIAN_HTTP2_MAX_CONCURRENT_STREAMS;
default: 200; x>=10]
--http2-max-frame-size INTEGER RANGE
Sets the maximum frame size to use for HTTP2
[env var: GRANIAN_HTTP2_MAX_FRAME_SIZE;
default: 16384; x>=1024]
--http2-max-headers-size INTEGER RANGE
Sets the max size of received header frames
[env var: GRANIAN_HTTP2_MAX_HEADERS_SIZE;
default: 16777216; x>=1]
--http2-max-send-buffer-size INTEGER RANGE
Set the maximum write buffer size for each
HTTP/2 stream [env var:
GRANIAN_HTTP2_MAX_SEND_BUFFER_SIZE; default:
409600; x>=1024]
--log / --no-log Enable logging [env var:
GRANIAN_LOG_ENABLED; default: (enabled)]
--log-level [critical|error|warning|warn|info|debug|notset]
Log level [env var: GRANIAN_LOG_LEVEL;
default: (info)]
--log-config FILE Logging configuration file (json) [env var:
GRANIAN_LOG_CONFIG]
--access-log / --no-access-log Enable access log [env var:
GRANIAN_LOG_ACCESS_ENABLED; default:
(disabled)]
--access-log-fmt TEXT Access log format [env var:
GRANIAN_LOG_ACCESS_FMT]
--ssl-certificate FILE SSL certificate file [env var:
GRANIAN_SSL_CERTIFICATE]
--ssl-keyfile FILE SSL key file (PKCS#8 format only) [env var:
GRANIAN_SSL_KEYFILE]
--ssl-keyfile-password TEXT SSL key password [env var:
GRANIAN_SSL_KEYFILE_PASSWORD]
--ssl-protocol-min [tls1.2|tls1.3]
Set the minimum supported protocol for SSL
connections. [env var:
GRANIAN_SSL_PROTOCOL_MIN; default: (tls1.3)]
--ssl-ca FILE Root SSL cerificate file for client
verification [env var: GRANIAN_SSL_CA]
--ssl-crl FILE SSL CRL file(s) [env var: GRANIAN_SSL_CRL]
--ssl-client-verify / --no-ssl-client-verify
Verify clients SSL certificates [env var:
GRANIAN_SSL_CLIENT_VERIFY; default:
(disabled)]
--url-path-prefix TEXT URL path prefix the app is mounted on [env
var: GRANIAN_URL_PATH_PREFIX]
--respawn-failed-workers / --no-respawn-failed-workers
Enable workers respawn on unexpected exit
[env var: GRANIAN_RESPAWN_FAILED_WORKERS;
default: (disabled)]
--respawn-interval FLOAT The number of seconds to sleep between
workers respawn [env var:
GRANIAN_RESPAWN_INTERVAL; default: 3.5]
--rss-sample-interval DURATION The sample rate in seconds (or a human-
readable duration) for the resource monitor
[env var: GRANIAN_RSS_SAMPLE_INTERVAL;
default: 30; 1<=x<=300]
--rss-samples INTEGER RANGE The number of consecutive samples to
consider a worker over resource limit [env
var: GRANIAN_RSS_SAMPLES; default: 1; x>=1]
--workers-lifetime DURATION The maximum amount of time in seconds (or a
human-readable duration) a worker will be
kept alive before respawn [env var:
GRANIAN_WORKERS_LIFETIME; x>=60]
--workers-max-rss INTEGER RANGE
The maximum amount of memory (in MiB) a
worker can consume before respawn [env var:
GRANIAN_WORKERS_MAX_RSS; x>=1]
--workers-kill-timeout DURATION
The amount of time in seconds (or a human-
readable duration) to wait for killing
workers that refused to gracefully stop
[env var: GRANIAN_WORKERS_KILL_TIMEOUT;
default: (disabled); 1<=x<=1800]
--factory / --no-factory Treat target as a factory function, that
should be invoked to build the actual target
[env var: GRANIAN_FACTORY; default:
(disabled)]
--working-dir DIRECTORY Set the working directory [env var:
GRANIAN_WORKING_DIR]
--env-files FILE Environment file(s) to load (requires
granian[dotenv] extra) [env var:
GRANIAN_ENV_FILES]
--static-path-route TEXT Route(s) for static file serving [env var:
GRANIAN_STATIC_PATH_ROUTE; default:
(/static)]
--static-path-mount DIRECTORY Path(s) to mount for static file serving
[env var: GRANIAN_STATIC_PATH_MOUNT]
--static-path-dir-to-file TEXT Serve the specified file as the index for
directory listings [env var:
GRANIAN_STATIC_PATH_DIR_TO_FILE]
--static-path-expires DURATION Cache headers expiration (in seconds or a
human-readable duration) for static file
serving. 0 to disable. [env var:
GRANIAN_STATIC_PATH_EXPIRES; default: 86400;
x>=0]
--metrics / --no-metrics Enable the prometheus metrics exporter.
[env var: GRANIAN_METRICS_ENABLED; default:
(disabled)]
--metrics-scrape-interval DURATION
Configure the interval for metrics
collection. [env var:
GRANIAN_METRICS_SCRAPE_INTERVAL; default:
15; 1<=x<=60]
--metrics-address TEXT Metrics exporter host address to bind to
[env var: GRANIAN_METRICS_ADDRESS; default:
(127.0.0.1)]
--metrics-port INTEGER Metrics exporter port to bind to. [env var:
GRANIAN_METRICS_PORT; default: 9090]
--reload / --no-reload Enable auto reload on application's files
changes (requires granian[reload] extra)
[env var: GRANIAN_RELOAD; default:
(disabled)]
--reload-paths PATH Paths to watch for changes [env var:
GRANIAN_RELOAD_PATHS; default: (Working
directory)]
--reload-ignore-dirs TEXT Names of directories to ignore changes for.
Extends the default list of directories to
ignore in watchfiles' default filter [env
var: GRANIAN_RELOAD_IGNORE_DIRS]
--reload-ignore-patterns TEXT File/directory name patterns (regex) to
ignore changes for. Extends the default list
of patterns to ignore in watchfiles' default
filter [env var:
GRANIAN_RELOAD_IGNORE_PATTERNS]
--reload-ignore-paths PATH Absolute paths to ignore changes for [env
var: GRANIAN_RELOAD_IGNORE_PATHS]
--reload-tick INTEGER RANGE The tick frequency (in milliseconds) the
reloader watch for changes [env var:
GRANIAN_RELOAD_TICK; default: 50;
50<=x<=5000]
--reload-ignore-worker-failure / --no-reload-ignore-worker-failure
Ignore worker failures when auto reload is
enabled [env var:
GRANIAN_RELOAD_IGNORE_WORKER_FAILURE;
default: (disabled)]
--process-name TEXT Set a custom name for processes (requires
granian[pname] extra) [env var:
GRANIAN_PROCESS_NAME]
--pid-file FILE A path to write the PID file to [env var:
GRANIAN_PID_FILE]
--version Show the version and exit.
--help Show this message and exit.
Options (52)
| Option | Description | Source |
|---|---|---|
--host TEXT | Host address to bind to [env var: GRANIAN_HOST; | help |
--port INTEGER | Port to bind to. | help |
--uds PATH | Unix Domain Socket to bind to. | help |
--interface asgi|asginl|rsgi|wsgi | Application interface type [env var: GRANIAN_INTERFACE; | help |
--http auto|1|2 | HTTP version [env var: GRANIAN_HTTP; | help |
--ws / | Enable websockets handling [env var: GRANIAN_WEBSOCKETS; | help |
--workers INTEGER | Number of worker processes [env var: GRANIAN_WORKERS; | help |
--blocking-threads-idle-timeout DURATION | The maximum amount of time in seconds (or a human-readable duration) an idle blocking thread will be kept alive [env var: GRANIAN_BLOCKING_THREADS_IDLE_TIMEOUT; | help |
--runtime-mode auto|mt|st | Runtime mode to use (single/multi threaded) [env var: GRANIAN_RUNTIME_MODE; | help |
--loop auto|asyncio|rloop|uvloop|winloop | Event loop implementation [env var: GRANIAN_LOOP; | help |
--task-impl asyncio|rust | Async task implementation to use [env var: GRANIAN_TASK_IMPL; | help |
--backlog INTEGER | Maximum number of connections to hold in backlog (globally) [env var: GRANIAN_BACKLOG; | help |
--backpressure INTEGER | Maximum number of requests to process concurrently (per worker) [env var: GRANIAN_BACKPRESSURE; | help |
--http2-keep-alive-timeout DURATION | Sets a timeout (in seconds or a human- readable duration) for receiving an acknowledgement of the HTTP2 keep-alive ping [env var: GRANIAN_HTTP2_KEEP_ALIVE_TIMEOUT; | help |
--log / | Enable logging [env var: GRANIAN_LOG_ENABLED; | help |
--log-level | Log level [env var: GRANIAN_LOG_LEVEL; | help |
--log-config FILE | Logging configuration file (json) [env var: GRANIAN_LOG_CONFIG] | help |
--access-log / | Enable access log [env var: GRANIAN_LOG_ACCESS_ENABLED; | help |
--access-log-fmt TEXT | Access log format [env var: GRANIAN_LOG_ACCESS_FMT] | help |
--ssl-certificate FILE | SSL certificate file [env var: GRANIAN_SSL_CERTIFICATE] | help |
--ssl-keyfile FILE | SSL key file (PKCS#8 format only) [env var: GRANIAN_SSL_KEYFILE] | help |
--ssl-keyfile-password TEXT | SSL key password [env var: GRANIAN_SSL_KEYFILE_PASSWORD] | help |
--ssl-protocol-min tls1.2|tls1.3 | Set the minimum supported protocol for SSL connections. | help |
--ssl-ca FILE | Root SSL cerificate file for client verification [env var: GRANIAN_SSL_CA] | help |
--ssl-crl FILE | SSL CRL file(s) [env var: GRANIAN_SSL_CRL] | help |
--url-path-prefix TEXT | URL path prefix the app is mounted on [env var: GRANIAN_URL_PATH_PREFIX] | help |
--respawn-interval FLOAT | The number of seconds to sleep between workers respawn [env var: GRANIAN_RESPAWN_INTERVAL; | help |
--rss-sample-interval DURATION | The sample rate in seconds (or a human- readable duration) for the resource monitor [env var: GRANIAN_RSS_SAMPLE_INTERVAL; | help |
--rss-samples INTEGER | The number of consecutive samples to consider a worker over resource limit [env var: GRANIAN_RSS_SAMPLES; | help |
--workers-lifetime DURATION | The maximum amount of time in seconds (or a human-readable duration) a worker will be kept alive before respawn [env var: GRANIAN_WORKERS_LIFETIME; | help |
--workers-kill-timeout DURATION | The amount of time in seconds (or a human- readable duration) to wait for killing workers that refused to gracefully stop [env var: GRANIAN_WORKERS_KILL_TIMEOUT; | help |
--factory / | Treat target as a factory function, that should be invoked to build the actual target [env var: GRANIAN_FACTORY; | help |
--working-dir DIRECTORY | Set the working directory [env var: GRANIAN_WORKING_DIR] | help |
--env-files FILE | Environment file(s) to load (requires granian[dotenv] extra) [env var: GRANIAN_ENV_FILES] | help |
--static-path-route TEXT | Route(s) for static file serving [env var: GRANIAN_STATIC_PATH_ROUTE; | help |
--static-path-mount DIRECTORY | Path(s) to mount for static file serving [env var: GRANIAN_STATIC_PATH_MOUNT] | help |
--static-path-dir-to-file TEXT | Serve the specified file as the index for directory listings [env var: GRANIAN_STATIC_PATH_DIR_TO_FILE] | help |
--static-path-expires DURATION | Cache headers expiration (in seconds or a human-readable duration) for static file serving. | help |
--metrics / | Enable the prometheus metrics exporter. | help |
--metrics-scrape-interval DURATION | Configure the interval for metrics collection. | help |
--metrics-address TEXT | Metrics exporter host address to bind to [env var: GRANIAN_METRICS_ADDRESS; | help |
--metrics-port INTEGER | Metrics exporter port to bind to. | help |
--reload / | Enable auto reload on application's files changes (requires granian[reload] extra) [env var: GRANIAN_RELOAD; | help |
--reload-paths PATH | Paths to watch for changes [env var: GRANIAN_RELOAD_PATHS; | help |
--reload-ignore-dirs TEXT | Names of directories to ignore changes for. | help |
--reload-ignore-patterns TEXT | File/directory name patterns (regex) to ignore changes for. | help |
--reload-ignore-paths PATH | Absolute paths to ignore changes for [env var: GRANIAN_RELOAD_IGNORE_PATHS] | help |
--reload-tick INTEGER | The tick frequency (in milliseconds) the reloader watch for changes [env var: GRANIAN_RELOAD_TICK; | help |
--process-name TEXT | Set a custom name for processes (requires granian[pname] extra) [env var: GRANIAN_PROCESS_NAME] | help |
--pid-file FILE | A path to write the PID file to [env var: GRANIAN_PID_FILE] | help |
--version | Show the version and exit. | help |
--help | Show this message and exit. | help |