diff options
author | Valery Piashchynski <[email protected]> | 2023-01-15 15:26:54 +0100 |
---|---|---|
committer | Valery Piashchynski <[email protected]> | 2023-01-15 15:26:54 +0100 |
commit | ff765952d7718fdb13f4cdaca8fbb7199c41f088 (patch) | |
tree | 28d0de53d19f15e2148ceda9b00b0cf3e4c53d47 | |
parent | e5a118316453cd956aa6f2153c8b37e9b5354ba2 (diff) | |
parent | bde8b5b574f65df90238f7e0416407280d9369b9 (diff) |
Merge remote-tracking branch 'origin/master' into feature/endure-v2
# Conflicts:
# container/plugins.go
# go.mod
# go.sum
-rw-r--r-- | .rr.yaml | 41 | ||||
-rw-r--r-- | CHANGELOG.md | 20 | ||||
-rw-r--r-- | README.md | 10 | ||||
-rw-r--r-- | download-latest.sh | 194 | ||||
-rw-r--r-- | internal/cli/root.go | 2 | ||||
-rw-r--r-- | schemas/config/2.0.schema.json | 36 |
6 files changed, 255 insertions, 48 deletions
@@ -426,18 +426,18 @@ kv: sentinel_password: "" route_by_latency: false route_randomly: false - dial_timeout: 0 # accepted values [1s, 5m, 3h] + dial_timeout: 0s # 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] + min_retry_backoff: 0s # accepted values [1s, 5m, 3h] + max_retry_backoff: 0s # 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] + max_conn_age: 0s # accepted values [1s, 5m, 3h] + read_timeout: 0s # accepted values [1s, 5m, 3h] + write_timeout: 0s # accepted values [1s, 5m, 3h] + pool_timeout: 0s # accepted values [1s, 5m, 3h] + idle_timeout: 0s # accepted values [1s, 5m, 3h] + idle_check_freq: 0s # accepted values [1s, 5m, 3h] read_only: false # User defined name of the section @@ -459,6 +459,7 @@ kv: # Service plugin settings service: + # User defined service name # # Default: none, required @@ -483,7 +484,7 @@ service: # Allowed time before stop. # # Default: 0 (infinity), can be 1s, 2m, 2h (seconds, minutes, hours) - exec_timeout: 0 + exec_timeout: 0s # Show the name of the service in logs (e.g. service.some_service_1) # @@ -530,7 +531,7 @@ service: # Allowed time before stop. # # Default: 0 (infinity), can be 1s, 2m, 2h (seconds, minutes, hours) - exec_timeout: 0 + exec_timeout: 0s # Remain process after exit. In other words, restart process after exit with any exit code. # @@ -1004,18 +1005,18 @@ redis: sentinel_password: "" route_by_latency: false route_randomly: false - dial_timeout: 0 # accepted values [1s, 5m, 3h] + dial_timeout: 0s # 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] + min_retry_backoff: 0s # accepted values [1s, 5m, 3h] + max_retry_backoff: 0s # 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] + max_conn_age: 0s # accepted values [1s, 5m, 3h] + read_timeout: 0s # accepted values [1s, 5m, 3h] + write_timeout: 0s # accepted values [1s, 5m, 3h] + pool_timeout: 0s # accepted values [1s, 5m, 3h] + idle_timeout: 0s # accepted values [1s, 5m, 3h] + idle_check_freq: 0s # accepted values [1s, 5m, 3h] read_only: false # Application metrics in Prometheus format (docs: https://roadrunner.dev/docs/plugins-metrics/2.x/en). Drop this section diff --git a/CHANGELOG.md b/CHANGELOG.md index 028a79ae..07dee1b8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,26 @@ ###### tags: `roadrunner` `v2.12.2` +## v2.12.2 (12.01.2023) + +## <center> ๐ v2.12.2 ๐ </center> + +## <center>๐ New: <center> + +- โ๏ธ **AMQP plugin:** Custom headers in AMQP driver, [FR](https://github.com/roadrunner-server/roadrunner/issues/1388), (thanks @ykweb) + + + ### <center>๐ฉน Fixes:</center> + +- ๐ **Velox**: Unable to build RoadRunner with custom velox configuration, [BUG](https://github.com/roadrunner-server/roadrunner/issues/1400), (thanks @mprokocki) +- ๐ **RR**: JSON Schema - wrong type for service `exec_timeout` option, [BUG](https://github.com/roadrunner-server/roadrunner/issues/1410), (thanks @Chi-teck) +- ๐ **RR**: Fix the description of the `--silent` flag, [PR](https://github.com/roadrunner-server/roadrunner/pull/1401), (thanks @maximal) + + +--- + +###### tags: `roadrunner` `v2.12.2` + ## <center>๐ v2.12.2-alpha.1 ๐<center> ## <center>๐ New: <center> @@ -15,8 +15,7 @@ <a href="https://codecov.io/gh/roadrunner-server/rr-e2e-tests/"><img src="https://codecov.io/gh/roadrunner-server/rr-e2e-tests/branch/master/graph/badge.svg"></a> <a href="https://github.com/roadrunner-server/rr-e2e-tests/actions"><img src="https://github.com/roadrunner-server/rr-e2e-tests/workflows/linux_on_push/badge.svg" alt=""></a> <a href="https://github.com/roadrunner-server/rr-e2e-tests/actions"><img src="https://github.com/roadrunner-server/rr-e2e-tests/workflows/Linters/badge.svg" alt=""></a> - <a href="https://goreportcard.com/report/github.com/roadrunner-server/roadrunner"><img src="https://goreportcard.com/badge/github.com/roadrunner-server/roadrunner"></a> - <a href="https://lgtm.com/projects/g/roadrunner-server/roadrunner/alerts/"><img alt="Total alerts" src="https://img.shields.io/lgtm/alerts/g/roadrunner-server/roadrunner.svg?logo=lgtm&logoWidth=18"/></a> + <a href="https://goreportcard.com/report/github.com/roadrunner-server/roadrunner/v2"><img src="https://goreportcard.com/badge/github.com/roadrunner-server/roadrunner/v2"></a> <a href="https://discord.gg/TFeEmCs"><img src="https://img.shields.io/badge/discord-chat-magenta.svg"></a> <a href="https://packagist.org/packages/spiral/roadrunner"><img src="https://img.shields.io/packagist/dd/spiral/roadrunner?style=flat-square"></a> <img alt="All releases" src="https://img.shields.io/github/downloads/roadrunner-server/roadrunner/total"> @@ -84,7 +83,7 @@ COPY --from=roadrunner /usr/bin/rr /usr/local/bin/rr # USE THE RR ``` -- CLI +- Composer ```bash $ composer require spiral/roadrunner:v2.0 nyholm/psr7 @@ -97,6 +96,11 @@ $ wget https://github.com/roadrunner-server/roadrunner/releases/download/v2.X.X/ $ sudo dpkg -i roadrunner-2.X.X-linux-amd64.deb ``` +- Download the latest release (WSL2/Linux/macOS): +```bash +curl --proto '=https' --tlsv1.2 -sSf https://raw.githubusercontent.com/roadrunner-server/roadrunner/master/download-latest.sh | sh +``` + Configuration can be located in `.rr.yaml` file ([full sample](https://github.com/roadrunner-server/roadrunner/blob/master/.rr.yaml)): diff --git a/download-latest.sh b/download-latest.sh new file mode 100644 index 00000000..dc0b79de --- /dev/null +++ b/download-latest.sh @@ -0,0 +1,194 @@ +#!/bin/sh + +# This script can optionally use a GitHub token to increase your request limit (for example, if using this script in a CI). +# To use a GitHub token, pass it through the GITHUB_PAT environment variable. + +# GLOBALS + +# Colors +RED='\033[31m' +GREEN='\033[32m' +DEFAULT='\033[0m' + +# Project name +PNAME='roadrunner' + +# GitHub API address +GITHUB_API='https://api.github.com/repos/roadrunner-server/roadrunner/releases' +# GitHub Release address +GITHUB_REL='https://github.com/roadrunner-server/roadrunner/releases/download' + +# FUNCTIONS + +# Gets the version of the latest stable version of RoadRunner by setting the $latest variable. +# Returns 0 in case of success, 1 otherwise. +get_latest() { + # temp_file is needed because the grep would start before the download is over + temp_file=$(mktemp -q /tmp/$PNAME.XXXXXXXXX) + latest_release="$GITHUB_API/latest" + + if ! temp_file=$(mktemp -q /tmp/$PNAME.XXXXXXXXX); then + echo "$0: Can't create temp file." + fetch_release_failure_usage + exit 1 + fi + + if [ -z "$GITHUB_PAT" ]; then + curl -s "$latest_release" >"$temp_file" || return 1 + else + curl -H "Authorization: token $GITHUB_PAT" -s "$latest_release" >"$temp_file" || return 1 + fi + + latest="$(grep <"$temp_file" '"tag_name":' | cut -d ':' -f2 | tr -d '"' | tr -d ',' | tr -d ' ' | tr -d 'v')" + latestV="$(grep <"$temp_file" '"tag_name":' | cut -d ':' -f2 | tr -d '"' | tr -d ',' | tr -d ' ')" + + rm -f "$temp_file" + return 0 +} + +# 0 -> not alpine +# 1 -> alpine +isAlpine() { + # shellcheck disable=SC2143 + if [ "$(grep <"/etc/os-release" "NAME=" | grep -ic "Alpine")" ]; then + return 1 + fi + + return 0 +} + +# Gets the OS by setting the $os variable. +# Returns 0 in case of success, 1 otherwise. +get_os() { + os_name=$(uname -s) + case "$os_name" in + # --- + 'Darwin') + os='darwin' + ;; + + # --- + 'Linux') + os='linux' + if isAlpine; then + os="unknown-musl" + fi + ;; + + # --- + 'MINGW'*) + os='windows' + ;; + + # --- + *) + return 1 + ;; + esac + return 0 +} + +# Gets the architecture by setting the $arch variable. +# Returns 0 in case of success, 1 otherwise. +get_arch() { + architecture=$(uname -m) + + # case 1 + case "$architecture" in + 'x86_64' | 'amd64') + arch='amd64' + ;; + + # case 2 + 'arm64') + arch='arm64' + ;; + + # all other + *) + return 1 + ;; + esac + + return 0 +} + +get_compress() { + os_name=$(uname -s) + case "$os_name" in + 'Darwin') + compress='tar.gz' + ;; + 'Linux') + compress='tar.gz' + if isAlpine; then + compress="zip" + fi + ;; + 'MINGW'*) + compress='zip' + ;; + *) + return 1 + ;; + esac + return 0 +} + +not_available_failure_usage() { + printf "$RED%s\n$DEFAULT" 'ERROR: RoadRunner binary is not available for your OS distribution or your architecture yet.' + echo '' + echo 'However, you can easily compile the binary from the source files.' + echo 'Follow the steps at the page ("Source" tab): TODO' +} + +fetch_release_failure_usage() { + echo '' + printf "$RED%s\n$DEFAULT" 'ERROR: Impossible to get the latest stable version of RoadRunner.' + echo 'Please let us know about this issue: https://github.com/roadrunner-server/roadrunner/issues/new/choose' + echo '' + echo 'In the meantime, you can manually download the appropriate binary from the GitHub release assets here: https://github.com/roadrunner-server/roadrunner/releases/latest' +} + +fill_release_variables() { + # Fill $latest variable. + if ! get_latest; then + fetch_release_failure_usage + exit 1 + fi + if [ "$latest" = '' ]; then + fetch_release_failure_usage + exit 1 + fi + # Fill $os variable. + if ! get_os; then + not_available_failure_usage + exit 1 + fi + # Fill $arch variable. + if ! get_arch; then + not_available_failure_usage + exit 1 + fi + + # Fill $compress variable + if ! get_compress; then + not_available_failure_usage + exit 1 + fi +} + +download_binary() { + fill_release_variables + echo "Downloading RoadRunner binary $latest for $os, architecture $arch..." + release_file="$PNAME-$latest-$os-$arch.$compress" + + if ! curl --fail -OL "$GITHUB_REL/$latestV/$release_file"; then + fetch_release_failure_usage + exit 1 + fi + + printf "$GREEN%s\n$DEFAULT" "RoadRunner $latest archive successfully downloaded as $release_file" +} + +download_binary diff --git a/internal/cli/root.go b/internal/cli/root.go index 293e10b6..4783ae87 100644 --- a/internal/cli/root.go +++ b/internal/cli/root.go @@ -122,7 +122,7 @@ func NewCommand(cmdName string) *cobra.Command { //nolint:funlen,gocognit f.StringVarP(&workDir, "WorkDir", "w", "", "working directory") f.StringVarP(&dotenv, "dotenv", "", "", fmt.Sprintf("dotenv file [$%s]", envDotenv)) f.BoolVarP(&debug, "debug", "d", false, "debug mode") - f.BoolVarP(silent, "silent", "s", false, "print startup message") + f.BoolVarP(silent, "silent", "s", false, "do not print startup message") f.StringArrayVarP(override, "override", "o", nil, "override config value (dot.notation=value)") cmd.AddCommand( diff --git a/schemas/config/2.0.schema.json b/schemas/config/2.0.schema.json index 6ad9b1fb..55c46823 100644 --- a/schemas/config/2.0.schema.json +++ b/schemas/config/2.0.schema.json @@ -1476,7 +1476,7 @@ "type": "boolean", "default": false }, - "queue_headers" : { + "queue_headers": { "description": "Queue declare args, associated array (hashmap, key:val)", "$ref": "#/definitions/Hashmap", "default": null @@ -2040,11 +2040,11 @@ "default": 1 }, "min_retry_backoff": { - "type": "integer", + "$ref": "#/definitions/Duration", "default": 0 }, "max_retry_backoff": { - "type": "integer", + "$ref": "#/definitions/Duration", "default": 0 }, "pool_size": { @@ -2110,7 +2110,7 @@ }, "exec_timeout": { "description": "Allowed time before stop", - "type": "integer", + "type": "string", "$ref": "#/definitions/Duration" }, "remain_after_exit": { @@ -2231,26 +2231,14 @@ }, "Duration": { "description": "Time duration", - "anyOf": [ - { - "description": "Duration as a string. Valid time units are 'ns', 'us' (or 'ยตs'), 'ms', 's', 'm', 'h'", - "type": "string", - "examples": [ - "10h", - "1m", - "1h10m10s", - "30s", - "300ms", - "1ยตs", - "1us" - ], - "minLength": 2 - }, - { - "description": "Duration in nanoseconds", - "type": "integer", - "minimum": 0 - } + "type": "string", + "pattern": "^[0-9]+[ms]|[s,h]", + "examples": [ + "10h", + "1m", + "1h", + "30s", + "300ms" ] }, "HostAndPortWithTCP": { |