-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
12 changed files
with
203 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
default['laravel-artisan']['queue']['worker_name'] = 'laravel-worker' | ||
default['laravel-artisan']['queue']['command'] = "php #{node['laravel-artisan']['path']}/artisan queue:work" | ||
default['laravel-artisan']['queue']['autostart'] = true | ||
default['laravel-artisan']['queue']['autorestart'] = true | ||
default['laravel-artisan']['queue']['redirect_stderr'] = true | ||
default['laravel-artisan']['queue']['user'] = 'www-data' | ||
default['laravel-artisan']['queue']['stdout_logfile'] = "/var/log/supervisor/#{node['laravel-artisan']['queue']['worker_name']}.log" | ||
default['laravel-artisan']['queue']['numprocs'] = 1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
default['laravel-artisan']['supervisor']['conf_dir'] = "/etc/supervisor/conf.d" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
# | ||
# Cookbook:: laravel-artisan | ||
# Recipe:: migrate_status | ||
# | ||
# Copyright:: 2017, The Authors, All Rights Reserved. | ||
|
||
include_recipe 'laravel-artisan::default' | ||
|
||
COMMAND = 'migrate:status' | ||
|
||
execute "php artisan #{COMMAND}" do | ||
cwd node['laravel-artisan']['path'] | ||
command "#{node['laravel-artisan']['call']} #{COMMAND} #{node['laravel-artisan']['verbosity']}" | ||
action :run | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
# Stop the artisan queue:work process. | ||
# | ||
# Cookbook:: laravel-artisan | ||
# Recipe:: queue_stop | ||
# | ||
# Copyright:: 2017, The Authors, All Rights Reserved. | ||
|
||
### Remove the supervisor configuration for queue:work | ||
file "remove supervisor conf for #{node['laravel-artisan']['queue']['worker_name']}" do | ||
path "#{node['laravel-artisan']['supervisor']['conf_dir']}/#{node['laravel-artisan']['queue']['worker_name']}.conf" | ||
action :delete | ||
end | ||
|
||
### Stop supervisor | ||
service 'stop supervisor' do | ||
service_name 'supervisor' | ||
action :stop | ||
end | ||
|
||
### Start supervisor | ||
service 'start supervisor' do | ||
service_name 'supervisor' | ||
action :start | ||
end | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
# Start a laravel queue worker process. | ||
# | ||
# In order to run it as a service supervisor is installed and configured. | ||
# For more details see: | ||
# - https://laravel.com/docs/5.5/queues#supervisor-configuration | ||
# | ||
# | ||
# Cookbook:: laravel-artisan | ||
# Recipe:: queue_work | ||
# | ||
# Copyright:: 2017, The Authors, All Rights Reserved. | ||
|
||
include_recipe 'laravel-artisan::default' | ||
|
||
### Install and prepare supervisor | ||
include_recipe 'laravel-artisan::supervisor' | ||
|
||
template "create supervisor conf for #{node['laravel-artisan']['queue']['worker_name']}" do | ||
source 'supervisor.conf.erb' | ||
path "#{node['laravel-artisan']['supervisor']['conf_dir']}/#{node['laravel-artisan']['queue']['worker_name']}.conf" | ||
owner 'root' | ||
group 'root' | ||
mode '0644' | ||
variables node['laravel-artisan']['queue'] | ||
end | ||
|
||
### Stop the supervisor service | ||
service 'stop supervisor' do | ||
service_name 'supervisor' | ||
supports :stop => true, :status => true, :restart => true, :reload => true | ||
action :stop | ||
end | ||
|
||
### Start the supervisor service | ||
service 'start supervisor' do | ||
service_name 'supervisor' | ||
supports :start => true, :status => true, :restart => true, :reload => true | ||
action :start | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
# Install and prepare supervisor | ||
# | ||
# Cookbook:: laravel-artisan | ||
# Recipe:: supervisor | ||
# | ||
# Copyright:: 2017, The Authors, All Rights Reserved. | ||
|
||
### Install supervisor from package repository | ||
package 'supervisor' do | ||
action :install | ||
end | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,79 @@ | ||
; Program supervisor config file. | ||
; | ||
; For more information on the config file, please see: | ||
; http://supervisord.org/configuration.html | ||
; | ||
|
||
[program:<%= @worker_name %>] | ||
command=<%= @command %> ; the program (relative uses PATH, can take args) | ||
process_name=%(program_name)s_%(process_num)02d ; process_name expr (default %(program_name)s) | ||
numprocs=<%= @numprocs %> ; number of processes copies to start (def 1) | ||
;directory=/tmp ; directory to cwd to before exec (def no cwd) | ||
;umask=022 ; umask for process (default None) | ||
;priority=999 ; the relative start priority (default 999) | ||
autostart=<%= @autostart %> ; start at supervisord start (default: true) | ||
;startsecs=1 ; # of secs prog must stay up to be running (def. 1) | ||
;startretries=3 ; max # of serial start failures when starting (default 3) | ||
autorestart=<%= @autorestart %> ; when to restart if exited after running (def: unexpected) | ||
;exitcodes=0,2 ; 'expected' exit codes used with autorestart (default 0,2) | ||
;stopsignal=QUIT ; signal used to kill process (default TERM) | ||
;stopwaitsecs=10 ; max num secs to wait b4 SIGKILL (default 10) | ||
;stopasgroup=false ; send stop signal to the UNIX process group (default false) | ||
;killasgroup=false ; SIGKILL the UNIX process group (def false) | ||
user=<%= @user %> ; setuid to this UNIX account to run the program | ||
redirect_stderr=<%= @redirect_stderr %> ; redirect proc stderr to stdout (default false) | ||
stdout_logfile=<%= @stdout_logfile %> ; stdout log path, NONE for none; default AUTO | ||
;stdout_logfile_maxbytes=1MB ; max # logfile bytes b4 rotation (default 50MB) | ||
;stdout_logfile_backups=10 ; # of stdout logfile backups (0 means none, default 10) | ||
;stdout_capture_maxbytes=1MB ; number of bytes in 'capturemode' (default 0) | ||
;stdout_events_enabled=false ; emit events on stdout writes (default false) | ||
;stderr_logfile=/a/path ; stderr log path, NONE for none; default AUTO | ||
;stderr_logfile_maxbytes=1MB ; max # logfile bytes b4 rotation (default 50MB) | ||
;stderr_logfile_backups=10 ; # of stderr logfile backups (0 means none, default 10) | ||
;stderr_capture_maxbytes=1MB ; number of bytes in 'capturemode' (default 0) | ||
;stderr_events_enabled=false ; emit events on stderr writes (default false) | ||
;environment=A="1",B="2" ; process environment additions (def no adds) | ||
;serverurl=AUTO ; override serverurl computation (childutils) | ||
|
||
; The sample eventlistener section below shows all possible eventlistener | ||
; subsection values. Create one or more 'real' eventlistener: sections to be | ||
; able to handle event notifications sent by supervisord. | ||
|
||
;[eventlistener:theeventlistenername] | ||
;command=/bin/eventlistener ; the program (relative uses PATH, can take args) | ||
;process_name=%(program_name)s ; process_name expr (default %(program_name)s) | ||
;numprocs=1 ; number of processes copies to start (def 1) | ||
;events=EVENT ; event notif. types to subscribe to (req'd) | ||
;buffer_size=10 ; event buffer queue size (default 10) | ||
;directory=/tmp ; directory to cwd to before exec (def no cwd) | ||
;umask=022 ; umask for process (default None) | ||
;priority=-1 ; the relative start priority (default -1) | ||
;autostart=true ; start at supervisord start (default: true) | ||
;startsecs=1 ; # of secs prog must stay up to be running (def. 1) | ||
;startretries=3 ; max # of serial start failures when starting (default 3) | ||
;autorestart=unexpected ; autorestart if exited after running (def: unexpected) | ||
;exitcodes=0,2 ; 'expected' exit codes used with autorestart (default 0,2) | ||
;stopsignal=QUIT ; signal used to kill process (default TERM) | ||
;stopwaitsecs=10 ; max num secs to wait b4 SIGKILL (default 10) | ||
;stopasgroup=false ; send stop signal to the UNIX process group (default false) | ||
;killasgroup=false ; SIGKILL the UNIX process group (def false) | ||
;user=chrism ; setuid to this UNIX account to run the program | ||
;redirect_stderr=false ; redirect_stderr=true is not allowed for eventlisteners | ||
;stdout_logfile=/a/path ; stdout log path, NONE for none; default AUTO | ||
;stdout_logfile_maxbytes=1MB ; max # logfile bytes b4 rotation (default 50MB) | ||
;stdout_logfile_backups=10 ; # of stdout logfile backups (0 means none, default 10) | ||
;stdout_events_enabled=false ; emit events on stdout writes (default false) | ||
;stderr_logfile=/a/path ; stderr log path, NONE for none; default AUTO | ||
;stderr_logfile_maxbytes=1MB ; max # logfile bytes b4 rotation (default 50MB) | ||
;stderr_logfile_backups=10 ; # of stderr logfile backups (0 means none, default 10) | ||
;stderr_events_enabled=false ; emit events on stderr writes (default false) | ||
;environment=A="1",B="2" ; process environment additions | ||
;serverurl=AUTO ; override serverurl computation (childutils) | ||
|
||
; The sample group section below shows all possible group values. Create one | ||
; or more 'real' group: sections to create "heterogeneous" process groups. | ||
|
||
;[group:thegroupname] | ||
;programs=progname1,progname2 ; each refers to 'x' in [program:x] definitions | ||
;priority=999 ; the relative start priority (default 999) | ||
|