This repository has been archived by the owner on Apr 6, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 53
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
0 parents
commit e348e6a
Showing
7 changed files
with
183 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
source "http://www.rubygems.org" | ||
|
||
gemspec |
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,23 @@ | ||
LICENSE | ||
|
||
The MIT License | ||
|
||
Copyright (c) 2012 Nadarei, Inc. | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in | ||
all copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN | ||
THE SOFTWARE. |
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,49 @@ | ||
# mina-sidekiq | ||
|
||
mina-sidekiq is a gem that adds tasks to aid in the deployment of [Sidekiq] (http://mperham.github.com/sidekiq/) | ||
using [Mina] (http://nadarei.co/mina). | ||
|
||
# Getting Start | ||
|
||
## Installation | ||
|
||
gem install mina-sidekiq | ||
|
||
## Example | ||
|
||
require 'mina-sidekiq' | ||
... | ||
|
||
task :deploy => :enviroment do | ||
deploy do | ||
# stop accepting new workers | ||
invoke :'sidekiq:quiet' | ||
invoke :'git:clone' | ||
... | ||
|
||
to :launch do | ||
... | ||
invoke :'sidekiq:restart' | ||
end | ||
end | ||
end | ||
|
||
## Available Tasks | ||
|
||
* sidekiq:stop | ||
* sidekiq:start | ||
* sidekiq:restart | ||
* sidekiq:quiet | ||
|
||
## Available Options | ||
|
||
* sidekiq: Sets the path to sidekiq. | ||
* sidekiqctl: Sets the path to sidekiqctl. | ||
* sidekiq\_timeout: Sets a upper limit of time a worker is allowed to finish, before it is killed. | ||
* sidekiq\_log: Sets the path to the log file of sidekiq | ||
* sidekiq\_pid: Sets the path to the pid file of a sidekiq worker | ||
|
||
## Copyright | ||
|
||
Copyright (c) 2013 Jörg Thalheim http://higgsboson.tk/joerg | ||
See LICENSE for further details. |
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 @@ | ||
0.1.0 |
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 @@ | ||
require "mina-sidekiq/sidekiq" |
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,88 @@ | ||
# # Modules: Sidekiq | ||
# Adds settings and tasks for managing Sidekiq workers. | ||
# | ||
# ## Usage example | ||
# require 'mina/sidekiq' | ||
# ... | ||
# | ||
# task :deploy => :enviroment do | ||
# deploy do | ||
# invoke :'sidekiq:quiet' | ||
# invoke :'git:clone' | ||
# ... | ||
# | ||
# to :launch do | ||
# ... | ||
# invoke :'sidekiq:restart' | ||
# end | ||
# end | ||
# end | ||
|
||
require 'mina/bundler' | ||
require 'mina/rails' | ||
|
||
# ## Settings | ||
# Any and all of these settings can be overriden in your `deploy.rb`. | ||
|
||
# ### sidekiq | ||
# Sets the path to sidekiq. | ||
set_default :sidekiq, lambda { "#{bundle_bin} exec sidekiq" } | ||
|
||
# ### sidekiqctl | ||
# Sets the path to sidekiqctl. | ||
set_default :sidekiqctl, lambda { "#{bundle_prefix} sidekiqctl" } | ||
|
||
# ### sidekiq_timeout | ||
# Sets a upper limit of time a worker is allowed to finish, before it is killed. | ||
set_default :sidekiq_timeout, 10 | ||
|
||
# ### sidekiq_config | ||
# Sets the path to the configuration file of sidekiq | ||
set_default :sidekiq_config, "./config/sidekiq.yml" | ||
|
||
# ### sidekiq_log | ||
# Sets the path to the log file of sidekiq | ||
# | ||
# To disable logging set it to "/dev/null" | ||
set_default :sidekiq_log, "./log/sidekiq.log" | ||
|
||
# ### sidekiq_pid | ||
# Sets the path to the pid file of a sidekiq worker | ||
set_default :sidekiq_pid, lambda { "#{deploy_to}/#{shared_path}/pids/sidekiq.pid" } | ||
|
||
# ## Control Tasks | ||
namespace :sidekiq do | ||
# ### sidekiq:quiet | ||
desc "Quiet sidekiq (stop accepting new work)" | ||
task :quiet do | ||
queue %{ if [ -f #{sidekiq_pid} ]; then | ||
echo "-----> Quiet sidekiq (stop accepting new work)" | ||
#{echo_cmd %{(cd #{deploy_to}/#{current_path} && #{sidekiqctl} quiet #{sidekiq_pid})} } | ||
fi } | ||
end | ||
|
||
# ### sidekiq:stop | ||
desc "Stop sidekiq" | ||
task :stop do | ||
queue %[ if [ -f #{sidekiq_pid} ]; then | ||
echo "-----> Stop sidekiq" | ||
#{echo_cmd %[(cd #{deploy_to}/#{current_path} && #{sidekiqctl} stop #{sidekiq_pid} #{sidekiq_timeout})]} | ||
fi ] | ||
end | ||
|
||
# ### sidekiq:start | ||
desc "Start sidekiq" | ||
task :start do | ||
queue %{ | ||
echo "-----> Start sidekiq" | ||
#{echo_cmd %[(cd #{deploy_to}/#{current_path}; nohup #{sidekiq} -e #{rails_env} -C #{sidekiq_config} -P #{sidekiq_pid} >> #{sidekiq_log} 2>&1 </dev/null &) ] } | ||
} | ||
end | ||
|
||
# ### sidekiq:restart | ||
desc "Restart sidekiq" | ||
task :restart do | ||
invoke :'sidekiq:stop' | ||
invoke :'sidekiq:start' | ||
end | ||
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,18 @@ | ||
# -*- encoding: utf-8 -*- | ||
|
||
Gem::Specification.new do |s| | ||
s.name = "mina-sidekiq" | ||
s.version = File.read('VERSION') | ||
s.authors = ["Joerg Thalheim"] | ||
s.email = ["joerg@higgsboson.tk"] | ||
s.homepage = "http://github.com/Mic92/mina-sidekiq" | ||
s.summary = "Tasks to deploy Sidekiq with mina." | ||
s.description = "Tasks to deploy Sidekiq with mina." | ||
|
||
s.files = `git ls-files`.split("\n") | ||
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n") | ||
s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) } | ||
s.require_paths = ["lib"] | ||
|
||
s.add_runtime_dependency "mina" | ||
end |