diff --git a/.rr.yaml b/.rr.yaml index 89cd3fc..db8798e 100644 --- a/.rr.yaml +++ b/.rr.yaml @@ -73,6 +73,11 @@ logs: # Default: "console" encoding: console + # Log line ending + # + # Default: "\n" + line_ending: "\n" + # Output can be file (eg.: "/var/log/rr_errors.log"), "stderr" or "stdout". # # Default: "stderr" @@ -328,36 +333,23 @@ service: # Default: none, required. command: php tests/plugins/service/test_files/loop.php + # Env variables for the process + # + # Default: empty + env: + foo: "BAR" + foo2: "BAR2" + # Number of copies (processes) to start per command. # # Default: 1 process_num: 1 - # Allowed execute timeout. + # Allowed time before stop. # # Default: 0 (infinity), can be 1s, 2m, 2h (seconds, minutes, hours) exec_timeout: 0 - # Console output - # - # Default: stderr. Available options: stderr, stdout - output: "stderr" - - # Endings for the stderr/stdout output - # - # Default: "\n". Available options: any. - line_ending: "\n" - - # Color for regular output - # - # Default: none. Available options: white, red, green, yellow, blue, magenta - color: "green" - - # Color for the process errors - # - # Default: none. Available options: white, red, green, yellow, blue, magenta - err_color: "red" - # Remain process after exit. In other words, restart process after exit with any exit code. # # Default: "false" @@ -377,36 +369,23 @@ service: # Default: none, required. command: "binary" + # Env variables for the process + # + # Default: empty + env: + foo: "BAR" + foo2: "BAR2" + # Number of copies (processes) to start per command. # # Default: 1 process_num: 1 - # Allowed execute timeout. + # Allowed time before stop. # # Default: 0 (infinity), can be 1s, 2m, 2h (seconds, minutes, hours) exec_timeout: 0 - # Console output - # - # Default: stderr. Available options: stderr, stdout - output: "stderr" - - # Endings for the stderr/stdout output - # - # Default: "\n". Available options: any. - line_ending: "\n" - - # Color for regular output - # - # Default: none. Available options: white, red, green, yellow, blue, magenta - color: "green" - - # Color for the process errors - # - # Default: none. Available options: white, red, green, yellow, blue, magenta - err_color: "red" - # Remain process after exit. In other words, restart process after exit with any exit code. # # Default: "false" @@ -424,12 +403,22 @@ http: # This option is required. address: 127.0.0.1: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", "websockets" + # Middlewares for the http plugin, order is important. Allowed values is: "headers", "gzip", "websockets", "sendfile" # # Default value: [] middleware: [ "headers", "gzip" ] @@ -877,7 +866,14 @@ reload: # Default: [] patterns: [ ".php", ".go", ".md" ] -# Boltdb local jobs driver + +# NATS jobs driver +# +# Default: nats://127.0.0.1:4222 +nats: + addr: "demo.nats.io" + +# Boltdb jobs driver # # This option is required to use boltdb driver boltdb: @@ -964,14 +960,17 @@ jobs: # # This option is required when defining pipelines via configuration. test-local: + # Driver associated with the pipeline # # This option is required. Possible values: amqp, memory, sqs, beanstalk, boltdb driver: memory + # Pipeline priority # # If the job has priority set to 0, it will inherit the pipeline's priority. Default: 10. priority: 10 + # Number of job to prefetch from the driver. # # Default: 100_000. @@ -985,10 +984,12 @@ jobs: # # This option is required. Possible values: amqp, memory, sqs, beanstalk, boltdb driver: boltdb + # Pipeline priority # # If the job has priority set to 0, it will inherit the pipeline's priority. Default: 10. priority: 10 + # Number of job to prefetch from the driver. # # Default: 100_000. @@ -999,43 +1000,50 @@ jobs: # # This option is required. drier: amqp + # QoS - prefetch. # # Default: 10 prefetch: 10 + # Queue name # # Default: default queue: test-1-queue - # Pipeline jobs priority, 1 - highest + + # Pipeline priority # - # Default: 10 + # If the job has priority set to 0, it will inherit the pipeline's priority. Default: 10. priority: 1 + # Exchange name # # Default: amqp.default exchange: default + # Exchange type # # Default: direct. exchange_type: direct + # Routing key for the queue # # Default: empty. routing_key: test + # Declare a queue exclusive at the exchange # # Default: false exclusive: false + # When multiple is true, this delivery and all prior unacknowledged deliveries # on the same channel will be acknowledged. This is useful for batch processing # of deliveries # # Default:false multiple_ack: false - # When multiple is true, this delivery and all prior unacknowledged deliveries - # on the same channel will be acknowledged. This is useful for batch processing - # of deliveries + + # Use rabbitmq mechanism to requeue the job on fail # # Default: false requeue_on_fail: false @@ -1045,18 +1053,22 @@ jobs: # # This option is required. driver: beanstalk - # Local configuration section + + # Pipeline priority # - # This option is required to use local section, otherwise (test-local-3) global configuration will be used. + # Default priority: 11 + # Beanstalk internal tube priority # # Default: 1 tube_priority: 1 + # Tube name # # Default: default tube: default-1 + # If no job is available before this timeout has passed, Reserve returns a ConnError recording ErrTimeout. # # Default: 5s @@ -1067,16 +1079,24 @@ jobs: # # This option is required. driver: sqs + + # Pipeline priority + # + # If the job has priority set to 0, it will inherit the pipeline's priority. Default: 10. + priority: 10 + # Number of jobs to prefetch from the SQS. mazon SQS never returns more messages than this value # (however, fewer messages might be returned). Valid values: 1 to 10. # # Default: 10 prefetch: 10 + # The duration (in seconds) that the received messages are hidden from subsequent # retrieve requests after being retrieved by a ReceiveMessage request # # Default: 0 visibility_timeout: 0 + # The duration (in seconds) for which the call waits for a message to arrive # in the queue before returning. If a message is available, the call returns # sooner than WaitTimeSeconds. If no messages are available and the wait time @@ -1084,10 +1104,12 @@ jobs: # # Default: 0 wait_time_seconds: 0 + # Queue name. # # Default: default queue: default + # List of the AWS SQS attributes https://docs.aws.amazon.com/AWSSimpleQueueService/latest/APIReference/API_SetQueueAttributes.html. attributes: DelaySeconds: 0 @@ -1100,6 +1122,52 @@ jobs: tags: test: "tag" + test-local-5: + # Driver name + # + # This option is required + driver: nats + + # Pipeline priority + # + # If the job has priority set to 0, it will inherit the pipeline's priority. Default: 10. + priority: 2 + + # NATS prefetch + # + # Messages to read into the channel + prefetch: 100 + + # NATS subject + # + # Default: default + subject: default + + # NATS stream + # + # Default: default-stream + stream: foo + + # The consumer will only start receiving messages that were created after the consumer was created + # + # Default: false (deliver all messages from the stream beginning) + deliver_new: true + + # Consumer rate-limiter in bytes https://docs.nats.io/jetstream/concepts/consumers#ratelimit + # + # Default: 1000 + rate_limit: 100 + + # Delete the stream when after pipeline stopped + # + # Default: false + delete_stream_on_stop: false + + # Delete message from the stream after successful acknowledge + # + # Default: false + delete_after_ack: false + # list of pipelines to be consumed by the server automatically at the start, keep empty if you want to start consuming manually consume: [ @@ -1108,6 +1176,7 @@ jobs: "test-local-2", "test-local-3", "test-local-4", + "test-local-5", ] grpc: diff --git a/CHANGELOG.md b/CHANGELOG.md index 221a0a6..e35b906 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,22 +1,20 @@ # CHANGELOG -## v2.5.0 (-.10.2021) +## v2.5.0 (20.10.2021) -## 💔 BC: +# 💔 Breaking change: - 🔨 Some drivers now use a new `config` key to handle local configuration. Involved plugins and drivers: -- `plugins`: broadcast, kv -- `drivers`: `memory`, `redis`, `memcached`, boltdb. - -## ATTENTION!!!, this is the configuration BC release, please, update your configuration: +- `plugins`: `broadcast`, `kv` +- `drivers`: `memory`, `redis`, `memcached`, `boltdb`. ### Old style: ```yaml broadcast: - default: - driver: memory - interval: 1 + default: + driver: memory + interval: 1 ``` ### New style: @@ -25,7 +23,7 @@ broadcast: broadcast: default: driver: memory - config: {} <--------------- NEW + config: {} <--------------- NEW ``` ```yaml @@ -39,8 +37,8 @@ kv: memcached-rr: driver: memcached config: <--------------- NEW - addr: - - "127.0.0.1:11211" + addr: + - "127.0.0.1:11211" broadcast: default: @@ -104,20 +102,20 @@ broadcast: ] ``` -- ✏️ Add a new option to the `log` plugin to configure the line ending. By default, used `\n`. +- ✏️ Add a new option to the `logs` plugin to configure the line ending. By default, used `\n`. **New option**: ```yaml # Logs plugin settings logs: - (....) - # Line ending - # - # Default: "\n". - line_ending: "\n" + (....) + # Line ending + # + # Default: "\n". + line_ending: "\n" ``` -- ✏️ [Access log support](https://github.com/spiral/roadrunner-plugins/issues/34) at the `Info` log level. +- ✏️ HTTP [Access log support](https://github.com/spiral/roadrunner-plugins/issues/34) at the `Info` log level. ```yaml http: address: 127.0.0.1:55555 @@ -132,7 +130,7 @@ http: destroy_timeout: 60s ``` - ✏️ HTTP middleware to handle `X-Sendfile` [header](https://github.com/spiral/roadrunner-plugins/issues/9). - Middleware reads the file in 10mb chunks. If the file size is smaller than 10mb, the middleware fits the buffer to the file size. + Middleware reads the file in 10MB chunks. So, for example for the 5Gb file, only 10MB of RSS will be used. If the file size is smaller than 10MB, the middleware fits the buffer to the file size. ```yaml http: address: 127.0.0.1:44444 @@ -146,7 +144,7 @@ http: destroy_timeout: 60s ``` -- ✏️ Service plugin now supports env variables passing to the script/executable/binary/any: +- ✏️ Service plugin now supports env variables passing to the script/executable/binary/any like in the `server` plugin: ```yaml service: some_service_1: @@ -196,28 +194,29 @@ jobs: consume: [ "test-1" ] ``` -- Driver uses NATS JetStream API and not compatible with non-js API. +- Driver uses NATS JetStream API and is not compatible with non-js API. - ✏️ Response API for the NATS, RabbitMQ, SQS and Beanstalk drivers. This means, that you'll be able to respond to a specified in the response queue. Limitations: - - To send a response to the queue maintained by the RR, you should send it as a `Job` type. There is no limitation for the other queues (tubes, subjects) responses. + - To send a response to the queue maintained by the RR, you should send it as a `Job` type. There are no limitations for the responses into the other queues (tubes, subjects). - Driver uses the same endpoint (address) to send the response as specified in the configuration. ## 🩹 Fixes: - 🐛 Fix: local and global configuration parsing. -- 🐛 Fix: bug with the `boltdb-jobs` connection left open after RPC close command. +- 🐛 Fix: `boltdb-jobs` connection left open after RPC close command. - 🐛 Fix: close `beanstalk` connection and release associated resources after pipeline stopped. - 🐛 Fix: grpc plugin fails to handle requests after calling `reset`. +- 🐛 Fix: superfluous response.WriteHeader call when connection is broken. ## 📦 Packages: - 📦 roadrunner `v2.5.0` - 📦 roadrunner-plugins `v2.5.0` - 📦 roadrunner-temporal `v1.0.10` -- 📦 endure `v1.0.5` -- 📦 goridge `v3.2.2` +- 📦 endure `v1.0.6` +- 📦 goridge `v3.2.3` ## v2.4.1 (13.09.2021) diff --git a/go.mod b/go.mod index 10e3c40..94ecdf2 100644 --- a/go.mod +++ b/go.mod @@ -15,12 +15,12 @@ require ( github.com/spiral/endure v1.0.6 github.com/spiral/errors v1.0.12 github.com/spiral/goridge/v3 v3.2.3 - github.com/spiral/roadrunner-plugins/v2 v2.5.0-rc.2 - github.com/spiral/roadrunner/v2 v2.5.0-rc.2 + github.com/spiral/roadrunner-plugins/v2 v2.5.0 + github.com/spiral/roadrunner/v2 v2.5.0 // --------------------- github.com/stretchr/testify v1.7.0 // SPIRAL -------------- - github.com/temporalio/roadrunner-temporal v1.0.10-rc.2 + github.com/temporalio/roadrunner-temporal v1.0.10 // --------------------- github.com/vbauerster/mpb/v5 v5.4.0 ) diff --git a/go.sum b/go.sum index def2866..e8e3aca 100644 --- a/go.sum +++ b/go.sum @@ -104,8 +104,6 @@ github.com/bradfitz/gomemcache v0.0.0-20190913173617-a41fca850d0b h1:L/QXpzIa3pO github.com/bradfitz/gomemcache v0.0.0-20190913173617-a41fca850d0b/go.mod h1:H0wQNHz2YrLsuXOZozoeDmnHXkNCRmMW0gwFWDfEZDA= github.com/buger/goterm v1.0.1 h1:kSgw3jcjYUzC0Uh/eG8ULjccuz353solup27lUH8Zug= github.com/buger/goterm v1.0.1/go.mod h1:HiFWV3xnkolgrBV3mY8m0X0Pumt4zg4QhbdOzQtB8tE= -github.com/buger/goterm v1.0.3 h1:7V/HeAQHrzPk/U4BvyH2g9u+xbUW9nr4yRPyG59W4fM= -github.com/buger/goterm v1.0.3/go.mod h1:HiFWV3xnkolgrBV3mY8m0X0Pumt4zg4QhbdOzQtB8tE= github.com/caddyserver/certmagic v0.15.1 h1:OAS245AZWQ1n2BD2gSBJPnKu3COTi2HNKj/6Td8aUQg= github.com/caddyserver/certmagic v0.15.1/go.mod h1:/0VQ5og2Jxa5yBQ8eT80wWS7fi/DgNy1uXeXRUJ1Wj0= github.com/cenkalti/backoff/v4 v4.1.1 h1:G2HAfAmvm/GcKan2oOQpBXOd2tT2G57ZnZGWa1PxPBQ= @@ -517,10 +515,10 @@ github.com/spiral/errors v1.0.12 h1:38Waf8ZL/Xvxg4HTYGmrUbvi7TCHivmuatNQZlBhQ8s= github.com/spiral/errors v1.0.12/go.mod h1:j5UReqxZxfkwXkI9mFY87VhEXcXmSg7kAk5Sswy1eEA= github.com/spiral/goridge/v3 v3.2.3 h1:iNz6aD/c00hC50wo+qT8uP5ZZ3VdCAERXUtNiyDE3Yo= github.com/spiral/goridge/v3 v3.2.3/go.mod h1:DA4Ekw9qVcTvVouUNJgxESXURBHZ2SfkliCEIpEl9lA= -github.com/spiral/roadrunner-plugins/v2 v2.5.0-rc.2 h1:vD8z4UjssSuUlrX4VLYmAyksBZ5UcH7qZLU8oG3ByvA= -github.com/spiral/roadrunner-plugins/v2 v2.5.0-rc.2/go.mod h1:ygTpjNjZWncTtqkQEcl2TpfUfDiuegQo48HMxDSftbs= -github.com/spiral/roadrunner/v2 v2.5.0-rc.2 h1:/lxhagFVyB2Q1qYoOMkbsimVuVokf+7uEBme+mfFWPs= -github.com/spiral/roadrunner/v2 v2.5.0-rc.2/go.mod h1:ZjmyfOy5eWRWJwb1yxQAFFhufw1bBYtbxq8F8yqZbHI= +github.com/spiral/roadrunner-plugins/v2 v2.5.0 h1:Jgeu0dhlsUUlYl2KoTjRH8f+y7TaJiOyvzDuOxR0RVo= +github.com/spiral/roadrunner-plugins/v2 v2.5.0/go.mod h1:ngs+cj96654/cmIHS3c6JWliVjehrv7bkUSmNymXehU= +github.com/spiral/roadrunner/v2 v2.5.0 h1:SyqLdExFdX9HFGaiV0qeneaZTJxz9oM9D6qwu0Co1j0= +github.com/spiral/roadrunner/v2 v2.5.0/go.mod h1:ZjmyfOy5eWRWJwb1yxQAFFhufw1bBYtbxq8F8yqZbHI= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/objx v0.3.0 h1:NGXK3lHquSN08v5vWalVI/L8XU9hdzE/G6xsrze47As= @@ -534,8 +532,8 @@ github.com/stretchr/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5Cc github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/subosito/gotenv v1.2.0 h1:Slr1R9HxAlEKefgq5jn9U+DnETlIUa6HfgEzj0g5d7s= github.com/subosito/gotenv v1.2.0/go.mod h1:N0PQaV/YGNqwC0u51sEeR/aUtSLEXKX9iv69rRypqCw= -github.com/temporalio/roadrunner-temporal v1.0.10-rc.2 h1:R0w8djAvgjHnyv+iz0saboXqsymO2d4qx9D3556L37I= -github.com/temporalio/roadrunner-temporal v1.0.10-rc.2/go.mod h1:Sct9xjbyLJGMg7a0t//EBvCzVvrZfC8EorErRo9LVZ0= +github.com/temporalio/roadrunner-temporal v1.0.10 h1:2jNTwZOX44y8gZO8iDloI4mdPhJAXLPNcpd14uvTmGU= +github.com/temporalio/roadrunner-temporal v1.0.10/go.mod h1:IQ4i66hRf1xo9JGMyOhM9Hgglahi7yeE89KhMdIUHKw= github.com/tklauser/go-sysconf v0.3.9 h1:JeUVdAOWhhxVcU6Eqr/ATFHgXk/mmiItdKeJPev3vTo= github.com/tklauser/go-sysconf v0.3.9/go.mod h1:11DU/5sG7UexIrp/O6g35hrWzu0JxlwQ3LSFUzyeuhs= github.com/tklauser/numcpus v0.3.0 h1:ILuRUQBtssgnxw0XXIjKUC56fgnOrFoQQ/4+DeU2biQ=