Skip to content

Commit f26732f

Browse files
authored
[php] Laravel with RoadRunner fixed and updated (#10053)
1 parent 9fca069 commit f26732f

File tree

4 files changed

+39
-70
lines changed

4 files changed

+39
-70
lines changed
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
<?php
2+
3+
return [
4+
'octane' => [
5+
'max_requests' => 10000, // Reload workers after requests
6+
],
7+
];
Lines changed: 22 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,35 @@
1-
# see https://roadrunner.dev/docs/intro-config
1+
# see https://docs.roadrunner.dev/docs/general/config
2+
# https://github.com/roadrunner-server/roadrunner/blob/master/.rr.yaml
3+
24
version: "3"
3-
#https://github.com/roadrunner-server/roadrunner/blob/master/.rr.yaml
45

5-
server:
6-
command: "php ./vendor/bin/rr-worker start --relay-dsn unix:///usr/local/var/run/rr-rpc.sock"
7-
relay: "unix:///usr/local/var/run/rr-rpc.sock"
8-
logs:
9-
mode: production
10-
level: error
116
http:
127
address: 0.0.0.0:8080
13-
middleware: ["headers"]
148
pool:
15-
#max_jobs: 64 # feel free to change this
9+
num_workers: 0
10+
max_jobs: 0
1611
supervisor:
1712
exec_ttl: 60s
1813
headers:
1914
response:
2015
Server: "RoadRunner"
16+
middleware: ["headers"]
17+
18+
server:
19+
command: "php /laravel/vendor/bin/roadrunner-worker"
20+
#command: "php /laravel/vendor/bin/roadrunner-worker start --relay-dsn unix:///usr/local/var/run/rr-rpc.sock"
21+
#relay: "unix:///usr/local/var/run/rr-rpc.sock"
2122

23+
env:
24+
- APP_ENV: production
25+
- APP_BASE_PATH: "/laravel"
26+
- LARAVEL_OCTANE: "1"
2227

28+
rpc:
29+
listen: tcp://127.0.0.1:6001
2330

31+
logs:
32+
mode: production
33+
level: error
34+
output: stdout
35+
#encoding: json

frameworks/PHP/laravel/deploy/roadrunner/composer.json

Lines changed: 0 additions & 45 deletions
This file was deleted.
Lines changed: 10 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
FROM php:8.3-cli
1+
FROM php:8.4-cli
22

33
RUN docker-php-ext-install pdo_mysql pcntl opcache sockets > /dev/null
44

55
RUN echo "opcache.enable_cli=1" >> /usr/local/etc/php/conf.d/docker-php-ext-opcache.ini
6-
#RUN echo "opcache.jit=1205" >> /usr/local/etc/php/conf.d/docker-php-ext-opcache.ini
7-
#RUN echo "opcache.jit_buffer_size=128M" >> /usr/local/etc/php/conf.d/docker-php-ext-opcache.ini
6+
RUN echo "opcache.jit=1205" >> /usr/local/etc/php/conf.d/docker-php-ext-opcache.ini
7+
RUN echo "opcache.jit_buffer_size=128M" >> /usr/local/etc/php/conf.d/docker-php-ext-opcache.ini
88

99
WORKDIR /laravel
1010
COPY --link . .
@@ -18,21 +18,16 @@ RUN mkdir -p bootstrap/cache \
1818
RUN apt-get update > /dev/null && \
1919
apt-get install -yqq curl unzip > /dev/null
2020

21-
COPY --from=composer/composer:latest-bin --link /composer /usr/local/bin/composer
21+
RUN pecl install protobuf > /dev/null && echo "extension=protobuf.so" > /usr/local/etc/php/conf.d/protobuf.ini
2222

23-
COPY --link deploy/roadrunner/composer.json .
24-
COPY --link deploy/roadrunner/.rr.yaml .
23+
COPY --from=composer/composer:latest-bin --link /composer /usr/local/bin/composer
2524

26-
RUN composer install -a --no-dev --quiet
25+
RUN composer require laravel/octane --update-no-dev --no-scripts --quiet
26+
RUN php artisan octane:install --server="roadrunner"
2727
RUN php artisan optimize
2828

29-
# install roadrunner
30-
COPY --from=ghcr.io/roadrunner-server/roadrunner:2023.3 --link /usr/bin/rr /usr/local/bin/rr
31-
32-
RUN php artisan vendor:publish --provider='Spiral\RoadRunnerLaravel\ServiceProvider' --tag=config
33-
RUN rr -v
34-
3529
EXPOSE 8080
3630

37-
# CMD bash
38-
CMD rr serve -c .rr.yaml
31+
# https://artisan.page/12.x/
32+
#ENTRYPOINT ["php", "artisan", "octane:roadrunner", "--host=0.0.0.0", "--port=8080", "--workers=auto", "--max-requests=10000", "--rr-config=/laravel/deploy/roadrunner/.rr.yaml"]
33+
ENTRYPOINT ["/laravel/rr", "serve", "-c", "/laravel/deploy/roadrunner/.rr.yaml"]

0 commit comments

Comments
 (0)