laravel / horizon

Dashboard and code-driven configuration for Laravel queues.
https://laravel.com/docs/horizon
MIT License
3.86k stars 656 forks source link

Windows installation #170

Closed nadinyamaui closed 4 years ago

nadinyamaui commented 7 years ago

This is not really an issue the problem is the following

Many people like me develop their apps in windows platforms and the production servers runs in Forge with Ubuntu.

Since horizon requires PHP extensions that are not compatible with windows developers might get composer issues saying that ext-pcntl or ext-posix are missing so people are not able to install the package and they probably wont use horizon in their local development only on production environments

So I think we should mention this in the Laravel docs: That Horizon is not compatible with windows, however users can install it by running composer install with the option --ignore-platform-reqs

PS: I created a PR on Laravel docs for this (https://github.com/laravel/docs/pull/3686)

jeffreyvanhees commented 6 years ago

We run multiple workers on Windows machines (because of Adobe After Effect) and we need Horizon for monitoring our workers. Is there no other solution for running this on Windows?

And yes, I agree this should be mentioned in the Laravel docs.

nadinyamaui commented 6 years ago

In my tests there is no way to run horizon on windows there is a way to compile one of the dependencies but that didn't work for me.


From: Jeffrey van Hees notifications@github.com Sent: Friday, November 24, 2017 9:54 AM To: laravel/horizon Cc: Nadin arturo; Author Subject: Re: [laravel/horizon] Windows installation (#170)

We run multiple workers on Windows machines (because of Adobe After Effect) and we need Horizon for monitoring our workers. Is there no other solution for running this on Windows?

And yes, I agree this should be mentioned in the Laravel docs.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHubhttps://github.com/laravel/horizon/issues/170#issuecomment-346833668, or mute the threadhttps://github.com/notifications/unsubscribe-auth/AFTcs0klbu9PRMSz980UrGjJgVmKjfgpks5s5sqMgaJpZM4PpclK.

driesvints commented 6 years ago

Hey everyone. We'd be open to deprecate usage of pcntl and posix and make Horizon work on Windows if anyone can ever send in a PR to the next major version which would solve this in a clean way.

tcope25 commented 5 years ago

@driesvints any update on getting horizon to work on windows?

driesvints commented 5 years ago

@tcope25 nope but we're open to pull requests.

SavageDan commented 5 years ago

Why not use exec("kill -9 $pid"), which is available natively and can be switched out with the relevant windows kill command, depending on context? This would come with the added benefit that process workers need to be owned by the www user. Or am I missing something?

driesvints commented 4 years ago

At the moment we're not looking to implement Windows support for Horizon ourselves but we're open to PRs which implement this in a clean way. Although I have to say that the internals would need to be overhauled by a lot in order to do so.

woganmay commented 3 years ago

I've just run into this problem myself now, and I didn't want to open a new issue (so that the above context doesn't get lost).

I mainly use Windows as my dev environment too, and I've just spent some time looking at the Horizon code. I get why it would be a big overhaul to get it to run in Windows, but it doesn't seem impossible:

PHP has a built-in process control library that should work on Windows, and make it possible to spawn/kill worker threads from a supervisor: https://www.php.net/manual/en/book.exec.php

The pcntl functions have to do with listening for and processing signals, but it should be possible to listen for the Windows equivalent of SIGKILL using https://www.php.net/manual/en/function.sapi-windows-set-ctrl-handler.php

For the others (pause, continue, etc), a more universal solution might be to use a long-running PHP process bound to a socket (ReactPHP style) and have the artisan commands interact with that. Or if redis is a hard requirement, use that to manage process signals.

I may well end up going down this path to get it to work, but before I do, I wanted to check if I wouldn't be duplicating any effort.

taylorotwell commented 3 years ago

I have no plans to support Windows on this library and recommend using WSL2 when developing on Windows.

woganmay commented 3 years ago

So this is definitely possible with PHP 7.4: https://vimeo.com/480989385 - I'm about halfway to a complete implementation. Most of it just involves checking against PHP_OS_FAMILY (since PHP 7.3) and running slightly different commands. The signals that use pcntl can also be implemented as a really tiny shared memory block. I'll probably finish this up by next week.

If there's no plans to maintain this as an official part of Horizon, I have no problems maintaining my own fork - this solves a big problem for me :)

driesvints commented 3 years ago

@woganmay definitely feel free to publish a fork 👍

xwiz commented 3 years ago

Any updates @woganmay ?

dorshiff commented 2 years ago

So this is definitely possible with PHP 7.4: https://vimeo.com/480989385 - I'm about halfway to a complete implementation. Most of it just involves checking against PHP_OS_FAMILY (since PHP 7.3) and running slightly different commands. The signals that use pcntl can also be implemented as a really tiny shared memory block. I'll probably finish this up by next week.

If there's no plans to maintain this as an official part of Horizon, I have no problems maintaining my own fork - this solves a big problem for me :)

@woganmay Any update on that? did you fork a version that will work on Windows?

woganmay commented 2 years ago

Hey @dorshiff - we ended up moving to Laravel Sail internally, which removed the need for running Horizon on Windows itself. It doesn't look like I published any of the code I wrote either, and this was almost 18 months ago!

Is this something you're blocked on?

dorshiff commented 2 years ago

Thanks for the reply

Actually I used WSL as Tylor recommended in one of the comments and it worked.

On 11 Mar 2022, at 0:28, Wogan May @.***> wrote:

 Hey @dorshiff - we ended up moving to Laravel Sail internally, which removed the need for running Horizon on Windows itself. It doesn't look like I published any of the code I wrote either, and this was almost 18 months ago!

Is this something you're blocked on?

— Reply to this email directly, view it on GitHub, or unsubscribe. Triage notifications on the go with GitHub Mobile for iOS or Android. You are receiving this because you were mentioned.

nikspyratos commented 5 months ago

Hey @woganmay, any chance you still have that code at all?

While Sail and Homestead are options, in the age of Herd, something like this could be very useful for making Horizon viable for Herd & Windows based devs. Might be a bit above my head but happy to take a look at reviving it?

EDIT: Wogan DM'd me some of the idea, will look at perhaps reviving the idea for Windows Herd users...

studioycm commented 1 month ago

so if using Herd Pro on windows will not help, how can i get horizon whill developing on windows and still have the Herd Pro benifits? I'm not familiar with a way to use WSL and still have a nice Herd Pro cgi to run everything

nikspyratos commented 1 month ago

so if using Herd Pro on windows will not help, how can i get horizon whill developing on windows and still have the Herd Pro benifits? I'm not familiar with a way to use WSL and still have a nice Herd Pro cgi to run everything

You can't, or at least the solution defeats the purpose of Herd: Just use a Docker container for PHP (in WSL or not) or use PHP in WSL directly.

But if you're doing that, you can also just go ahead and install most of Herd's other tooling as well on your containerised setup or WSL and just not use Herd.

Or just don't use Horizon on local at all. You basically have to decide if not using Horizon on local is a deal breaker for you.

In the end I also just ditched Windows anyway instead of trying to develop a workaround.

PS. Horizon isn't the only package affected by Windows-related PHP issues. Pail won't work, and any third party package using Prompts without a non-Prompts fallback won't work either.