运行Laravel Horizon作为后台服务(Run Laravel Horizon as a background service)

编程入门 行业动态 更新时间:2024-10-11 07:32:42
运行Laravel Horizon作为后台服务(Run Laravel Horizon as a background service)

我的问题是,运行Laravel Horizo​​n工作人员的最佳简单的方法是什么?

我的技术堆栈

Laravel 5.5 地平线 Redis队列 Centos下

我已经阅读了文档https://laravel.com/docs/5.5/horizo​​n

如何设置以上链接中提到的以下主管 主管配置

[program:horizon] process_name=%(program_name)s command=php /home/forge/app.com/artisan horizon autostart=true autorestart=true user=forge redirect_stderr=true stdout_logfile=/home/forge/app.com/horizon.log

注意:我有自己的自定义构建服务器和php 7.1,后来我安装了Horizo​​n来运行我的作业并维护队列。

有关如何运行Workers的任何建议或我应该在哪里配置Supervisor配置

My question is what is the best and simple way to run the Laravel Horizon based job workers?

My Tech Stack

Laravel 5.5 Horizon Redis Queues Centos

I have gone through the document https://laravel.com/docs/5.5/horizon

How to setup following supervisor as mentioned on the link above Supervisor Configuration

[program:horizon] process_name=%(program_name)s command=php /home/forge/app.com/artisan horizon autostart=true autorestart=true user=forge redirect_stderr=true stdout_logfile=/home/forge/app.com/horizon.log

Note: I have my own custom build server with php 7.1 and I later installed Horizon to run my Jobs and maintain the queues.

Any suggestion regarding how to run the Workers or where should I configure above Supervisor Configuration?

最满意答案

确保安装了主管:

对于debian / ubuntu:

apt install supervisor

CentOS的:

easy_install supervisor

要么

yum install supervisor

你也可以这样做:

systemctl enable supervisord

确保主管在启动时运行


现在在/etc/supervisor/conf.d/创建一个名为/etc/supervisor/conf.d/的新文件,并添加上面的配置。

现在做:

sudo supervisorctl reread

重读配置

sudo supervisorctl update

要重新加载配置并重新启动该过程

sudo supervisorctl start all

要么

sudo supervisorctl start horizon

开始视野

Make sure you have supervisor installed:

For debian/ubuntu:

apt install supervisor

centos:

easy_install supervisor

or

yum install supervisor

You can also do:

systemctl enable supervisord

To make sure supervisor runs at startup


Now create a new file in /etc/supervisor/conf.d/ named horizon.conf and add the above configuration.

Now do:

sudo supervisorctl reread

To reread the configs

sudo supervisorctl update

To reload the configs and restart the process

sudo supervisorctl start all

or

sudo supervisorctl start horizon

To start horizon

更多推荐

本文发布于:2023-08-04 18:57:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1419177.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:后台   Horizon   Laravel   service   background

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!