Làm cách nào để khởi động lại trình giám sát chân trời?

Đây là phần 1 của loạt bài về cách định cấu hình Horizon và người giám sát để làm việc trong sản xuất, để đọc phần đầu tiên giới thiệu về thiết lập Horizon, hãy truy cập liên kết

Hướng dẫn cơ bản để thiết lập Laravel Horizon với người giám sát trong Elastic Beanstalk P1

Đây là phần 1 của loạt bài giới thiệu cách thiết lập Laravel Horizon để chuyển sang phần thứ hai để định cấu hình…

vừa phải. com

Chúng tôi đã thiết lập thành công đường chân trời cục bộ trong phần đầu tiên, bây giờ là lúc để chuyển sang phần cấu hình, phần này có lẽ khó và nhàm chán hơn. Tuy nhiên, tôi sẽ cố gắng hết sức để làm cho đơn giản và rõ ràng

Vậy hãy bắt đầu

Định cấu hình Môi trường Sản xuất 🔥🧨

Để hiểu các bước tiếp theo, cần có một số kiến ​​thức cơ bản về một số khái niệm liên quan đến cấu hình hàng đợi trong Linux. Khái niệm chính được đề cập trong bối cảnh này là Người giám sát

Giám sát 👨‍🏫

Giám sát viên là một hệ thống máy khách/máy chủ trong Unix được sử dụng chủ yếu để giám sát các quy trình khác

hệ thống máy khách/máy chủ giống hệt như những gì bạn có trong cơ sở dữ liệu MySql nơi bạn có máy chủ cơ sở dữ liệu MySql thực tế ở chế độ nền và bạn giao tiếp với nó bằng bất kỳ máy khách mysql nào, một ví dụ khác là git với bất kỳ máy khách git tích hợp nào

Người giám sát bao gồm hai phần chính

giám sát. đó là phần máy chủ hoặc quy trình daemon sẽ chạy trong nền

Người giám sát. đó là giao diện dòng lệnh được sử dụng để tương tác với người giám sát

Tầm quan trọng của người giám sát trong trường hợp của chúng tôi là chúng tôi phải sử dụng nó để giám sát quá trình chịu trách nhiệm điều hành công nhân. Người giám sát sẽ đảm bảo rằng quy trình này luôn hoạt động và sẽ khởi động lại quy trình này bất cứ khi nào nó bị lỗi hoặc thoát vì bất kỳ lý do gì. Nhưng quá trình này cần được theo dõi là gì? . Do đó, chúng tôi cần cài đặt trình giám sát và định cấu hình để giám sát quá trình đường chân trời và đảm bảo rằng nó luôn chạy

Hệ thống giám sát có thể được cài đặt bởi trình quản lý gói dựa trên python có tên là

files:
"/usr/local/etc/supervisord.conf":
mode: "000644"
owner: root
group: root
content: |
; supervisor config file
[unix_http_server]
file=/var/run/supervisor.sock ; [the path to the socket file]
chmod=0700 ; sockef file mode [default 0700]
[supervisord]
logfile=/var/log/supervisor/supervisord.log ; [main log file;default $CWD/supervisord.log]
pidfile=/var/run/supervisord.pid ; [supervisord pidfile;default supervisord.pid]
childlogdir=/var/log/supervisor ; ['AUTO' child log dir, default $TEMP]
; the below section must remain in the config file for RPC
; [supervisorctl/web interface] to work, additional interfaces may be
; added by defining them in separate rpcinterface: sections
[rpcinterface:supervisor]
supervisor.rpcinterface_factory = supervisor.rpcinterface:make_main_rpcinterface
[supervisorctl]
serverurl=unix:///var/run/supervisor.sock ; use a unix:// URL for a unix socket
; The [include] section can just contain the "files" setting. This
; setting can list multiple files [separated by whitespace or
; newlines]. It can also contain wildcards. The filenames are
; interpreted as relative to this file. Included files *cannot*
; include files themselves.
[include]
files = /etc/supervisor/conf.d/*.conf
; Change according to your configurations
2

1. Cài đặt gói 📦

Như bạn đã biết, để cài đặt các gói và thực hiện bất kỳ loại cấu hình nào trên các phiên bản [máy chủ] của môi trường cây đậu đàn hồi, chúng tôi phải sử dụng tệp cấu hình

files:
"/usr/local/etc/supervisord.conf":
mode: "000644"
owner: root
group: root
content: |
; supervisor config file
[unix_http_server]
file=/var/run/supervisor.sock ; [the path to the socket file]
chmod=0700 ; sockef file mode [default 0700]
[supervisord]
logfile=/var/log/supervisor/supervisord.log ; [main log file;default $CWD/supervisord.log]
pidfile=/var/run/supervisord.pid ; [supervisord pidfile;default supervisord.pid]
childlogdir=/var/log/supervisor ; ['AUTO' child log dir, default $TEMP]
; the below section must remain in the config file for RPC
; [supervisorctl/web interface] to work, additional interfaces may be
; added by defining them in separate rpcinterface: sections
[rpcinterface:supervisor]
supervisor.rpcinterface_factory = supervisor.rpcinterface:make_main_rpcinterface
[supervisorctl]
serverurl=unix:///var/run/supervisor.sock ; use a unix:// URL for a unix socket
; The [include] section can just contain the "files" setting. This
; setting can list multiple files [separated by whitespace or
; newlines]. It can also contain wildcards. The filenames are
; interpreted as relative to this file. Included files *cannot*
; include files themselves.
[include]
files = /etc/supervisor/conf.d/*.conf
; Change according to your configurations
3 và cụ thể hơn, chúng tôi sử dụng từ khóa
files:
"/usr/local/etc/supervisord.conf":
mode: "000644"
owner: root
group: root
content: |
; supervisor config file
[unix_http_server]
file=/var/run/supervisor.sock ; [the path to the socket file]
chmod=0700 ; sockef file mode [default 0700]
[supervisord]
logfile=/var/log/supervisor/supervisord.log ; [main log file;default $CWD/supervisord.log]
pidfile=/var/run/supervisord.pid ; [supervisord pidfile;default supervisord.pid]
childlogdir=/var/log/supervisor ; ['AUTO' child log dir, default $TEMP]
; the below section must remain in the config file for RPC
; [supervisorctl/web interface] to work, additional interfaces may be
; added by defining them in separate rpcinterface: sections
[rpcinterface:supervisor]
supervisor.rpcinterface_factory = supervisor.rpcinterface:make_main_rpcinterface
[supervisorctl]
serverurl=unix:///var/run/supervisor.sock ; use a unix:// URL for a unix socket
; The [include] section can just contain the "files" setting. This
; setting can list multiple files [separated by whitespace or
; newlines]. It can also contain wildcards. The filenames are
; interpreted as relative to this file. Included files *cannot*
; include files themselves.
[include]
files = /etc/supervisor/conf.d/*.conf
; Change according to your configurations
4 để chỉ ra trình quản lý gói nào nên được sử dụng và

Mặc dù trình quản lý gói mà chúng ta cần sử dụng là

files:
"/usr/local/etc/supervisord.conf":
mode: "000644"
owner: root
group: root
content: |
; supervisor config file
[unix_http_server]
file=/var/run/supervisor.sock ; [the path to the socket file]
chmod=0700 ; sockef file mode [default 0700]
[supervisord]
logfile=/var/log/supervisor/supervisord.log ; [main log file;default $CWD/supervisord.log]
pidfile=/var/run/supervisord.pid ; [supervisord pidfile;default supervisord.pid]
childlogdir=/var/log/supervisor ; ['AUTO' child log dir, default $TEMP]
; the below section must remain in the config file for RPC
; [supervisorctl/web interface] to work, additional interfaces may be
; added by defining them in separate rpcinterface: sections
[rpcinterface:supervisor]
supervisor.rpcinterface_factory = supervisor.rpcinterface:make_main_rpcinterface
[supervisorctl]
serverurl=unix:///var/run/supervisor.sock ; use a unix:// URL for a unix socket
; The [include] section can just contain the "files" setting. This
; setting can list multiple files [separated by whitespace or
; newlines]. It can also contain wildcards. The filenames are
; interpreted as relative to this file. Included files *cannot*
; include files themselves.
[include]
files = /etc/supervisor/conf.d/*.conf
; Change according to your configurations
2, nhưng chúng ta phải sử dụng tên python để chỉ trình quản lý gói này trong. tập tin cấu hình ebextension. Theo tài liệu EB

Beanstalk đàn hồi hỗ trợ hai trình quản lý gói cơ bản cho Python, pip và easy_install. Tuy nhiên, trong cú pháp của tệp cấu hình, bạn phải chỉ định tên trình quản lý gói là python

Để đọc thêm. https. // tài liệu. aws. amazon. com/elasticbeanstalk/latest/dg/customize-containers-ec2. html

Do đó, hãy tạo một tệp có tên

files:
"/usr/local/etc/supervisord.conf":
mode: "000644"
owner: root
group: root
content: |
; supervisor config file
[unix_http_server]
file=/var/run/supervisor.sock ; [the path to the socket file]
chmod=0700 ; sockef file mode [default 0700]
[supervisord]
logfile=/var/log/supervisor/supervisord.log ; [main log file;default $CWD/supervisord.log]
pidfile=/var/run/supervisord.pid ; [supervisord pidfile;default supervisord.pid]
childlogdir=/var/log/supervisor ; ['AUTO' child log dir, default $TEMP]
; the below section must remain in the config file for RPC
; [supervisorctl/web interface] to work, additional interfaces may be
; added by defining them in separate rpcinterface: sections
[rpcinterface:supervisor]
supervisor.rpcinterface_factory = supervisor.rpcinterface:make_main_rpcinterface
[supervisorctl]
serverurl=unix:///var/run/supervisor.sock ; use a unix:// URL for a unix socket
; The [include] section can just contain the "files" setting. This
; setting can list multiple files [separated by whitespace or
; newlines]. It can also contain wildcards. The filenames are
; interpreted as relative to this file. Included files *cannot*
; include files themselves.
[include]
files = /etc/supervisor/conf.d/*.conf
; Change according to your configurations
6 và nội dung của nó sẽ như sau

packages:
python:
supervisor: []
2. Thêm tệp cấu hình giám sát 📰

Tiếp theo, chúng ta cần xác định tệp cấu hình của giám sát, đây là điều cần thiết để thiết lập giám sát mà không gặp sự cố. Tệp nên được đặt tên là

files:
"/usr/local/etc/supervisord.conf":
mode: "000644"
owner: root
group: root
content: |
; supervisor config file
[unix_http_server]
file=/var/run/supervisor.sock ; [the path to the socket file]
chmod=0700 ; sockef file mode [default 0700]
[supervisord]
logfile=/var/log/supervisor/supervisord.log ; [main log file;default $CWD/supervisord.log]
pidfile=/var/run/supervisord.pid ; [supervisord pidfile;default supervisord.pid]
childlogdir=/var/log/supervisor ; ['AUTO' child log dir, default $TEMP]
; the below section must remain in the config file for RPC
; [supervisorctl/web interface] to work, additional interfaces may be
; added by defining them in separate rpcinterface: sections
[rpcinterface:supervisor]
supervisor.rpcinterface_factory = supervisor.rpcinterface:make_main_rpcinterface
[supervisorctl]
serverurl=unix:///var/run/supervisor.sock ; use a unix:// URL for a unix socket
; The [include] section can just contain the "files" setting. This
; setting can list multiple files [separated by whitespace or
; newlines]. It can also contain wildcards. The filenames are
; interpreted as relative to this file. Included files *cannot*
; include files themselves.
[include]
files = /etc/supervisor/conf.d/*.conf
; Change according to your configurations
7 và phải nằm trong thư mục
files:
"/usr/local/etc/supervisord.conf":
mode: "000644"
owner: root
group: root
content: |
; supervisor config file
[unix_http_server]
file=/var/run/supervisor.sock ; [the path to the socket file]
chmod=0700 ; sockef file mode [default 0700]
[supervisord]
logfile=/var/log/supervisor/supervisord.log ; [main log file;default $CWD/supervisord.log]
pidfile=/var/run/supervisord.pid ; [supervisord pidfile;default supervisord.pid]
childlogdir=/var/log/supervisor ; ['AUTO' child log dir, default $TEMP]
; the below section must remain in the config file for RPC
; [supervisorctl/web interface] to work, additional interfaces may be
; added by defining them in separate rpcinterface: sections
[rpcinterface:supervisor]
supervisor.rpcinterface_factory = supervisor.rpcinterface:make_main_rpcinterface
[supervisorctl]
serverurl=unix:///var/run/supervisor.sock ; use a unix:// URL for a unix socket
; The [include] section can just contain the "files" setting. This
; setting can list multiple files [separated by whitespace or
; newlines]. It can also contain wildcards. The filenames are
; interpreted as relative to this file. Included files *cannot*
; include files themselves.
[include]
files = /etc/supervisor/conf.d/*.conf
; Change according to your configurations
8 chủ yếu được sử dụng trong Linux để lưu trữ các tệp cấu hình của nhiều dịch vụ khác nhau

Và để tạo tệp trong Elastic Beanstalk, chúng ta cần sử dụng từ khóa

files:
"/usr/local/etc/supervisord.conf":
mode: "000644"
owner: root
group: root
content: |
; supervisor config file
[unix_http_server]
file=/var/run/supervisor.sock ; [the path to the socket file]
chmod=0700 ; sockef file mode [default 0700]
[supervisord]
logfile=/var/log/supervisor/supervisord.log ; [main log file;default $CWD/supervisord.log]
pidfile=/var/run/supervisord.pid ; [supervisord pidfile;default supervisord.pid]
childlogdir=/var/log/supervisor ; ['AUTO' child log dir, default $TEMP]
; the below section must remain in the config file for RPC
; [supervisorctl/web interface] to work, additional interfaces may be
; added by defining them in separate rpcinterface: sections
[rpcinterface:supervisor]
supervisor.rpcinterface_factory = supervisor.rpcinterface:make_main_rpcinterface
[supervisorctl]
serverurl=unix:///var/run/supervisor.sock ; use a unix:// URL for a unix socket
; The [include] section can just contain the "files" setting. This
; setting can list multiple files [separated by whitespace or
; newlines]. It can also contain wildcards. The filenames are
; interpreted as relative to this file. Included files *cannot*
; include files themselves.
[include]
files = /etc/supervisor/conf.d/*.conf
; Change according to your configurations
9 với định nghĩa nội dung của tệp bên trong nó. Vậy file cấu hình của chúng ta sẽ như sau

files:
"/usr/local/etc/supervisord.conf":
mode: "000644"
owner: root
group: root
content: |
; supervisor config file
[unix_http_server]
file=/var/run/supervisor.sock ; [the path to the socket file]
chmod=0700 ; sockef file mode [default 0700]
[supervisord]
logfile=/var/log/supervisor/supervisord.log ; [main log file;default $CWD/supervisord.log]
pidfile=/var/run/supervisord.pid ; [supervisord pidfile;default supervisord.pid]
childlogdir=/var/log/supervisor ; ['AUTO' child log dir, default $TEMP]
; the below section must remain in the config file for RPC
; [supervisorctl/web interface] to work, additional interfaces may be
; added by defining them in separate rpcinterface: sections
[rpcinterface:supervisor]
supervisor.rpcinterface_factory = supervisor.rpcinterface:make_main_rpcinterface
[supervisorctl]
serverurl=unix:///var/run/supervisor.sock ; use a unix:// URL for a unix socket
; The [include] section can just contain the "files" setting. This
; setting can list multiple files [separated by whitespace or
; newlines]. It can also contain wildcards. The filenames are
; interpreted as relative to this file. Included files *cannot*
; include files themselves.
[include]
files = /etc/supervisor/conf.d/*.conf
; Change according to your configurations

Bạn không cần phải hiểu hết chi tiết trong file này, chỉ cần coi nó như một số mã quan trọng để lấy bộ giám sát

3. Định cấu hình các quy trình được giám sát 🗞️

Và bây giờ để xác định các quy trình mà người giám sát sẽ giám sát, bạn nên xác định từng quy trình riêng lẻ trong tệp cấu hình của chính nó. Như tôi đã đề cập ở trên, quy trình cần được theo dõi là đường chân trời, do đó, hãy tạo một tệp có tên là Horizon-worker. conf bên trong

files:
"/usr/local/etc/supervisord.conf":
mode: "000644"
owner: root
group: root
content: |
; supervisor config file
[unix_http_server]
file=/var/run/supervisor.sock ; [the path to the socket file]
chmod=0700 ; sockef file mode [default 0700]
[supervisord]
logfile=/var/log/supervisor/supervisord.log ; [main log file;default $CWD/supervisord.log]
pidfile=/var/run/supervisord.pid ; [supervisord pidfile;default supervisord.pid]
childlogdir=/var/log/supervisor ; ['AUTO' child log dir, default $TEMP]
; the below section must remain in the config file for RPC
; [supervisorctl/web interface] to work, additional interfaces may be
; added by defining them in separate rpcinterface: sections
[rpcinterface:supervisor]
supervisor.rpcinterface_factory = supervisor.rpcinterface:make_main_rpcinterface
[supervisorctl]
serverurl=unix:///var/run/supervisor.sock ; use a unix:// URL for a unix socket
; The [include] section can just contain the "files" setting. This
; setting can list multiple files [separated by whitespace or
; newlines]. It can also contain wildcards. The filenames are
; interpreted as relative to this file. Included files *cannot*
; include files themselves.
[include]
files = /etc/supervisor/conf.d/*.conf
; Change according to your configurations
00, đây là thư mục mà người giám sát sẽ kiểm tra để biết quy trình nào sẽ được giám sát

Vì vậy, bây giờ nội dung của tệp

files:
"/usr/local/etc/supervisord.conf":
mode: "000644"
owner: root
group: root
content: |
; supervisor config file
[unix_http_server]
file=/var/run/supervisor.sock ; [the path to the socket file]
chmod=0700 ; sockef file mode [default 0700]
[supervisord]
logfile=/var/log/supervisor/supervisord.log ; [main log file;default $CWD/supervisord.log]
pidfile=/var/run/supervisord.pid ; [supervisord pidfile;default supervisord.pid]
childlogdir=/var/log/supervisor ; ['AUTO' child log dir, default $TEMP]
; the below section must remain in the config file for RPC
; [supervisorctl/web interface] to work, additional interfaces may be
; added by defining them in separate rpcinterface: sections
[rpcinterface:supervisor]
supervisor.rpcinterface_factory = supervisor.rpcinterface:make_main_rpcinterface
[supervisorctl]
serverurl=unix:///var/run/supervisor.sock ; use a unix:// URL for a unix socket
; The [include] section can just contain the "files" setting. This
; setting can list multiple files [separated by whitespace or
; newlines]. It can also contain wildcards. The filenames are
; interpreted as relative to this file. Included files *cannot*
; include files themselves.
[include]
files = /etc/supervisor/conf.d/*.conf
; Change according to your configurations
01 sẽ được mở rộng để bao gồm các nội dung sau

files:
"/usr/local/etc/supervisord.conf":
mode: "000644"
owner: root
group: root
content: |
; supervisor config file
[unix_http_server]
file=/var/run/supervisor.sock ; [the path to the socket file]
chmod=0700 ; sockef file mode [default 0700]
[supervisord]
logfile=/var/log/supervisor/supervisord.log ; [main log file;default $CWD/supervisord.log]
pidfile=/var/run/supervisord.pid ; [supervisord pidfile;default supervisord.pid]
childlogdir=/var/log/supervisor ; ['AUTO' child log dir, default $TEMP]
; the below section must remain in the config file for RPC
; [supervisorctl/web interface] to work, additional interfaces may be
; added by defining them in separate rpcinterface: sections
[rpcinterface:supervisor]
supervisor.rpcinterface_factory = supervisor.rpcinterface:make_main_rpcinterface
[supervisorctl]
serverurl=unix:///var/run/supervisor.sock ; use a unix:// URL for a unix socket
; The [include] section can just contain the "files" setting. This
; setting can list multiple files [separated by whitespace or
; newlines]. It can also contain wildcards. The filenames are
; interpreted as relative to this file. Included files *cannot*
; include files themselves.
[include]
files = /etc/supervisor/conf.d/*.conf
; Change according to your configurations
0

Trong phần nội dung, bạn có thể nhận thấy như sau

[chương trình. chân trời-công nhân]. được sử dụng để xác định tên của quy trình để tham chiếu nó bất cứ khi nào cần

Lệnh sẽ được chạy để bắt đầu quá trình này sẽ là tệp của /horizon-script. sh. Bạn có thể thắc mắc tệp này ở đâu, chúng tôi sẽ xác định nó trong bước tiếp theo

Và để có thể gỡ lỗi các vấn đề do chính Horizon tạo ra, chúng tôi đặt giá trị của

files:
"/usr/local/etc/supervisord.conf":
mode: "000644"
owner: root
group: root
content: |
; supervisor config file
[unix_http_server]
file=/var/run/supervisor.sock ; [the path to the socket file]
chmod=0700 ; sockef file mode [default 0700]
[supervisord]
logfile=/var/log/supervisor/supervisord.log ; [main log file;default $CWD/supervisord.log]
pidfile=/var/run/supervisord.pid ; [supervisord pidfile;default supervisord.pid]
childlogdir=/var/log/supervisor ; ['AUTO' child log dir, default $TEMP]
; the below section must remain in the config file for RPC
; [supervisorctl/web interface] to work, additional interfaces may be
; added by defining them in separate rpcinterface: sections
[rpcinterface:supervisor]
supervisor.rpcinterface_factory = supervisor.rpcinterface:make_main_rpcinterface
[supervisorctl]
serverurl=unix:///var/run/supervisor.sock ; use a unix:// URL for a unix socket
; The [include] section can just contain the "files" setting. This
; setting can list multiple files [separated by whitespace or
; newlines]. It can also contain wildcards. The filenames are
; interpreted as relative to this file. Included files *cannot*
; include files themselves.
[include]
files = /etc/supervisor/conf.d/*.conf
; Change according to your configurations
02 là
files:
"/usr/local/etc/supervisord.conf":
mode: "000644"
owner: root
group: root
content: |
; supervisor config file
[unix_http_server]
file=/var/run/supervisor.sock ; [the path to the socket file]
chmod=0700 ; sockef file mode [default 0700]
[supervisord]
logfile=/var/log/supervisor/supervisord.log ; [main log file;default $CWD/supervisord.log]
pidfile=/var/run/supervisord.pid ; [supervisord pidfile;default supervisord.pid]
childlogdir=/var/log/supervisor ; ['AUTO' child log dir, default $TEMP]
; the below section must remain in the config file for RPC
; [supervisorctl/web interface] to work, additional interfaces may be
; added by defining them in separate rpcinterface: sections
[rpcinterface:supervisor]
supervisor.rpcinterface_factory = supervisor.rpcinterface:make_main_rpcinterface
[supervisorctl]
serverurl=unix:///var/run/supervisor.sock ; use a unix:// URL for a unix socket
; The [include] section can just contain the "files" setting. This
; setting can list multiple files [separated by whitespace or
; newlines]. It can also contain wildcards. The filenames are
; interpreted as relative to this file. Included files *cannot*
; include files themselves.
[include]
files = /etc/supervisor/conf.d/*.conf
; Change according to your configurations
03 và tệp chứa các nhật ký này sẽ là giá trị của khóa
files:
"/usr/local/etc/supervisord.conf":
mode: "000644"
owner: root
group: root
content: |
; supervisor config file
[unix_http_server]
file=/var/run/supervisor.sock ; [the path to the socket file]
chmod=0700 ; sockef file mode [default 0700]
[supervisord]
logfile=/var/log/supervisor/supervisord.log ; [main log file;default $CWD/supervisord.log]
pidfile=/var/run/supervisord.pid ; [supervisord pidfile;default supervisord.pid]
childlogdir=/var/log/supervisor ; ['AUTO' child log dir, default $TEMP]
; the below section must remain in the config file for RPC
; [supervisorctl/web interface] to work, additional interfaces may be
; added by defining them in separate rpcinterface: sections
[rpcinterface:supervisor]
supervisor.rpcinterface_factory = supervisor.rpcinterface:make_main_rpcinterface
[supervisorctl]
serverurl=unix:///var/run/supervisor.sock ; use a unix:// URL for a unix socket
; The [include] section can just contain the "files" setting. This
; setting can list multiple files [separated by whitespace or
; newlines]. It can also contain wildcards. The filenames are
; interpreted as relative to this file. Included files *cannot*
; include files themselves.
[include]
files = /etc/supervisor/conf.d/*.conf
; Change according to your configurations
04 là
files:
"/usr/local/etc/supervisord.conf":
mode: "000644"
owner: root
group: root
content: |
; supervisor config file
[unix_http_server]
file=/var/run/supervisor.sock ; [the path to the socket file]
chmod=0700 ; sockef file mode [default 0700]
[supervisord]
logfile=/var/log/supervisor/supervisord.log ; [main log file;default $CWD/supervisord.log]
pidfile=/var/run/supervisord.pid ; [supervisord pidfile;default supervisord.pid]
childlogdir=/var/log/supervisor ; ['AUTO' child log dir, default $TEMP]
; the below section must remain in the config file for RPC
; [supervisorctl/web interface] to work, additional interfaces may be
; added by defining them in separate rpcinterface: sections
[rpcinterface:supervisor]
supervisor.rpcinterface_factory = supervisor.rpcinterface:make_main_rpcinterface
[supervisorctl]
serverurl=unix:///var/run/supervisor.sock ; use a unix:// URL for a unix socket
; The [include] section can just contain the "files" setting. This
; setting can list multiple files [separated by whitespace or
; newlines]. It can also contain wildcards. The filenames are
; interpreted as relative to this file. Included files *cannot*
; include files themselves.
[include]
files = /etc/supervisor/conf.d/*.conf
; Change according to your configurations
05 nên bạn có thể
files:
"/usr/local/etc/supervisord.conf":
mode: "000644"
owner: root
group: root
content: |
; supervisor config file
[unix_http_server]
file=/var/run/supervisor.sock ; [the path to the socket file]
chmod=0700 ; sockef file mode [default 0700]
[supervisord]
logfile=/var/log/supervisor/supervisord.log ; [main log file;default $CWD/supervisord.log]
pidfile=/var/run/supervisord.pid ; [supervisord pidfile;default supervisord.pid]
childlogdir=/var/log/supervisor ; ['AUTO' child log dir, default $TEMP]
; the below section must remain in the config file for RPC
; [supervisorctl/web interface] to work, additional interfaces may be
; added by defining them in separate rpcinterface: sections
[rpcinterface:supervisor]
supervisor.rpcinterface_factory = supervisor.rpcinterface:make_main_rpcinterface
[supervisorctl]
serverurl=unix:///var/run/supervisor.sock ; use a unix:// URL for a unix socket
; The [include] section can just contain the "files" setting. This
; setting can list multiple files [separated by whitespace or
; newlines]. It can also contain wildcards. The filenames are
; interpreted as relative to this file. Included files *cannot*
; include files themselves.
[include]
files = /etc/supervisor/conf.d/*.conf
; Change according to your configurations
06 hoặc
files:
"/usr/local/etc/supervisord.conf":
mode: "000644"
owner: root
group: root
content: |
; supervisor config file
[unix_http_server]
file=/var/run/supervisor.sock ; [the path to the socket file]
chmod=0700 ; sockef file mode [default 0700]
[supervisord]
logfile=/var/log/supervisor/supervisord.log ; [main log file;default $CWD/supervisord.log]
pidfile=/var/run/supervisord.pid ; [supervisord pidfile;default supervisord.pid]
childlogdir=/var/log/supervisor ; ['AUTO' child log dir, default $TEMP]
; the below section must remain in the config file for RPC
; [supervisorctl/web interface] to work, additional interfaces may be
; added by defining them in separate rpcinterface: sections
[rpcinterface:supervisor]
supervisor.rpcinterface_factory = supervisor.rpcinterface:make_main_rpcinterface
[supervisorctl]
serverurl=unix:///var/run/supervisor.sock ; use a unix:// URL for a unix socket
; The [include] section can just contain the "files" setting. This
; setting can list multiple files [separated by whitespace or
; newlines]. It can also contain wildcards. The filenames are
; interpreted as relative to this file. Included files *cannot*
; include files themselves.
[include]
files = /etc/supervisor/conf.d/*.conf
; Change according to your configurations
07 nội dung của tệp này

4. Thêm tập lệnh chân trời. tệp sh 👨‍💻

Bây giờ, hãy định nghĩa tệp **horizon-script. sh** được gọi từ quá trình Horizon-worker như trong bước trước

files:
"/usr/local/etc/supervisord.conf":
mode: "000644"
owner: root
group: root
content: |
; supervisor config file
[unix_http_server]
file=/var/run/supervisor.sock ; [the path to the socket file]
chmod=0700 ; sockef file mode [default 0700]
[supervisord]
logfile=/var/log/supervisor/supervisord.log ; [main log file;default $CWD/supervisord.log]
pidfile=/var/run/supervisord.pid ; [supervisord pidfile;default supervisord.pid]
childlogdir=/var/log/supervisor ; ['AUTO' child log dir, default $TEMP]
; the below section must remain in the config file for RPC
; [supervisorctl/web interface] to work, additional interfaces may be
; added by defining them in separate rpcinterface: sections
[rpcinterface:supervisor]
supervisor.rpcinterface_factory = supervisor.rpcinterface:make_main_rpcinterface
[supervisorctl]
serverurl=unix:///var/run/supervisor.sock ; use a unix:// URL for a unix socket
; The [include] section can just contain the "files" setting. This
; setting can list multiple files [separated by whitespace or
; newlines]. It can also contain wildcards. The filenames are
; interpreted as relative to this file. Included files *cannot*
; include files themselves.
[include]
files = /etc/supervisor/conf.d/*.conf
; Change according to your configurations
9

Như bạn có thể thấy, nội dung của tập lệnh rất đơn giản, tôi đang lặp lại một thông báo cho biết điểm bắt đầu của đường chân trời và sau đó tôi tải tất cả các biến môi trường được lưu trữ trong môi trường Elastic Beanstalk. Trên thực tế, bước này rất quan trọng và nó là bước mà tôi đã dành phần lớn thời gian để tìm ra nó. Theo mặc định, các biến môi trường mà bạn lưu trữ trong môi trường Beanstalk đàn hồi sẽ không được tải theo mặc định để sử dụng trong các công việc Xếp hàng hoặc Định kỳ, mặc dù bạn có thể in tất cả chúng bằng cách sử dụng lệnh

files:
"/usr/local/etc/supervisord.conf":
mode: "000644"
owner: root
group: root
content: |
; supervisor config file
[unix_http_server]
file=/var/run/supervisor.sock ; [the path to the socket file]
chmod=0700 ; sockef file mode [default 0700]
[supervisord]
logfile=/var/log/supervisor/supervisord.log ; [main log file;default $CWD/supervisord.log]
pidfile=/var/run/supervisord.pid ; [supervisord pidfile;default supervisord.pid]
childlogdir=/var/log/supervisor ; ['AUTO' child log dir, default $TEMP]
; the below section must remain in the config file for RPC
; [supervisorctl/web interface] to work, additional interfaces may be
; added by defining them in separate rpcinterface: sections
[rpcinterface:supervisor]
supervisor.rpcinterface_factory = supervisor.rpcinterface:make_main_rpcinterface
[supervisorctl]
serverurl=unix:///var/run/supervisor.sock ; use a unix:// URL for a unix socket
; The [include] section can just contain the "files" setting. This
; setting can list multiple files [separated by whitespace or
; newlines]. It can also contain wildcards. The filenames are
; interpreted as relative to this file. Included files *cannot*
; include files themselves.
[include]
files = /etc/supervisor/conf.d/*.conf
; Change according to your configurations
07. Và cuối cùng, dòng cuối cùng trong kịch bản là dòng gọi nghệ nhân chạy chân trời

Bây giờ chúng tôi đã sẵn sàng cả chân trời và người giám sát, mặc dù chúng tôi vẫn chưa hoàn thành. Như bạn có thể biết, cây đậu đàn hồi tạo và thay thế các phiên bản theo thời gian dựa trên một số trường hợp cũng như các công thức chia tỷ lệ đã xác định và do đó, chúng ta cần yêu cầu cây đậu đàn hồi bắt đầu quy trình giám sát mới cho mỗi máy chủ mới được tạo

Trước khi thực hiện bước này, hãy quay lại các khái niệm linux để giải thích một điều quan trọng liên quan đến bước tiếp theo. Trong bất kỳ hệ thống linux nào, bạn sẽ có thư mục

files:
"/usr/local/etc/supervisord.conf":
mode: "000644"
owner: root
group: root
content: |
; supervisor config file
[unix_http_server]
file=/var/run/supervisor.sock ; [the path to the socket file]
chmod=0700 ; sockef file mode [default 0700]
[supervisord]
logfile=/var/log/supervisor/supervisord.log ; [main log file;default $CWD/supervisord.log]
pidfile=/var/run/supervisord.pid ; [supervisord pidfile;default supervisord.pid]
childlogdir=/var/log/supervisor ; ['AUTO' child log dir, default $TEMP]
; the below section must remain in the config file for RPC
; [supervisorctl/web interface] to work, additional interfaces may be
; added by defining them in separate rpcinterface: sections
[rpcinterface:supervisor]
supervisor.rpcinterface_factory = supervisor.rpcinterface:make_main_rpcinterface
[supervisorctl]
serverurl=unix:///var/run/supervisor.sock ; use a unix:// URL for a unix socket
; The [include] section can just contain the "files" setting. This
; setting can list multiple files [separated by whitespace or
; newlines]. It can also contain wildcards. The filenames are
; interpreted as relative to this file. Included files *cannot*
; include files themselves.
[include]
files = /etc/supervisor/conf.d/*.conf
; Change according to your configurations
09 Thư mục này chứa một tập hợp các tệp, nội dung của mỗi tệp bao gồm một số tập lệnh để bắt đầu/dừng/khởi động lại/tải lại dịch vụ được liên kết với tệp này. Nói cách khác, mỗi dịch vụ được cài đặt trong Linux phải có loại tập lệnh như vậy để bạn có thể gọi lệnh sau

files:
"/usr/local/etc/supervisord.conf":
mode: "000644"
owner: root
group: root
content: |
; supervisor config file
[unix_http_server]
file=/var/run/supervisor.sock ; [the path to the socket file]
chmod=0700 ; sockef file mode [default 0700]
[supervisord]
logfile=/var/log/supervisor/supervisord.log ; [main log file;default $CWD/supervisord.log]
pidfile=/var/run/supervisord.pid ; [supervisord pidfile;default supervisord.pid]
childlogdir=/var/log/supervisor ; ['AUTO' child log dir, default $TEMP]
; the below section must remain in the config file for RPC
; [supervisorctl/web interface] to work, additional interfaces may be
; added by defining them in separate rpcinterface: sections
[rpcinterface:supervisor]
supervisor.rpcinterface_factory = supervisor.rpcinterface:make_main_rpcinterface
[supervisorctl]
serverurl=unix:///var/run/supervisor.sock ; use a unix:// URL for a unix socket
; The [include] section can just contain the "files" setting. This
; setting can list multiple files [separated by whitespace or
; newlines]. It can also contain wildcards. The filenames are
; interpreted as relative to this file. Included files *cannot*
; include files themselves.
[include]
files = /etc/supervisor/conf.d/*.conf
; Change according to your configurations
2

Ví dụ: để khởi động lại dịch vụ apache, bạn có thể chạy

files:
"/usr/local/etc/supervisord.conf":
mode: "000644"
owner: root
group: root
content: |
; supervisor config file
[unix_http_server]
file=/var/run/supervisor.sock ; [the path to the socket file]
chmod=0700 ; sockef file mode [default 0700]
[supervisord]
logfile=/var/log/supervisor/supervisord.log ; [main log file;default $CWD/supervisord.log]
pidfile=/var/run/supervisord.pid ; [supervisord pidfile;default supervisord.pid]
childlogdir=/var/log/supervisor ; ['AUTO' child log dir, default $TEMP]
; the below section must remain in the config file for RPC
; [supervisorctl/web interface] to work, additional interfaces may be
; added by defining them in separate rpcinterface: sections
[rpcinterface:supervisor]
supervisor.rpcinterface_factory = supervisor.rpcinterface:make_main_rpcinterface
[supervisorctl]
serverurl=unix:///var/run/supervisor.sock ; use a unix:// URL for a unix socket
; The [include] section can just contain the "files" setting. This
; setting can list multiple files [separated by whitespace or
; newlines]. It can also contain wildcards. The filenames are
; interpreted as relative to this file. Included files *cannot*
; include files themselves.
[include]
files = /etc/supervisor/conf.d/*.conf
; Change according to your configurations
3

Cái nào sẽ sử dụng tệp script của apache trong

files:
"/usr/local/etc/supervisord.conf":
mode: "000644"
owner: root
group: root
content: |
; supervisor config file
[unix_http_server]
file=/var/run/supervisor.sock ; [the path to the socket file]
chmod=0700 ; sockef file mode [default 0700]
[supervisord]
logfile=/var/log/supervisor/supervisord.log ; [main log file;default $CWD/supervisord.log]
pidfile=/var/run/supervisord.pid ; [supervisord pidfile;default supervisord.pid]
childlogdir=/var/log/supervisor ; ['AUTO' child log dir, default $TEMP]
; the below section must remain in the config file for RPC
; [supervisorctl/web interface] to work, additional interfaces may be
; added by defining them in separate rpcinterface: sections
[rpcinterface:supervisor]
supervisor.rpcinterface_factory = supervisor.rpcinterface:make_main_rpcinterface
[supervisorctl]
serverurl=unix:///var/run/supervisor.sock ; use a unix:// URL for a unix socket
; The [include] section can just contain the "files" setting. This
; setting can list multiple files [separated by whitespace or
; newlines]. It can also contain wildcards. The filenames are
; interpreted as relative to this file. Included files *cannot*
; include files themselves.
[include]
files = /etc/supervisor/conf.d/*.conf
; Change according to your configurations
90 và gọi phương thức khởi động lại đó để khởi động lại dịch vụ apache

Chúng tôi muốn làm điều tương tự cho người giám sát;

files:
"/usr/local/etc/supervisord.conf":
mode: "000644"
owner: root
group: root
content: |
; supervisor config file
[unix_http_server]
file=/var/run/supervisor.sock ; [the path to the socket file]
chmod=0700 ; sockef file mode [default 0700]
[supervisord]
logfile=/var/log/supervisor/supervisord.log ; [main log file;default $CWD/supervisord.log]
pidfile=/var/run/supervisord.pid ; [supervisord pidfile;default supervisord.pid]
childlogdir=/var/log/supervisor ; ['AUTO' child log dir, default $TEMP]
; the below section must remain in the config file for RPC
; [supervisorctl/web interface] to work, additional interfaces may be
; added by defining them in separate rpcinterface: sections
[rpcinterface:supervisor]
supervisor.rpcinterface_factory = supervisor.rpcinterface:make_main_rpcinterface
[supervisorctl]
serverurl=unix:///var/run/supervisor.sock ; use a unix:// URL for a unix socket
; The [include] section can just contain the "files" setting. This
; setting can list multiple files [separated by whitespace or
; newlines]. It can also contain wildcards. The filenames are
; interpreted as relative to this file. Included files *cannot*
; include files themselves.
[include]
files = /etc/supervisor/conf.d/*.conf
; Change according to your configurations
55. Thêm tệp
files:
"/usr/local/etc/supervisord.conf":
mode: "000644"
owner: root
group: root
content: |
; supervisor config file
[unix_http_server]
file=/var/run/supervisor.sock ; [the path to the socket file]
chmod=0700 ; sockef file mode [default 0700]
[supervisord]
logfile=/var/log/supervisor/supervisord.log ; [main log file;default $CWD/supervisord.log]
pidfile=/var/run/supervisord.pid ; [supervisord pidfile;default supervisord.pid]
childlogdir=/var/log/supervisor ; ['AUTO' child log dir, default $TEMP]
; the below section must remain in the config file for RPC
; [supervisorctl/web interface] to work, additional interfaces may be
; added by defining them in separate rpcinterface: sections
[rpcinterface:supervisor]
supervisor.rpcinterface_factory = supervisor.rpcinterface:make_main_rpcinterface
[supervisorctl]
serverurl=unix:///var/run/supervisor.sock ; use a unix:// URL for a unix socket
; The [include] section can just contain the "files" setting. This
; setting can list multiple files [separated by whitespace or
; newlines]. It can also contain wildcards. The filenames are
; interpreted as relative to this file. Included files *cannot*
; include files themselves.
[include]
files = /etc/supervisor/conf.d/*.conf
; Change according to your configurations
91 📂

Bây giờ chúng ta cần thêm phần sau vào tệp

files:
"/usr/local/etc/supervisord.conf":
mode: "000644"
owner: root
group: root
content: |
; supervisor config file
[unix_http_server]
file=/var/run/supervisor.sock ; [the path to the socket file]
chmod=0700 ; sockef file mode [default 0700]
[supervisord]
logfile=/var/log/supervisor/supervisord.log ; [main log file;default $CWD/supervisord.log]
pidfile=/var/run/supervisord.pid ; [supervisord pidfile;default supervisord.pid]
childlogdir=/var/log/supervisor ; ['AUTO' child log dir, default $TEMP]
; the below section must remain in the config file for RPC
; [supervisorctl/web interface] to work, additional interfaces may be
; added by defining them in separate rpcinterface: sections
[rpcinterface:supervisor]
supervisor.rpcinterface_factory = supervisor.rpcinterface:make_main_rpcinterface
[supervisorctl]
serverurl=unix:///var/run/supervisor.sock ; use a unix:// URL for a unix socket
; The [include] section can just contain the "files" setting. This
; setting can list multiple files [separated by whitespace or
; newlines]. It can also contain wildcards. The filenames are
; interpreted as relative to this file. Included files *cannot*
; include files themselves.
[include]
files = /etc/supervisor/conf.d/*.conf
; Change according to your configurations
6

files:
"/usr/local/etc/supervisord.conf":
mode: "000644"
owner: root
group: root
content: |
; supervisor config file
[unix_http_server]
file=/var/run/supervisor.sock ; [the path to the socket file]
chmod=0700 ; sockef file mode [default 0700]
[supervisord]
logfile=/var/log/supervisor/supervisord.log ; [main log file;default $CWD/supervisord.log]
pidfile=/var/run/supervisord.pid ; [supervisord pidfile;default supervisord.pid]
childlogdir=/var/log/supervisor ; ['AUTO' child log dir, default $TEMP]
; the below section must remain in the config file for RPC
; [supervisorctl/web interface] to work, additional interfaces may be
; added by defining them in separate rpcinterface: sections
[rpcinterface:supervisor]
supervisor.rpcinterface_factory = supervisor.rpcinterface:make_main_rpcinterface
[supervisorctl]
serverurl=unix:///var/run/supervisor.sock ; use a unix:// URL for a unix socket
; The [include] section can just contain the "files" setting. This
; setting can list multiple files [separated by whitespace or
; newlines]. It can also contain wildcards. The filenames are
; interpreted as relative to this file. Included files *cannot*
; include files themselves.
[include]
files = /etc/supervisor/conf.d/*.conf
; Change according to your configurations
8

Trông có dài không? . Điều duy nhất chúng ta cần bây giờ là gọi khởi động lại không làm gì ngoài việc gọi dừng để dừng dịch vụ giám sát đang chạy hiện tại - nếu có - và bắt đầu một dịch vụ mới. Bước này phải được thêm vào phần

files:
"/usr/local/etc/supervisord.conf":
mode: "000644"
owner: root
group: root
content: |
; supervisor config file
[unix_http_server]
file=/var/run/supervisor.sock ; [the path to the socket file]
chmod=0700 ; sockef file mode [default 0700]
[supervisord]
logfile=/var/log/supervisor/supervisord.log ; [main log file;default $CWD/supervisord.log]
pidfile=/var/run/supervisord.pid ; [supervisord pidfile;default supervisord.pid]
childlogdir=/var/log/supervisor ; ['AUTO' child log dir, default $TEMP]
; the below section must remain in the config file for RPC
; [supervisorctl/web interface] to work, additional interfaces may be
; added by defining them in separate rpcinterface: sections
[rpcinterface:supervisor]
supervisor.rpcinterface_factory = supervisor.rpcinterface:make_main_rpcinterface
[supervisorctl]
serverurl=unix:///var/run/supervisor.sock ; use a unix:// URL for a unix socket
; The [include] section can just contain the "files" setting. This
; setting can list multiple files [separated by whitespace or
; newlines]. It can also contain wildcards. The filenames are
; interpreted as relative to this file. Included files *cannot*
; include files themselves.
[include]
files = /etc/supervisor/conf.d/*.conf
; Change according to your configurations
93 của
files:
"/usr/local/etc/supervisord.conf":
mode: "000644"
owner: root
group: root
content: |
; supervisor config file
[unix_http_server]
file=/var/run/supervisor.sock ; [the path to the socket file]
chmod=0700 ; sockef file mode [default 0700]
[supervisord]
logfile=/var/log/supervisor/supervisord.log ; [main log file;default $CWD/supervisord.log]
pidfile=/var/run/supervisord.pid ; [supervisord pidfile;default supervisord.pid]
childlogdir=/var/log/supervisor ; ['AUTO' child log dir, default $TEMP]
; the below section must remain in the config file for RPC
; [supervisorctl/web interface] to work, additional interfaces may be
; added by defining them in separate rpcinterface: sections
[rpcinterface:supervisor]
supervisor.rpcinterface_factory = supervisor.rpcinterface:make_main_rpcinterface
[supervisorctl]
serverurl=unix:///var/run/supervisor.sock ; use a unix:// URL for a unix socket
; The [include] section can just contain the "files" setting. This
; setting can list multiple files [separated by whitespace or
; newlines]. It can also contain wildcards. The filenames are
; interpreted as relative to this file. Included files *cannot*
; include files themselves.
[include]
files = /etc/supervisor/conf.d/*.conf
; Change according to your configurations
6 để nó được gọi mỗi khi máy chủ mới được tạo

files:
"/usr/local/etc/supervisord.conf":
mode: "000644"
owner: root
group: root
content: |
; supervisor config file
[unix_http_server]
file=/var/run/supervisor.sock ; [the path to the socket file]
chmod=0700 ; sockef file mode [default 0700]
[supervisord]
logfile=/var/log/supervisor/supervisord.log ; [main log file;default $CWD/supervisord.log]
pidfile=/var/run/supervisord.pid ; [supervisord pidfile;default supervisord.pid]
childlogdir=/var/log/supervisor ; ['AUTO' child log dir, default $TEMP]
; the below section must remain in the config file for RPC
; [supervisorctl/web interface] to work, additional interfaces may be
; added by defining them in separate rpcinterface: sections
[rpcinterface:supervisor]
supervisor.rpcinterface_factory = supervisor.rpcinterface:make_main_rpcinterface
[supervisorctl]
serverurl=unix:///var/run/supervisor.sock ; use a unix:// URL for a unix socket
; The [include] section can just contain the "files" setting. This
; setting can list multiple files [separated by whitespace or
; newlines]. It can also contain wildcards. The filenames are
; interpreted as relative to this file. Included files *cannot*
; include files themselves.
[include]
files = /etc/supervisor/conf.d/*.conf
; Change according to your configurations
1

Bằng cách này, nếu bạn tải mã của mình lên cây đậu đàn hồi, mọi thứ sẽ hoạt động tốt

Một điều nữa. ☝️

Trên thực tế, chúng tôi vẫn chưa hoàn thành 🙇🏻. Khi bạn có một quy trình đường chân trời đang chạy, quy trình này sẽ hoạt động theo phiên bản mã được tải lên mới nhất khi quy trình đó bắt đầu. Nói cách khác, nếu bạn đẩy một phiên bản mã mới có một số thay đổi đối với các công việc được xếp hàng đợi, các công nhân chân trời sẽ không nhận ra phiên bản mới này và họ sẽ tiếp tục thực thi dựa trên phiên bản mới nhất. Bạn có thể nghĩ rằng khởi động lại người giám sát là đủ, à, không chính xác, vì khởi động lại không có nghĩa là chân trời sẽ được khởi động lại, mà thay vào đó, nó sẽ vẫn hoạt động. Và khi một quy trình giám sát mới được xây dựng, nó sẽ nhận ra rằng đã có một quy trình đang hoạt động, có nghĩa là không cần phải khởi động lại nó

7. Khởi động lại chân trời 🔁

Để khởi động lại chân trời, chúng tôi sẽ sử dụng các hook AWS, đây là tập lệnh dựa trên sự kiện được thực thi dựa trên sự kiện được nhắm mục tiêu. Một trong những móc sự kiện có thể được nhắm mục tiêu là

files:
"/usr/local/etc/supervisord.conf":
mode: "000644"
owner: root
group: root
content: |
; supervisor config file
[unix_http_server]
file=/var/run/supervisor.sock ; [the path to the socket file]
chmod=0700 ; sockef file mode [default 0700]
[supervisord]
logfile=/var/log/supervisor/supervisord.log ; [main log file;default $CWD/supervisord.log]
pidfile=/var/run/supervisord.pid ; [supervisord pidfile;default supervisord.pid]
childlogdir=/var/log/supervisor ; ['AUTO' child log dir, default $TEMP]
; the below section must remain in the config file for RPC
; [supervisorctl/web interface] to work, additional interfaces may be
; added by defining them in separate rpcinterface: sections
[rpcinterface:supervisor]
supervisor.rpcinterface_factory = supervisor.rpcinterface:make_main_rpcinterface
[supervisorctl]
serverurl=unix:///var/run/supervisor.sock ; use a unix:// URL for a unix socket
; The [include] section can just contain the "files" setting. This
; setting can list multiple files [separated by whitespace or
; newlines]. It can also contain wildcards. The filenames are
; interpreted as relative to this file. Included files *cannot*
; include files themselves.
[include]
files = /etc/supervisor/conf.d/*.conf
; Change according to your configurations
95 sẽ gọi tập lệnh sau khi phiên bản mới được triển khai thành công. Để xác định một tập lệnh như vậy, chúng ta cần viết tập lệnh này trong thư mục sau.
files:
"/usr/local/etc/supervisord.conf":
mode: "000644"
owner: root
group: root
content: |
; supervisor config file
[unix_http_server]
file=/var/run/supervisor.sock ; [the path to the socket file]
chmod=0700 ; sockef file mode [default 0700]
[supervisord]
logfile=/var/log/supervisor/supervisord.log ; [main log file;default $CWD/supervisord.log]
pidfile=/var/run/supervisord.pid ; [supervisord pidfile;default supervisord.pid]
childlogdir=/var/log/supervisor ; ['AUTO' child log dir, default $TEMP]
; the below section must remain in the config file for RPC
; [supervisorctl/web interface] to work, additional interfaces may be
; added by defining them in separate rpcinterface: sections
[rpcinterface:supervisor]
supervisor.rpcinterface_factory = supervisor.rpcinterface:make_main_rpcinterface
[supervisorctl]
serverurl=unix:///var/run/supervisor.sock ; use a unix:// URL for a unix socket
; The [include] section can just contain the "files" setting. This
; setting can list multiple files [separated by whitespace or
; newlines]. It can also contain wildcards. The filenames are
; interpreted as relative to this file. Included files *cannot*
; include files themselves.
[include]
files = /etc/supervisor/conf.d/*.conf
; Change according to your configurations
96 và tôi sẽ sử dụng tên của
files:
"/usr/local/etc/supervisord.conf":
mode: "000644"
owner: root
group: root
content: |
; supervisor config file
[unix_http_server]
file=/var/run/supervisor.sock ; [the path to the socket file]
chmod=0700 ; sockef file mode [default 0700]
[supervisord]
logfile=/var/log/supervisor/supervisord.log ; [main log file;default $CWD/supervisord.log]
pidfile=/var/run/supervisord.pid ; [supervisord pidfile;default supervisord.pid]
childlogdir=/var/log/supervisor ; ['AUTO' child log dir, default $TEMP]
; the below section must remain in the config file for RPC
; [supervisorctl/web interface] to work, additional interfaces may be
; added by defining them in separate rpcinterface: sections
[rpcinterface:supervisor]
supervisor.rpcinterface_factory = supervisor.rpcinterface:make_main_rpcinterface
[supervisorctl]
serverurl=unix:///var/run/supervisor.sock ; use a unix:// URL for a unix socket
; The [include] section can just contain the "files" setting. This
; setting can list multiple files [separated by whitespace or
; newlines]. It can also contain wildcards. The filenames are
; interpreted as relative to this file. Included files *cannot*
; include files themselves.
[include]
files = /etc/supervisor/conf.d/*.conf
; Change according to your configurations
97 , vì vậy hãy cập nhật tệp cấu hình để bao gồm những điều sau

files:
"/usr/local/etc/supervisord.conf":
mode: "000644"
owner: root
group: root
content: |
; supervisor config file
[unix_http_server]
file=/var/run/supervisor.sock ; [the path to the socket file]
chmod=0700 ; sockef file mode [default 0700]
[supervisord]
logfile=/var/log/supervisor/supervisord.log ; [main log file;default $CWD/supervisord.log]
pidfile=/var/run/supervisord.pid ; [supervisord pidfile;default supervisord.pid]
childlogdir=/var/log/supervisor ; ['AUTO' child log dir, default $TEMP]
; the below section must remain in the config file for RPC
; [supervisorctl/web interface] to work, additional interfaces may be
; added by defining them in separate rpcinterface: sections
[rpcinterface:supervisor]
supervisor.rpcinterface_factory = supervisor.rpcinterface:make_main_rpcinterface
[supervisorctl]
serverurl=unix:///var/run/supervisor.sock ; use a unix:// URL for a unix socket
; The [include] section can just contain the "files" setting. This
; setting can list multiple files [separated by whitespace or
; newlines]. It can also contain wildcards. The filenames are
; interpreted as relative to this file. Included files *cannot*
; include files themselves.
[include]
files = /etc/supervisor/conf.d/*.conf
; Change according to your configurations
5

Lưu ý cách tôi đang tải lại các biến môi trường và sau đó tôi chỉ kết thúc quá trình đường chân trời mà không khởi động nó. Tại sao?

Tôi biết rằng đã quá lâu, nhưng chúng ta vẫn cần thêm dòng cuối cùng vào

files:
"/usr/local/etc/supervisord.conf":
mode: "000644"
owner: root
group: root
content: |
; supervisor config file
[unix_http_server]
file=/var/run/supervisor.sock ; [the path to the socket file]
chmod=0700 ; sockef file mode [default 0700]
[supervisord]
logfile=/var/log/supervisor/supervisord.log ; [main log file;default $CWD/supervisord.log]
pidfile=/var/run/supervisord.pid ; [supervisord pidfile;default supervisord.pid]
childlogdir=/var/log/supervisor ; ['AUTO' child log dir, default $TEMP]
; the below section must remain in the config file for RPC
; [supervisorctl/web interface] to work, additional interfaces may be
; added by defining them in separate rpcinterface: sections
[rpcinterface:supervisor]
supervisor.rpcinterface_factory = supervisor.rpcinterface:make_main_rpcinterface
[supervisorctl]
serverurl=unix:///var/run/supervisor.sock ; use a unix:// URL for a unix socket
; The [include] section can just contain the "files" setting. This
; setting can list multiple files [separated by whitespace or
; newlines]. It can also contain wildcards. The filenames are
; interpreted as relative to this file. Included files *cannot*
; include files themselves.
[include]
files = /etc/supervisor/conf.d/*.conf
; Change according to your configurations
93 để tạo thư mục
files:
"/usr/local/etc/supervisord.conf":
mode: "000644"
owner: root
group: root
content: |
; supervisor config file
[unix_http_server]
file=/var/run/supervisor.sock ; [the path to the socket file]
chmod=0700 ; sockef file mode [default 0700]
[supervisord]
logfile=/var/log/supervisor/supervisord.log ; [main log file;default $CWD/supervisord.log]
pidfile=/var/run/supervisord.pid ; [supervisord pidfile;default supervisord.pid]
childlogdir=/var/log/supervisor ; ['AUTO' child log dir, default $TEMP]
; the below section must remain in the config file for RPC
; [supervisorctl/web interface] to work, additional interfaces may be
; added by defining them in separate rpcinterface: sections
[rpcinterface:supervisor]
supervisor.rpcinterface_factory = supervisor.rpcinterface:make_main_rpcinterface
[supervisorctl]
serverurl=unix:///var/run/supervisor.sock ; use a unix:// URL for a unix socket
; The [include] section can just contain the "files" setting. This
; setting can list multiple files [separated by whitespace or
; newlines]. It can also contain wildcards. The filenames are
; interpreted as relative to this file. Included files *cannot*
; include files themselves.
[include]
files = /etc/supervisor/conf.d/*.conf
; Change according to your configurations
96 vì nó không có ở đó theo mặc định

files:
"/usr/local/etc/supervisord.conf":
mode: "000644"
owner: root
group: root
content: |
; supervisor config file
[unix_http_server]
file=/var/run/supervisor.sock ; [the path to the socket file]
chmod=0700 ; sockef file mode [default 0700]
[supervisord]
logfile=/var/log/supervisor/supervisord.log ; [main log file;default $CWD/supervisord.log]
pidfile=/var/run/supervisord.pid ; [supervisord pidfile;default supervisord.pid]
childlogdir=/var/log/supervisor ; ['AUTO' child log dir, default $TEMP]
; the below section must remain in the config file for RPC
; [supervisorctl/web interface] to work, additional interfaces may be
; added by defining them in separate rpcinterface: sections
[rpcinterface:supervisor]
supervisor.rpcinterface_factory = supervisor.rpcinterface:make_main_rpcinterface
[supervisorctl]
serverurl=unix:///var/run/supervisor.sock ; use a unix:// URL for a unix socket
; The [include] section can just contain the "files" setting. This
; setting can list multiple files [separated by whitespace or
; newlines]. It can also contain wildcards. The filenames are
; interpreted as relative to this file. Included files *cannot*
; include files themselves.
[include]
files = /etc/supervisor/conf.d/*.conf
; Change according to your configurations
0

Cuối cùng, tôi có thể nói rằng bạn đã sẵn sàng sử dụng ngay bây giờ và nếu bạn thiết lập mọi thứ đúng cách, bạn sẽ thấy đường chân trời hoạt động liên tục tốt mà không gặp vấn đề gì

Phiên bản đầy đủ của tệp cấu hình

files:
"/usr/local/etc/supervisord.conf":
mode: "000644"
owner: root
group: root
content: |
; supervisor config file
[unix_http_server]
file=/var/run/supervisor.sock ; [the path to the socket file]
chmod=0700 ; sockef file mode [default 0700]
[supervisord]
logfile=/var/log/supervisor/supervisord.log ; [main log file;default $CWD/supervisord.log]
pidfile=/var/run/supervisord.pid ; [supervisord pidfile;default supervisord.pid]
childlogdir=/var/log/supervisor ; ['AUTO' child log dir, default $TEMP]
; the below section must remain in the config file for RPC
; [supervisorctl/web interface] to work, additional interfaces may be
; added by defining them in separate rpcinterface: sections
[rpcinterface:supervisor]
supervisor.rpcinterface_factory = supervisor.rpcinterface:make_main_rpcinterface
[supervisorctl]
serverurl=unix:///var/run/supervisor.sock ; use a unix:// URL for a unix socket
; The [include] section can just contain the "files" setting. This
; setting can list multiple files [separated by whitespace or
; newlines]. It can also contain wildcards. The filenames are
; interpreted as relative to this file. Included files *cannot*
; include files themselves.
[include]
files = /etc/supervisor/conf.d/*.conf
; Change according to your configurations
6 phải như sau

files:
"/usr/local/etc/supervisord.conf":
mode: "000644"
owner: root
group: root
content: |
; supervisor config file
[unix_http_server]
file=/var/run/supervisor.sock ; [the path to the socket file]
chmod=0700 ; sockef file mode [default 0700]
[supervisord]
logfile=/var/log/supervisor/supervisord.log ; [main log file;default $CWD/supervisord.log]
pidfile=/var/run/supervisord.pid ; [supervisord pidfile;default supervisord.pid]
childlogdir=/var/log/supervisor ; ['AUTO' child log dir, default $TEMP]
; the below section must remain in the config file for RPC
; [supervisorctl/web interface] to work, additional interfaces may be
; added by defining them in separate rpcinterface: sections
[rpcinterface:supervisor]
supervisor.rpcinterface_factory = supervisor.rpcinterface:make_main_rpcinterface
[supervisorctl]
serverurl=unix:///var/run/supervisor.sock ; use a unix:// URL for a unix socket
; The [include] section can just contain the "files" setting. This
; setting can list multiple files [separated by whitespace or
; newlines]. It can also contain wildcards. The filenames are
; interpreted as relative to this file. Included files *cannot*
; include files themselves.
[include]
files = /etc/supervisor/conf.d/*.conf
; Change according to your configurations
1

Tôi biết rằng các bước cấu hình hơi dài, nhưng đó chỉ là bản chất của hầu hết các cấu hình trong bất kỳ môi trường sản xuất nào 💔. Nói như vậy, tôi đã cố gắng hết sức để làm cho mọi thứ trở nên rõ ràng và đơn giản nhất có thể và tôi hy vọng rằng điều đó có lợi cho bạn 😅. Xin đừng ngần ngại thêm bất kỳ ghi chú hoặc bổ sung nào trong phần bình luận bên dưới. 😃

PHP Artisan Horizon là gì?

Horizon cung cấp bảng điều khiển đẹp mắt và cấu hình dựa trên mã cho hàng đợi Redis do Laravel hỗ trợ . Horizon cho phép bạn dễ dàng theo dõi các số liệu chính của hệ thống hàng đợi của mình, chẳng hạn như thông lượng công việc, thời gian chạy và lỗi công việc.

Laravel Horizon có miễn phí không?

Mặc dù có một hệ thống cấu hình dựa trên mã, hoàn toàn mới, nhưng Horizon là một giao diện người dùng bảng điều khiển thực sự tuyệt vời và nó hoàn toàn là mã nguồn mở và miễn phí cho toàn bộ nhóm người dùng Laravel.

Chủ Đề