laravel / reverb

Laravel Reverb provides a real-time WebSocket communication backend for Laravel applications.
https://reverb.laravel.com
MIT License
1.05k stars 76 forks source link

Linux: Undefined constant SIGINT #99

Closed Lanubya closed 5 months ago

Lanubya commented 5 months ago

Reverb Version

v1.0.0-beta4

Laravel Version

11.0.7

PHP Version

8.2.17

Description

I'm trying to get reverb to run on a Docker image (Debian GNU/Linux 12 (bookworm)). Similar issues (#65, #74) have been created, but the problem seems not to be resolved for this case.

Steps To Reproduce

Dockerfile

FROM php:8.2
RUN apt-get update -y && apt-get install -y openssl zip unzip git
RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer
WORKDIR /app
RUN composer create-project --prefer-dist laravel/laravel:^11.0 .
RUN composer require laravel/reverb:@beta
CMD php artisan reverb:start

docker-compose.yml

version: "3"
services:
    reverb:
        container_name: reverb
        build: .

Results in error:

   Error 

  Undefined constant "Laravel\Reverb\Servers\Reverb\Console\Commands\SIGINT"

  at vendor/laravel/reverb/src/Servers/Reverb/Console/Commands/StartServer.php:152
    148▕      */
    149▕     public function getSubscribedSignals(): array
    150▕     {
    151▕         if (! windows_os()) {
  ➜ 152▕             return [SIGINT, SIGTERM, SIGTSTP];
    153▕         }
    154▕ 
    155▕         $this->handleSignalWindows();
    156▕ 

      +4 vendor frames 

  5   artisan:35
      Illuminate\Foundation\Console\Kernel::handle(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))

grafik

When I run this Dockerfile:

FROM php:8.2
RUN apt-get update -y && apt-get install -y openssl zip unzip git
RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer
WORKDIR /app
RUN composer create-project --prefer-dist laravel/laravel:^11.0 .
RUN composer require laravel/reverb:@beta
RUN chmod u+rw /dev/tty
CMD php artisan reverb:install && php artisan reverb:start

I get this error:

   Symfony\Component\Process\Exception\RuntimeException 

  TTY mode requires /dev/tty to be read/writable.

  at vendor/symfony/process/Process.php:1017
    1013▕             throw new RuntimeException('TTY mode is not supported on Windows platform.');
    1014▕         }
    1015▕ 
    1016▕         if ($tty && !self::isTtySupported()) {
  ➜ 1017▕             throw new RuntimeException('TTY mode requires /dev/tty to be read/writable.');
    1018▕         }
    1019▕ 
    1020▕         $this->tty = $tty;
    1021▕

      +29 vendor frames 

  30  artisan:13
      Illuminate\Foundation\Application::handleCommand(Object(Symfony\Component\Console\Input\ArgvInput))

grafik

driesvints commented 5 months ago

I think you don't have the PCNTL extension installed?

Lanubya commented 5 months ago

After adding the following lines, it worked:

RUN docker-php-ext-install pcntl
RUN docker-php-ext-configure pcntl --enable-pcntl

Thank you!

Is there a way to execute RUN php artisan reverb:install? /dev/tty should be read/writable, but it still doesn't work.

driesvints commented 5 months ago

I can't answer that, sorry.