Created
November 2, 2014 16:20
-
-
Save caok/64acd97d224565ed3d7d to your computer and use it in GitHub Desktop.
puma for mina
This file contains hidden or 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
# Puma | |
# ============================================================================== | |
namespace :puma do | |
set :puma_pid, "#{app_path}/tmp/pids/puma.pid" | |
set :start_puma, %{ | |
cd #{app_path} | |
bundle exec puma --config #{app_path}/config/puma.rb --environment #{rails_env} | |
} | |
# Start task | |
# ------------------------------------------------------------------------------ | |
desc "Start Puma" | |
task :start => :environment do | |
queue 'echo "-----> Start Puma"' | |
queue! start_puma | |
end | |
# Stop task | |
# ------------------------------------------------------------------------------ | |
desc "Stop Puma" | |
task :stop do | |
queue 'echo "-----> Stop Puma"' | |
queue! %{ | |
test -s "#{puma_pid}" && kill -QUIT `cat "#{puma_pid}"` && echo "Stop Ok" && exit 0 | |
echo >&2 "Not running" | |
} | |
end | |
# Restart task | |
# ------------------------------------------------------------------------------ | |
desc "Restart Puma using 'upgrade'" | |
task :restart => :environment do | |
invoke 'puma:stop' | |
invoke 'puma:start' | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment