Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
C
capistrano-sneakers
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
ikcrm_common
capistrano-sneakers
Commits
a6c41c00
Commit
a6c41c00
authored
Mar 10, 2015
by
Karl Kloppenborg
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Adding in worker support
parent
6ada9cf5
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
35 additions
and
23 deletions
+35
-23
lib/capistrano/tasks/sneakers.rb
+35
-23
No files found.
lib/capistrano/tasks/sneakers.rb
View file @
a6c41c00
...
@@ -9,6 +9,8 @@ namespace :load do
...
@@ -9,6 +9,8 @@ namespace :load do
# set :sneakers_timeout, -> { 10 }
# set :sneakers_timeout, -> { 10 }
set
:sneakers_role
,
->
{
:app
}
set
:sneakers_role
,
->
{
:app
}
set
:sneakers_processes
,
->
{
1
}
set
:sneakers_processes
,
->
{
1
}
set
:sneakers_workers
,
->
{
false
}
# if this is false it will cause Capistrano to exit
set
:sneakers_run_config
,
->
{
false
}
# if this is true sneakers will run with preconfigured /config/initializers/sneakers.rb
# Rbenv and RVM integration
# Rbenv and RVM integration
set
:rbenv_map_bins
,
fetch
(
:rbenv_map_bins
).
to_a
.
concat
(
%w(sneakers)
)
set
:rbenv_map_bins
,
fetch
(
:rbenv_map_bins
).
to_a
.
concat
(
%w(sneakers)
)
set
:rvm_map_bins
,
fetch
(
:rvm_map_bins
).
to_a
.
concat
(
%w(sneakers)
)
set
:rvm_map_bins
,
fetch
(
:rvm_map_bins
).
to_a
.
concat
(
%w(sneakers)
)
...
@@ -86,31 +88,41 @@ namespace :sneakers do
...
@@ -86,31 +88,41 @@ namespace :sneakers do
def
start_sneakers
(
pid_file
,
idx
=
0
)
def
start_sneakers
(
pid_file
,
idx
=
0
)
args
=
[]
args
=
[]
args
.
push
"--index
#{
idx
}
"
if
fetch
(
:sneakers_run_config
)
==
true
args
.
push
"--pidfile
#{
pid_file
}
"
# Use sneakers configuration prebuilt in
args
.
push
"--environment
#{
fetch
(
:sneakers_env
)
}
"
raise
"[ set :workers, ['worker1', 'workerN'] ] not configured properly, please configure the workers you wish to use"
if
fetch
(
:sneakers_workers
).
nil?
or
!
fetch
(
:sneakers_workers
).
kind_of
Array
args
.
push
"--logfile
#{
fetch
(
:sneakers_log
)
}
"
if
fetch
(
:sneakers_log
)
args
.
push
"--require
#{
fetch
(
:sneakers_require
)
}
"
if
fetch
(
:sneakers_require
)
args
.
push
"--tag
#{
fetch
(
:sneakers_tag
)
}
"
if
fetch
(
:sneakers_tag
)
Array
(
fetch
(
:sneakers_queue
)).
each
do
|
queue
|
args
.
push
"--queue
#{
queue
}
"
end
args
.
push
"--config
#{
fetch
(
:sneakers_config
)
}
"
if
fetch
(
:sneakers_config
)
args
.
push
"--concurrency
#{
fetch
(
:sneakers_concurrency
)
}
"
if
fetch
(
:sneakers_concurrency
)
# use sneakers_options for special options
args
.
push
fetch
(
:sneakers_options
)
if
fetch
(
:sneakers_options
)
if
defined?
(
JRUBY_VERSION
)
args
.
push
'>/dev/null 2>&1 &'
warn
'Since JRuby doesn\'t support Process.daemon, sneakers will not be running as a daemon.'
else
args
.
push
'--daemon'
end
if
fetch
(
:start_sneakers_in_background
,
fetch
(
:sneakers_run_in_background
))
workers
=
fetch
(
:sneakers_workers
).
compact
.
join
(
','
)
background
:bundle
,
:exec
,
:sneakers
,
args
.
compact
.
join
(
' '
)
raise
"Workers =
#{
workers
}
"
else
execute
:bundle
,
:exec
,
:sneakers
,
args
.
compact
.
join
(
' '
)
execute
:bundle
,
:exec
,
:sneakers
,
args
.
compact
.
join
(
' '
)
else
# Using custom sneakers setup
args
.
push
"--index
#{
idx
}
"
args
.
push
"--pidfile
#{
pid_file
}
"
args
.
push
"--environment
#{
fetch
(
:sneakers_env
)
}
"
args
.
push
"--logfile
#{
fetch
(
:sneakers_log
)
}
"
if
fetch
(
:sneakers_log
)
args
.
push
"--require
#{
fetch
(
:sneakers_require
)
}
"
if
fetch
(
:sneakers_require
)
args
.
push
"--tag
#{
fetch
(
:sneakers_tag
)
}
"
if
fetch
(
:sneakers_tag
)
Array
(
fetch
(
:sneakers_queue
)).
each
do
|
queue
|
args
.
push
"--queue
#{
queue
}
"
end
args
.
push
"--config
#{
fetch
(
:sneakers_config
)
}
"
if
fetch
(
:sneakers_config
)
args
.
push
"--concurrency
#{
fetch
(
:sneakers_concurrency
)
}
"
if
fetch
(
:sneakers_concurrency
)
# use sneakers_options for special options
args
.
push
fetch
(
:sneakers_options
)
if
fetch
(
:sneakers_options
)
if
defined?
(
JRUBY_VERSION
)
args
.
push
'>/dev/null 2>&1 &'
warn
'Since JRuby doesn\'t support Process.daemon, sneakers will not be running as a daemon.'
else
args
.
push
'--daemon'
end
if
fetch
(
:start_sneakers_in_background
,
fetch
(
:sneakers_run_in_background
))
background
:bundle
,
:exec
,
:sneakers
,
args
.
compact
.
join
(
' '
)
else
execute
:bundle
,
:exec
,
:sneakers
,
args
.
compact
.
join
(
' '
)
end
end
end
end
end
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment