by Devin Yang
(This article was automatically translated.)

Published - 6 years ago ( Updated - 6 years ago )

foreword

Since queue workers are a long-running program, we need a program manager supervisor to monitor whether the process on the Linux system is running continuously. For example, when the queue:work operation fails, the queue:work process can be automatically restarted. Fortunately, D-Laravel has a built-in supervisor, so it can be used without installing it on Mac OS.

When you want to use the queue function on Laravel and Laravle Echo and Events and Broadcasting or Notifications,
You should already be using the supervisor application.

Running supervisor on D-Laravel is quite simple.
You need to update to D-Laravel v1.2.15 to support ./console supervisor start command.

If you use the old version of D-Laravel, you can use Docker official instructions to execute, which will be mentioned in this article.
 

SUPERVISOR trilogy

1. Create a supervisor configuration file to the etc/supervisor folder in D-Laravel
In fact, there is already a sample in it,
So we can simply copy this sample to modify it.
It is assumed that dlaravel is installed in our home directory, so the command is as follows:
cd ~/dlaravel/etc/supervisor
cp laravel-worker.conf.sample laravel-worker.conf
vim laravel-work.conf laravl-work.conf
In the above command setting, I use Laravel's default queue, so I don't specify --quque=.
myproject is the project we want to execute queue:work in D-Laravel's sites folder.

2. Lift the seal
In docker-compose.yml, remove the # comment on the supervisor setting mount in the php service section.
comment out supervisor

3. Execute the super Xiaoqiang in the php container, oh wrong, it is supervisor.
D-Laravel is the environment of docker. Of course, we can use the official instructions to execute the commands in the container.
The syntax executed in the folder of dlaravel is as follows:
docker-compose exec php /etc/init.d/supervisor start

Remember, in the second step above , we removed the comment # , so that the php container can mount the etc/supervisor folder in the dlaravel directory on our host.
And in the first step , we also produced the laravel-work.conf file, so the supervisor in the php container can be started according to our laravel-work.conf settings.

For Linux beginners, it may be difficult to remember such a long command, so a simple bash is provided in the new version of D-Laravel ,
Let us save a few words, we can start or stop supervisor through ./console
./console supervisor start
or
./console supervisor restart

4. Detect whether the program in the container is executed (additional supplement).
We can check whether the supervisor program in the container is executed through ./console top command.
./console top php

./console top php
 

Tags: dlaravel

Devin Yang

Feel free to ask me, if you don't get it.:)

No Comment

Post your comment

Login is required to leave comments

Similar Stories


dlaravel

How to set the external network IP to the Project on D-Laravel?

This video introduces how we assign Public Ip (public IP) to a specific Project in the D-Laravel environment. Whether it is the setting of the external production environment or the demo of your own project on the intranet, you can refer to the setting method of this video. In the video, although I used the external network IP of PPPoE dial-up to illustrate, we can also use the local network IP on our own computer if we change it. In this way, colleagues can connect to our D-Laravel Project.

php,docker,dlaravel

A brief introduction to the phpenv container environment I built

I don't have time to shoot an introduction video, so I'll just grab some pictures and introduce the container environment deviny/phpenv I use. https://github.com/DevinY/phpenvphpenv can be regarded as an evolutionary version of my previous D-Laravel open source project, conceptually extending the use of many Dlaravel operation methods. The update of the container tends to be controlled by the user to build his own image, so I am not very good at changing the version number. In fact, the php version number of D-Laravel seems to have not been changed for a long time:p

dlaravel

D-Laravel released v1.1.5

In response to the launch of Laravel 5.5, PHP also released PHP 7.0.23 and PHP 7.1.9. The fpm version used by D-Laravel is also updated...just adjust the version defined by your docker-compose You can use the latest php...