diff options
-rw-r--r-- | .SRCINFO | 11 | ||||
-rw-r--r-- | .rr.yaml.sample-full | 355 | ||||
-rw-r--r-- | .rr.yaml.sample-minimal | 12 | ||||
-rw-r--r-- | 02-build_version_time.patch | 25 | ||||
-rw-r--r-- | PKGBUILD | 38 |
5 files changed, 225 insertions, 216 deletions
@@ -1,20 +1,17 @@ pkgbase = roadrunner pkgdesc = High-performance PHP application server, load-balancer and process manager written in Golang - pkgver = 1.9.2 - pkgrel = 3 + pkgver = 2.0.0 + pkgrel = 1 url = https://roadrunner.dev/ arch = x86_64 license = MIT makedepends = go>=1.13 depends = php>=7.3 - conflicts = roadrunner-leo-patched options = !buildflags - source = https://github.com/spiral/roadrunner/archive/v1.9.2.tar.gz + source = https://github.com/spiral/roadrunner-binary/archive/v2.0.0.tar.gz source = .rr.yaml.sample-full source = .rr.yaml.sample-minimal - source = 02-build_version_time.patch - sha256sums = b49f082391380ac66e1e90f147594d7c3772a3b9eddb042f04b338083ae40e33 - sha256sums = SKIP + sha256sums = 2faf5e5176aefcddf15c6ee66a73e182b51edf4aad50ff53155a83b786b5e216 sha256sums = SKIP sha256sums = SKIP diff --git a/.rr.yaml.sample-full b/.rr.yaml.sample-full index edfed480dd9f..b716800e9218 100644 --- a/.rr.yaml.sample-full +++ b/.rr.yaml.sample-full @@ -1,180 +1,209 @@ -# defines environment variables for all underlying php processes -env: - key: value - -# rpc bus allows php application and external clients to talk to rr services. rpc: - # enable rpc server - enable: true - - # rpc connection DSN. Supported TCP and Unix sockets. - listen: tcp://127.0.0.1:6001 - -metrics: - # prometheus client address (path /metrics added automatically) - address: localhost:2112 - collect: - app_metric: - type: histogram - help: "Custom application metric" - labels: ["type"] - buckets: [0.1, 0.2, 0.3, 1.0] + listen: tcp://127.0.0.1:6001 + +server: + command: "php tests/psr-worker-bench.php" + # optional + user: "" + # optional + group: "" + env: + - SOME_KEY: "SOME_VALUE" + - SOME_KEY2: "SOME_VALUE2" + relay: "pipes" + relay_timeout: 20s + + +# optional for development +logs: + # default + mode: development + level: debug + encoding: console + output: stderr + err_output: stderr + channels: + http: + mode: development + level: panic + encoding: console + output: stdout + server: + mode: production + level: info + encoding: console + output: stderr + rpc: + mode: production + level: debug + encoding: console + output: stderr + +# Workflow and activity mesh service +temporal: + address: localhost:7233 + activities: + num_workers: 4 + codec: proto + debug_level: 2 -# http service configuration. http: - # http host to listen. - address: 0.0.0.0:8080 - - # HTTP service provides FastCGI as frontend - fcgi: - # FastCGI connection DSN. Supported TCP and Unix sockets. - address: tcp://0.0.0.0:6920 - - # HTTP service provides HTTP2 transport - http2: - # enable HTTP/2, only with TLS - enabled: true - - # to enable H2C on TCP connections, false by default - h2c: true - - # max transfer channels - maxConcurrentStreams: 128 - - # max POST request size, including file uploads in MB. - maxRequestSize: 200 - - # file upload configuration. + # host and port separated by semicolon + address: 127.0.0.1:44933 + max_request_size: 1024 + # middlewares for the http plugin, order matters + middleware: [ "gzip", "headers" ] + # uploads uploads: - # list of file extensions which are forbidden for uploading. - forbid: [".php", ".exe", ".bat"] - - # cidr blocks which can set ip using X-Real-Ip or X-Forwarded-For - trustedSubnets: ["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"] - - # http worker pool configuration. - workers: - # php worker command. - command: "php psr-worker.php pipes" - - # User under which process will be started. To use this feature RR needs to be run under the root - # https://www.man7.org/linux/man-pages/man7/user_namespaces.7.html - user: "" - - # connection method (pipes, tcp://:9000, unix://socket.unix). default "pipes" - relay: "pipes" - - # worker pool configuration. - pool: - # number of workers to be serving. - numWorkers: 4 - - # maximum jobs per worker, 0 - unlimited. - maxJobs: 0 - - # for how long worker is allowed to be bootstrapped. - allocateTimeout: 60 - - # amount of time given to the worker to gracefully destruct itself. - destroyTimeout: 60 - -# Additional HTTP headers and CORS control. -headers: - # Middleware to handle CORS requests, https://www.w3.org/TR/cors/ + forbid: [ ".php", ".exe", ".bat" ] + 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", + ] + # headers + headers: cors: - # https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Access-Control-Allow-Origin - allowedOrigin: "*" - - # https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Access-Control-Allow-Headers - allowedHeaders: "*" - - # https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Access-Control-Allow-Methods - allowedMethods: "GET,POST,PUT,DELETE" - - # https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Access-Control-Allow-Credentials - allowCredentials: true - - # https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Access-Control-Expose-Headers - exposedHeaders: "Cache-Control,Content-Language,Content-Type,Expires,Last-Modified,Pragma" - - # Max allowed age in seconds - maxAge: 600 - - # Automatically add headers to every request passed to PHP. + allowed_origin: "*" + allowed_headers: "*" + allowed_methods: "GET,POST,PUT,DELETE" + allow_credentials: true + exposed_headers: "Cache-Control,Content-Language,Content-Type,Expires,Last-Modified,Pragma" + max_age: 600 request: - "Example-Request-Header": "Value" - - # Automatically add headers to every response. + input: "custom-header" response: - "X-Powered-By": "RoadRunner" - -# monitors rr server(s) -limit: - # check worker state each second - interval: 1 - - # custom watch configuration for each service - services: - # monitor HTTP workers - http: - # maximum allowed memory consumption per worker (soft) - maxMemory: 100 - - # maximum time to live for the worker (soft) - TTL: 0 - - # maximum allowed amount of time worker can spend in idle before being removed (for weak db connections, soft) - idleTTL: 0 - - # max_execution_time (brutal) - execTTL: 60 - -# static file serving. remove this section to disable static file serving. -static: - # root directory for static file (HTTP would not serve .php and .htaccess files). - dir: "public" - - # list of extensions for forbid for serving. - forbid: [".php", ".htaccess"] - - # Automatically add headers to every request. + output: "output-header" + # http static + static: + dir: "tests" + forbid: [ "" ] request: - "Example-Request-Header": "Value" - - # Automatically add headers to every response. + "input": "custom-header" response: - "X-Powered-By": "RoadRunner" + "output": "output-header" + + pool: + # default - num of logical CPUs + num_workers: 6 + # default 0 - no limit + max_jobs: 0 + # default 1 minute + allocate_timeout: 60s + # default 1 minute + destroy_timeout: 60s + # supervisor used to control http workers + supervisor: + # watch_tick defines how often to check the state of the workers (seconds) + watch_tick: 1s + # ttl defines maximum time worker is allowed to live (seconds) (soft) + ttl: 0 + # idle_ttl defines maximum duration worker can spend in idle mode after first use. Disabled when 0 (seconds) + idle_ttl: 10s + # exec_ttl defines maximum lifetime per job (seconds) + exec_ttl: 10s + # max_worker_memory limits memory usage per worker (MB) + max_worker_memory: 100 + + ssl: + # host and port separated by semicolon (default :443) + address: :8892 + redirect: false + cert: fixtures/server.crt + key: fixtures/server.key + root_ca: root.crt + fcgi: + address: tcp://0.0.0.0:7921 + http2: + h2c: false + max_concurrent_streams: 128 + +# plugin which can be used in other Golang plugins +# this is not an PHP plugin +redis: + # UniversalClient is an abstract client which - based on the provided options - + # can connect to either clusters, or sentinel-backed failover instances + # or simple single-instance servers. This can be useful for testing + # cluster-specific applications locally. + # if the number of addrs is 1 and master_name is empty, a single-node redis Client will be returned + # if the number of addrs is two or more, a ClusterClient will be returned + addrs: + - "localhost:6379" + # if a MasterName is passed a sentinel-backed FailoverClient will be returned + master_name: "" + username: "" + password: "" + db: 0 + sentinel_password: "" + route_by_latency: false + route_randomly: false + dial_timeout: 0 # accepted values [1s, 5m, 3h] + max_retries: 1 + min_retry_backoff: 0 # accepted values [1s, 5m, 3h] + max_retry_backoff: 0 # accepted values [1s, 5m, 3h] + pool_size: 0 + min_idle_conns: 0 + max_conn_age: 0 # accepted values [1s, 5m, 3h] + read_timeout: 0 # accepted values [1s, 5m, 3h] + write_timeout: 0 # accepted values [1s, 5m, 3h] + pool_timeout: 0 # accepted values [1s, 5m, 3h] + idle_timeout: 0 # accepted values [1s, 5m, 3h] + idle_check_freq: 0 # accepted values [1s, 5m, 3h] + read_only: false + +# boltdb simple driver +boltdb: + dir: "." + file: "rr" + bucket: "test" + permissions: 0777 + # keys ttl check interval + TTL: 60 # seconds + +# memcached driver +memcached: + addr: + - "localhost:11211" + +# in memory KV driver +memory: + # keys ttl check interval + interval: 60 -# health service configuration -health: - # http host to serve health requests. - address: localhost:2113 +metrics: + # prometheus client address (path /metrics added automatically) + address: localhost:2112 + collect: + app_metric: + type: histogram + help: "Custom application metric" + labels: [ "type" ] + buckets: [ 0.1, 0.2, 0.3, 1.0 ] + # objectives defines the quantile rank estimates with their respective + # absolute error [ for summary only ] + objectives: + - 1.4: 2.3 + - 2.0: 1.4 reload: - # enable or disable file watcher - enabled: true # sync interval interval: 1s # global patterns to sync - patterns: [".php"] + patterns: [ ".go" ] # 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: ["."] - jobs: - recursive: false - ignore: ["service/metrics"] - dirs: ["./jobs"] - rpc: - recursive: true - patterns: [".json"] - # to include all project directories from workdir, leave `dirs` empty or add a dot "." - dirs: [""]
\ No newline at end of file + 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: [ "." ]
\ No newline at end of file diff --git a/.rr.yaml.sample-minimal b/.rr.yaml.sample-minimal index a5a6931ea53f..dbbfc5fda87c 100644 --- a/.rr.yaml.sample-minimal +++ b/.rr.yaml.sample-minimal @@ -1,3 +1,11 @@ +rpc: + listen: tcp://127.0.0.1:6001 + +server: + command: "php worker.php" + http: - address: ":8080" - workers.command: "php psr-worker.php"
\ No newline at end of file + address: "0.0.0.0:8080" + +logs: + level: error
\ No newline at end of file diff --git a/02-build_version_time.patch b/02-build_version_time.patch deleted file mode 100644 index ae8b93eaebea..000000000000 --- a/02-build_version_time.patch +++ /dev/null @@ -1,25 +0,0 @@ -diff --git a/Makefile b/Makefile -index 9ad158b..96393c4 100755 ---- a/Makefile -+++ b/Makefile -@@ -4,6 +4,11 @@ - - SHELL = /bin/sh - -+RR_VERSION = 1.9.2 -+ -+LDFLAGS += -X github.com/spiral/roadrunner/cmd/rr/cmd.Version=${RR_VERSION} -+LDFLAGS += -X github.com/spiral/roadrunner/cmd/rr/cmd.BuildTime=$(shell date +%FT%T%z) -+ - .DEFAULT_GOAL := build - - # This will output the help for each task. thanks to https://marmelab.com/blog/2016/02/29/auto-documented-makefile.html -@@ -12,7 +17,7 @@ help: ## Show this help - @awk 'BEGIN {FS = ":.*?## "} /^[a-zA-Z0-9_-]+:.*?## / {printf " \033[32m%-14s\033[0m %s\n", $$1, $$2}' $(MAKEFILE_LIST) - - build: ## Build RR binary file for local os/arch -- CGO_ENABLED=0 go build -trimpath -ldflags "-s" -o ./rr ./cmd/rr/main.go -+ CGO_ENABLED=0 go build -trimpath -ldflags "${LDFLAGS} -s" -o ./rr ./cmd/rr/main.go - - clean: ## Make some clean - rm ./rr @@ -1,8 +1,9 @@ # Maintainer: Leo <i@setuid0.dev> pkgname=roadrunner -pkgver=1.9.2 -pkgrel=3 +_dirname=${pkgname}-binary +pkgver=2.0.0 +pkgrel=1 pkgdesc="High-performance PHP application server, load-balancer and process manager written in Golang" arch=(x86_64) url="https://roadrunner.dev/" @@ -10,21 +11,22 @@ license=(MIT) depends=("php>=7.3") makedepends=("go>=1.13") source=( - "https://github.com/spiral/$pkgname/archive/v$pkgver.tar.gz" + "https://github.com/spiral/$_dirname/archive/v$pkgver.tar.gz" ".rr.yaml.sample-full" ".rr.yaml.sample-minimal" - "02-build_version_time.patch" ) sha256sums=( - "b49f082391380ac66e1e90f147594d7c3772a3b9eddb042f04b338083ae40e33" - SKIP + "2faf5e5176aefcddf15c6ee66a73e182b51edf4aad50ff53155a83b786b5e216" SKIP SKIP ) options=("!buildflags") -# Won't allow installing of both patched and original version. -conflicts=("roadrunner-leo-patched") +prepare() { + export GOPATH="$srcdir"/gopath + cd "$_dirname-$pkgver" + go mod download +} build() { export GOPATH="$srcdir"/gopath @@ -32,20 +34,18 @@ build() { export CGO_CFLAGS="${CFLAGS}" export CGO_CXXFLAGS="${CXXFLAGS}" export CGO_LDFLAGS="${LDFLAGS}" - cd "$pkgname-$pkgver" - patch -p1 < $srcdir/02-build_version_time.patch - go mod download - make -} - -check() { - export GOPATH="$srcdir"/gopath - cd "$pkgname-$pkgver" - make test + cd "$_dirname-$pkgver" + CGO_ENABLED=0 go build \ + -trimpath \ + -ldflags "-s\ + -X github.com/spiral/roadrunner-binary/v2/cli.Version=${pkgver}\ + -X github.com/spiral/roadrunner-binary/v2/cli.BuildTime=$(date +%FT%T%z)" \ + -o ./rr \ + ./main.go } package() { - cd "$pkgname-$pkgver" + cd "$_dirname-$pkgver" install -Dt "$pkgdir/usr/bin/" -m755 rr install -Dt "$pkgdir/usr/share/$pkgname/" -m644 "$srcdir/.rr.yaml.sample-full" install -Dt "$pkgdir/usr/share/$pkgname/" -m644 "$srcdir/.rr.yaml.sample-minimal" |