[Ubuntu] Laravel Supervisor 설치 및 queue 설정
뭐이렇게 할게 많냐 진짜
끝이없네

우분투에서 queue 설정을 하기 위해 supervisor를 설치하자
크론탭으로 돌리면 되는거 아님?ㅋ
응 아님...
Supervisor는 Laravel 전용은 아니고 Linux OS의 프로세스를 모니터링 및 관리에 활용하는 프로그램이다(라고한다)
# Install
$ sudo apt-get install supervisor
supervisor 구성 파일은 /etc/supervisor 디렉토리 아래에 저장되며 디렉토리에 있는 파일은 아래 사진과 같다
conf.d/ : 각 프로세스별 설정 파일을 저장하는 공간
supervisord.conf : 설정 파일 작성 방법
$ sudo nano /etc/supervisor/conf.d/laravel-worker.conf
[program:laravel-worker]
process_name=%(program_name)s_%(process_num)02d
command=/usr/bin/php /var/www/larabel-example/artisan queue:work --sleep=3 --tries=3
autostart=true
autorestart=true
user=root
numprocs=2
redirect_stderr=true
stdout_logfile=/var/www/larabel-example/storage/logs/worker.log
적용
# 가져오기
$ sudo supervisorctl reread
# 갱신
$ sudo supervisorctl update
# 실행
$ sudo supervisorctl start laravel-worker:*
# status 확인
$ sudo supervisorctl status
참고문서
https://reffect.co.jp/laravel/laravel-ubuntu-supervisor
【Laravel】UbuntuにSupervisorをインストール | アールエフェクト
Laravelのキューにたまったジョブを処理するためにはワーカーを起動する必要があります。コマンドからワーカーを起動することができますが運用時に停止した場合に自動起動できるようにsup
reffect.co.jp
https://m.blog.naver.com/shino1025/221472860840
[Linux] supervisor를 사용하여 지속적으로 실행해야 하는 프로세스 관리하기
리눅스는 운영체제 자체가 서버용으로도 잘 사용되다 보니, 프로세스가 지속적으로 실행될 수 있도록 도와...
blog.naver.com
https://laravel.com/docs/10.x/queues#supervisor-configuration
Laravel - The PHP Framework For Web Artisans
Laravel is a PHP web application framework with expressive, elegant syntax. We’ve already laid the foundation — freeing you to create without sweating the small things.
laravel.com