diff options
-rw-r--r-- | README.md | 19 | ||||
-rw-r--r-- | dev/.rr-docker.yaml | 33 | ||||
-rw-r--r-- | dev/Dockerfile.local | 39 | ||||
-rw-r--r-- | dev/Makefile | 2 | ||||
-rw-r--r-- | dev/README.md | 39 | ||||
-rw-r--r-- | dev/composer.json | 19 | ||||
-rw-r--r-- | dev/docker-compose.yml | 25 | ||||
-rw-r--r-- | dev/psr-worker.php | 28 |
8 files changed, 17 insertions, 187 deletions
@@ -58,13 +58,28 @@ Features: Installation: -------- +> For getting roadrunner binary file you can use our docker image: `spiralscout/roadrunner:2.X.X` (more information about +> image and tags can be found [here](https://hub.docker.com/r/spiralscout/roadrunner/)) or use the GitHub package: `ghcr.io/roadrunner-server/roadrunner:2.7.7` +> + +- Docker: + +```docker +FROM ghcr.io/roadrunner-server/roadrunner:2.7.7 AS roadrunner +FROM php:8.1-cli + +COPY --from=roadrunner /usr/bin/rr /usr/local/bin/rr + +# USE THE RR +``` + +- CLI + ```bash $ composer require roadrunner-server/roadrunner:v2.0 nyholm/psr7 $ ./vendor/bin/rr get-binary ``` -> For getting roadrunner binary file you can use our docker image: `spiralscout/roadrunner:X.X.X` (more information about -> image and tags can be found [here](https://hub.docker.com/r/spiralscout/roadrunner/)) Configuration can be located in `.rr.yaml` file ([full sample](https://github.com/roadrunner-server/roadrunner/blob/master/.rr.yaml)): diff --git a/dev/.rr-docker.yaml b/dev/.rr-docker.yaml deleted file mode 100644 index c84179bf..00000000 --- a/dev/.rr-docker.yaml +++ /dev/null @@ -1,33 +0,0 @@ -rpc: - listen: tcp://0.0.0.0:6001 - -server: - command: "php /etc/psr-worker.php" - - -http: - address: 0.0.0.0:15395 - max_request_size: 1024 - middleware: [ "websockets" ] - uploads: - 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" ] - pool: - num_workers: 1 - -redis: - addrs: - - "redis:6379" - -websockets: - pubsubs: [ "memory" ] - path: "/ws" - -logs: - mode: production - level: error - -endure: - grace_period: 10s - print_graph: false - log_level: panic diff --git a/dev/Dockerfile.local b/dev/Dockerfile.local deleted file mode 100644 index f990b3ee..00000000 --- a/dev/Dockerfile.local +++ /dev/null @@ -1,39 +0,0 @@ -# Image page: <https://hub.docker.com/_/golang> -FROM --platform=${TARGETPLATFORM:-linux/amd64} golang:alpine as builder - -# app version and build date must be passed during image building (version without any prefix). -# e.g.: `docker build --build-arg "APP_VERSION=1.2.3" --build-arg "BUILD_TIME=$(date +%FT%T%z)" .` -ARG APP_VERSION="undefined" -ARG BUILD_TIME="undefined" - -COPY . /src - -# Image page: <https://hub.docker.com/_/alpine> -# https://alpinelinux.org/posts/Alpine-3.13.4-released.html -# Critical issue with 3.13.3 https://nvd.nist.gov/vuln/detail/CVE-2021-28831 -FROM --platform=${TARGETPLATFORM:-linux/amd64} php:latest - -# use same build arguments for image labels -ARG APP_VERSION="undefined" -ARG BUILD_TIME="undefined" - -# copy required files from builder image -COPY --from=builder /src/rr /usr/bin/rr -COPY --from=builder /src/.rr-docker.yaml /etc/rr-docker.yaml -COPY --from=builder /src/composer.json /etc/composer.json -COPY --from=builder /src/psr-worker.php /etc/psr-worker.php - -WORKDIR /etc - -RUN docker-php-ext-install sockets - -RUN apt update -y -RUN apt upgrade -y -RUN apt install git zip unzip -y - -RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer - -RUN composer install - -# use roadrunner binary as image entrypoint -ENTRYPOINT ["/usr/bin/rr"] diff --git a/dev/Makefile b/dev/Makefile deleted file mode 100644 index 71c0ed5b..00000000 --- a/dev/Makefile +++ /dev/null @@ -1,2 +0,0 @@ -build: - CGO_ENABLED=0 go build -trimpath -ldflags "-s" -o rr ../cmd/rr/main.go diff --git a/dev/README.md b/dev/README.md deleted file mode 100644 index 315b2038..00000000 --- a/dev/README.md +++ /dev/null @@ -1,39 +0,0 @@ -# Local testing/development files - -### Usage: -1. Build the RR binary with the following command: `make build`. As the result you'll see a RR binary. -2. If you are testing you own plugin (Go), you may use `replace` directive in the root `go.mod` file, for example: -```go -module github.com/roadrunner-server/roadrunner/v2 - -go 1.17 - -require ( - github.com/buger/goterm v1.0.1 - github.com/dustin/go-humanize v1.0.0 - github.com/fatih/color v1.12.0 - github.com/joho/godotenv v1.3.0 - github.com/kami-zh/go-capturer v0.0.0-20171211120116-e492ea43421d - github.com/mattn/go-runewidth v0.0.13 - github.com/olekukonko/tablewriter v0.0.5 - github.com/spf13/cobra v1.2.1 - // SPIRAL ------------ - github.com/roadrunner-server/endure v1.2.1 - github.com/roadrunner-server/errors v1.1.0 - github.com/spiral/goridge/v3 v3.2.1 - github.com/roadrunner-server/roadrunner/v2 v2.4.0-rc.1 - // --------------------- - github.com/stretchr/testify v1.7.0 - // SPIRAL -------------- - github.com/temporalio/roadrunner-temporal v1.0.9-beta.1 - // --------------------- - github.com/vbauerster/mpb/v5 v5.4.0 -) - -replace github.com/roadrunner-server/roadrunner/v2 => ../roadrunner <----- SAMPLE -``` - -3. Replace sample worker `psr-worker.php` with your application. You can do that by putting all `dev` env into the folder -with your app and replacing lines 21-24 of the `Dockerfile.local` with your app OR by replacing the sample worker. Also, do not forget to update `.rr-docker.yaml`. - -5. Next step is to build docker-compose: `docker-compose up`, that's it. After that, you'll have your app running in local dev env with RR. diff --git a/dev/composer.json b/dev/composer.json deleted file mode 100644 index 50178d1f..00000000 --- a/dev/composer.json +++ /dev/null @@ -1,19 +0,0 @@ -{ - "minimum-stability": "beta", - "prefer-stable": true, - "require": { - "nyholm/psr7": "^1.3", - "spiral/roadrunner": "^2.0", - "spiral/roadrunner-http": "^2.0", - "temporal/sdk": ">=1.0", - "spiral/tokenizer": ">=2.7", - "spiral/roadrunner-metrics": "^2.0" - }, - "autoload": { - "psr-4": { - "Temporal\\Tests\\": "src" - } - }, - "name": "test/test", - "description": "test" -} diff --git a/dev/docker-compose.yml b/dev/docker-compose.yml deleted file mode 100644 index 673f7cd5..00000000 --- a/dev/docker-compose.yml +++ /dev/null @@ -1,25 +0,0 @@ -version: '3.7' - -services: - redis: - image: redis:6 - - roadrunner: - container_name: roadrunner - environment: - - GOGC=100 - ulimits: - nofile: - soft: 65000 - hard: 65000 - mem_limit: 1024 - cpus: 1 - restart: always - build: - context: . - dockerfile: Dockerfile.local - command: "serve -c /etc/rr-docker.yaml -d" - ports: - - "15395:15395" - - "6061:6061" - - "6001:6001" diff --git a/dev/psr-worker.php b/dev/psr-worker.php deleted file mode 100644 index fd8d672f..00000000 --- a/dev/psr-worker.php +++ /dev/null @@ -1,28 +0,0 @@ -<?php -/** - * @var Goridge\RelayInterface $relay - */ -use Spiral\Goridge; -use Spiral\RoadRunner; - -ini_set('display_errors', 'stderr'); -require __DIR__ . "/vendor/autoload.php"; - -$worker = new RoadRunner\Worker(new Goridge\StreamRelay(STDIN, STDOUT)); -$psr7 = new RoadRunner\Http\PSR7Worker( - $worker, - new \Nyholm\Psr7\Factory\Psr17Factory(), - new \Nyholm\Psr7\Factory\Psr17Factory(), - new \Nyholm\Psr7\Factory\Psr17Factory() -); - -while ($req = $psr7->waitRequest()) { - try { - $resp = new \Nyholm\Psr7\Response(); - $resp->getBody()->write("hellllo world!!!!!"); - - $psr7->respond($resp); - } catch (\Throwable $e) { - $psr7->getWorker()->error((string)$e); - } -} |