Created
April 29, 2014 18:25
-
-
Save hisea/11408178 to your computer and use it in GitHub Desktop.
Puma deploy task for mina.
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
# 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