Skip to content

Instantly share code, notes, and snippets.

@andrei-dascalu
Created February 15, 2022 08:23
Show Gist options
  • Save andrei-dascalu/620b8ca841da91b07e640ff79ad6d96f to your computer and use it in GitHub Desktop.
Save andrei-dascalu/620b8ca841da91b07e640ff79ad6d96f to your computer and use it in GitHub Desktop.
######################################################################################
# THIS IS SAMPLE OF THE CONFIGURATION #
# IT'S NOT A DEFAULT CONFIGURATION, IT'S JUST A REFERENCE TO ALL OPTIONS AND PLUGINS #
# MORE DOCS CAN BE FOUND HERE: <https://roadrunner.dev/docs/intro-config> #
######################################################################################
# Production usage guide: https://roadrunner.dev/docs/beep-beep-production
# Hint: RR will replace any config options using reference to environment variables,
# eg.: `option_key: ${ENVIRONMENT_VARIABLE_NAME}`.
# Important: TCP port numbers for each plugin (rpc, http, etc) must be unique!
# RR configuration version
version: "2.7"
# Remote Procedures Calling (docs: https://roadrunner.dev/docs/beep-beep-rpc)
# Is used for connecting to RoadRunner server from your PHP workers.
rpc:
# TCP address:port for listening.
#
# Default: "tcp://127.0.0.1:6001"
listen: tcp://127.0.0.1:6001
# Application server settings (docs: https://roadrunner.dev/docs/php-worker)
server:
#[SINCE 2.6]
#
# This option is required.
command: "php psr-worker.php"
# Username (not UID) for the worker processes. An empty value means to use the RR process user.
#
# Default: ""
user: ""
# Group name (not GID) for the worker processes. An empty value means to use the RR process user.
#
# Default: ""
group: ""
# Environment variables for the worker processes.
#
# Default: <empty map>
env:
- SOME_KEY: "SOME_VALUE"
- SOME_KEY2: "SOME_VALUE2"
# Worker relay can be: "pipes", TCP (eg.: tcp://127.0.0.1:6002), or socket (eg.: unix:///var/run/rr.sock).
#
# Default: "pipes"
relay: pipes
# Timeout for relay connection establishing (only for socket and TCP port relay).
#
# Default: 60s
relay_timeout: 60s
# Logging settings (docs: https://roadrunner.dev/docs/beep-beep-logging)
logs:
# Logging mode can be "development", "production" or "raw". Do not forget to change this value for production environment.
#
# Development mode (which makes DPanicLevel logs panic), uses a console encoder, writes to standard error, and
# disables sampling. Stacktraces are automatically included on logs of WarnLevel and above.
#
# Default: "development"
mode: raw
# Logging level can be "panic", "error", "warn", "info", "debug".
#
# Default: "debug"
level: debug
# Encoding format can be "console" or "json" (last is preferred for production usage).
#
# Default: "console"
encoding: json
# Log line ending
#
# Default: "\n"
line_ending: "\n"
# Output can be file (eg.: "/var/log/rr_errors.log"), "stderr" or "stdout".
#
# Default: "stderr"
output: stderr
# Errors only output can be file (eg.: "/var/log/rr_errors.log"), "stderr" or "stdout".
#
# Default: "stderr"
err_output: stderr
# You can configure each plugin log messages individually (key is plugin name, and value is logging options in same
# format as above).
#
# Default: <empty map>
channels:
http:
mode: raw
level: info
encoding: console
output: stdout
err_output: stderr
server:
mode: raw
level: info
encoding: json
output: stdout
err_output: stderr
# HTTP plugin settings.
http:
# Host and port to listen on (eg.: `127.0.0.1:8080`).
#
# This option is required.
address: 0.0.0.0:8080
# override http error code for the internal RR errors
#
# Default: 500
internal_error_code: 505
# HTTP access logs
#
# Default: false
access_logs: false
# Maximal incoming request size in megabytes. Zero means no limit.
#
# Default: 0
max_request_size: 256
# Middlewares for the http plugin, order is important. Allowed values is: "headers", "gzip", "static", "websockets", "sendfile", [SINCE 2.6] -> "new_relic", [SINCE 2.6] -> "http_metrics", [SINCE 2.7] -> "cache"
#
# Default value: []
middleware: [ "headers", "gzip" ]
# Allow incoming requests only from the following subnets (https://en.wikipedia.org/wiki/Reserved_IP_addresses).
#
# Default: ["10.0.0.0/8", "127.0.0.0/8", "172.16.0.0/12", "192.168.0.0/16", "::1/128", "fc00::/7", "fe80::/10"]
trusted_subnets:
[
"10.0.0.0/8",
"127.0.0.0/8",
"172.16.0.0/12",
"192.168.0.0/16",
"::1/128",
"fc00::/7",
"fe80::/10",
]
# RFC 7234 (partially) RR Cache middleware
cache:
# Cache driver
#
# Default: memory. Available drivers: memory
driver: memory
# Methods to cache
#
# According to the RFC, we can cache only GET, HEAD or POST requests. Currently, only GET method supported.
cache_methods: ["GET", "HEAD", "POST"]
# Configuration for the driver
#
# Empty for the memory
config: {}
# File uploading settings.
uploads:
# Directory for file uploads. Empty value means to use $TEMP based on your OS.
#
# Default: ""
dir: "./tmp"
# Deny files with the following extensions to upload.
#
# Default: [".php", ".exe", ".bat"]
forbid: [ ".php", ".exe", ".bat", ".sh" ]
# [SINCE 2.6] Allow files with the following extensions to upload
#
# Default: empty
allow: [ ".html", ".aaa" ]
# Settings for "headers" middleware (docs: https://roadrunner.dev/docs/http-headers).
headers:
# Allows to control CORS headers. Additional headers "Vary: Origin", "Vary: Access-Control-Request-Method",
# "Vary: Access-Control-Request-Headers" will be added to the server responses. Drop this section for this
# feature disabling.
cors:
# Controls "Access-Control-Allow-Origin" header value (docs: https://mzl.la/2OgD4Qf).
#
# Default: ""
allowed_origin: "*"
# Controls "Access-Control-Allow-Headers" header value (docs: https://mzl.la/2OzDVvk).
#
# Default: ""
allowed_headers: "*"
# Controls "Access-Control-Allow-Methods" header value (docs: https://mzl.la/3lbwyXf).
#
# Default: ""
allowed_methods: "GET,POST,PUT,DELETE"
# Controls "Access-Control-Allow-Credentials" header value (docs: https://mzl.la/3ekJGaY).
#
# Default: false
allow_credentials: true
# Controls "Access-Control-Expose-Headers" header value (docs: https://mzl.la/3qAqgkF).
#
# Default: ""
exposed_headers: "Cache-Control,Content-Language,Content-Type,Expires,Last-Modified,Pragma"
# Controls "Access-Control-Max-Age" header value in seconds (docs: https://mzl.la/2PCSdvt).
#
# Default: 0
max_age: 600
# Automatically add headers to every request passed to PHP.
#
# Default: <empty map>
request:
input: "custom-header"
# Automatically add headers to every response.
#
# Default: <empty map>
response:
X-Powered-By: "RoadRunner"
# Settings for "static" middleware (docs: https://roadrunner.dev/docs/http-static).
static:
# Path to the directory to serve
#
# Default: "." (current)
dir: "."
# File patterns to forbid
#
# Default: empty
forbid: [ "" ]
# Etag calculation (base on the body CRC32)
#
# Default: false
calculate_etag: false
# Weak etag calculation (based only on the content-length CRC32)
#
# Default: false
weak: false
# Patterns to allow
#
# Default: empty
allow: [ ".txt", ".php" ]
# Request headers
#
# Default: empty
request:
input: "custom-header"
# Response headers
#
# Default: empty
response:
output: "output-header"
# Workers pool settings.
pool:
# Debug mode for the pool. In this mode, pool will not pre-allocate the worker. Worker (only 1, num_workers ignored) will be allocated right after the request arrived.
#
# Default: false
debug: false
# How many worker processes will be started. Zero (or nothing) means the number of logical CPUs.
#
# Default: 0
num_workers: 0
# Maximal count of worker executions. Zero (or nothing) means no limit.
#
# Default: 0
max_jobs: 64
# Timeout for worker allocation. Zero means no limit.
#
# Default: 60s
allocate_timeout: 60s
# Timeout for worker destroying before process killing. Zero means no limit.
#
# Default: 60s
destroy_timeout: 60s
# Supervisor is used to control http workers (previous name was "limit", docs:
# https://roadrunner.dev/docs/php-limit). "Soft" limits will not interrupt current request processing. "Hard"
# limit on the contrary - interrupts the execution of the request.
supervisor:
# How often to check the state of the workers.
#
# Default: 1s
watch_tick: 1s
# Maximum time worker is allowed to live (soft limit). Zero means no limit.
#
# Default: 0s
ttl: 0s
# How long worker can spend in IDLE mode after first using (soft limit). Zero means no limit.
#
# Default: 0s
idle_ttl: 10s
# Maximal worker memory usage in megabytes (soft limit). Zero means no limit.
#
# Default: 0
max_worker_memory: 128
# Maximal job lifetime (hard limit). Zero means no limit.
#
# Default: 0s
exec_ttl: 60s
# HTTP/2 settings.
http2:
# HTTP/2 over non-encrypted TCP connection using H2C.
#
# Default: false
h2c: true
# Maximal concurrent streams count.
#
# Default: 128
max_concurrent_streams: 256
reload:
# sync interval
interval: 1s
# global patterns to sync
patterns: [ ".php" ]
# list of included for sync services
services:
http:
# recursive search for file patterns to add
recursive: true
# ignored folders
ignore: [ "vendor" ]
# service specific file pattens to sync
patterns: [ ".php", ".go", ".md" ]
# directories to sync. If recursive is set to true,
# recursive sync will be applied only to the directories in `dirs` section
dirs: [ "." ]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment