Managing Laravel Queue workers in Acorn

I’ve recently implemented Laravel Queue processing in Acorn and have questions for others using it.

  1. Queues need to be restarted when there are code changes to Queue Jobs. Laravel supports this command: php artisan queue:restart, but there is no Acorn equivalent. Do we just use the native artisan command from the vendor directory instead? It would be great to add this to our deployment process, and it would be great if queue:restart was added to the list of supported acorn commands.
  2. In production environments, to keep the queue worker running permanently, Laravel advises using Supervisor like this: command=php /home/forge/app.com/artisan queue:work --sleep=3 --tries=3 --max-time=3600 Is there an Acorn equivalent for this? I’m not finding the correct path, which I assume is in the vendor directory somewhere.
  3. Is there any functional difference between wp acorn queue:work and php artisan queue:work? Or are the WP-CLI acorn commands just a convenience wrapper for php artisan commands?

Great questions!

1. queue:restart

You’re right: this command (along with several other queue commands) were missing from Acorn. Just opened a PR to register all the missing queue console commands: 🔧 Register missing queue console commands by retlehs · Pull Request #502 · roots/acorn · GitHub

Now wp acorn queue:restart will be available for your deployment process

2. Supervisor configuration

The Acorn equivalent for Supervisor would be:

command=wp acorn queue:work --sleep=3 --tries=3 --max-time=3600

Or using the bin/acorn binary directly:

command=/path/to/your/theme/vendor/bin/acorn queue:work --sleep=3 --tries=3 --max-time=3600

3. Functional difference between wp acorn and php artisan

There is no functional difference. Both wp acorn and bin/acorn use the exact same Acorn Console Kernel. They’re the same application booted through a different entry point. The only difference is how input is handled (wp acorn receives args from WP-CLI, bin/acorn reads directly from the command line). They produce identical results.

Note: php artisan itself won’t work in an Acorn context since there’s no artisan binary, so use wp acorn or bin/acorn instead.

Docs updates ready once the Acorn PR has been merged and tagged: https://github.com/roots/docs/pull/564

Thanks @ben. This will help tremendously to run this reliably in production.

That explains why I couldn’t find the artisan binary. It’s not there :slight_smile: