Browse Source

[php] Update Laravel with RoadRunner v2023.3 (#9025)

* Update Laravel RoadRunner

* Use composer/composer bin
Joan Miquel 1 year ago
parent
commit
4cbacd5f00

+ 5 - 4
frameworks/PHP/laravel/deploy/roadrunner/.rr.yaml

@@ -1,4 +1,7 @@
 # see https://roadrunner.dev/docs/intro-config
 # see https://roadrunner.dev/docs/intro-config
+version: "3"
+#https://github.com/roadrunner-server/roadrunner/blob/master/.rr.yaml
+
 server:
 server:
   command: "php ./vendor/bin/rr-worker start --relay-dsn unix:///usr/local/var/run/rr-rpc.sock"
   command: "php ./vendor/bin/rr-worker start --relay-dsn unix:///usr/local/var/run/rr-rpc.sock"
   relay: "unix:///usr/local/var/run/rr-rpc.sock"
   relay: "unix:///usr/local/var/run/rr-rpc.sock"
@@ -7,7 +10,7 @@ logs:
   level: error
   level: error
 http:
 http:
   address: 0.0.0.0:8080
   address: 0.0.0.0:8080
-  middleware: ["headers", "static", "gzip"]
+  middleware: ["headers"]
   pool:
   pool:
     #max_jobs: 64 # feel free to change this
     #max_jobs: 64 # feel free to change this
     supervisor:
     supervisor:
@@ -15,8 +18,6 @@ http:
   headers:
   headers:
     response:
     response:
       Server: "RoadRunner"
       Server: "RoadRunner"
-  static:
-    dir: "public"
-    forbid: [".php"]
+
 
 
 
 

+ 9 - 10
frameworks/PHP/laravel/laravel-roadrunner.dockerfile

@@ -6,30 +6,29 @@ RUN echo "opcache.enable_cli=1" >> /usr/local/etc/php/conf.d/docker-php-ext-opca
 #RUN echo "opcache.jit=1205" >> /usr/local/etc/php/conf.d/docker-php-ext-opcache.ini
 #RUN echo "opcache.jit=1205" >> /usr/local/etc/php/conf.d/docker-php-ext-opcache.ini
 #RUN echo "opcache.jit_buffer_size=128M" >> /usr/local/etc/php/conf.d/docker-php-ext-opcache.ini
 #RUN echo "opcache.jit_buffer_size=128M" >> /usr/local/etc/php/conf.d/docker-php-ext-opcache.ini
 
 
-ADD ./ /laravel
 WORKDIR /laravel
 WORKDIR /laravel
+COPY --link . .
 
 
 RUN mkdir -p /laravel/bootstrap/cache /laravel/storage/logs /laravel/storage/framework/sessions /laravel/storage/framework/views /laravel/storage/framework/cache
 RUN mkdir -p /laravel/bootstrap/cache /laravel/storage/logs /laravel/storage/framework/sessions /laravel/storage/framework/views /laravel/storage/framework/cache
-RUN chmod -R 777 /laravel
 
 
 RUN apt-get update > /dev/null && \
 RUN apt-get update > /dev/null && \
-    apt-get install -yqq git unzip > /dev/null
-RUN php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');" && php composer-setup.php && php -r "unlink('composer-setup.php');"
-RUN mv composer.phar /usr/local/bin/composer
+    apt-get install -yqq curl unzip > /dev/null
 
 
-COPY deploy/roadrunner/composer.json ./
-COPY deploy/roadrunner/.rr.yaml ./
+COPY --from=composer/composer:latest-bin --link /composer /usr/local/bin/composer
+
+COPY --link deploy/roadrunner/composer.json .
+COPY --link deploy/roadrunner/.rr.yaml .
 
 
 RUN composer install -a --no-dev --quiet
 RUN composer install -a --no-dev --quiet
 RUN php artisan optimize
 RUN php artisan optimize
 
 
 # install roadrunner
 # install roadrunner
-COPY --from=ghcr.io/roadrunner-server/roadrunner:2.12.1 /usr/bin/rr ./rr
+COPY --from=ghcr.io/roadrunner-server/roadrunner:2023.3 --link /usr/bin/rr /usr/local/bin/rr
 
 
 RUN php artisan vendor:publish --provider='Spiral\RoadRunnerLaravel\ServiceProvider' --tag=config
 RUN php artisan vendor:publish --provider='Spiral\RoadRunnerLaravel\ServiceProvider' --tag=config
+RUN rr -v
 
 
 EXPOSE 8080
 EXPOSE 8080
 
 
 # CMD bash
 # CMD bash
-CMD ./rr serve -c ./.rr.yaml
-
+CMD rr serve -c .rr.yaml