-
-
Save mpapis/7206121 to your computer and use it in GitHub Desktop.
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
nick ALL=NOPASSWD:/sbin/start foo,/sbin/stop foo,/sbin restart foo,/sbin/service foo start,/sbin/service foo stop,/sbin/service foo restart,/home/nick/.rvm/wrappers/foo/foreman |
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
desc "Restart application" | |
task :restart do | |
on roles(:app) do | |
execute :rvm, "alias create #{fetch(:application)} #{fetch(:rvm_ruby_version)}" | |
execute :rvm, "wrapper #{fetch(:application)} --no-links bundle" | |
#invoke "foreman:export" # <-- this does not work in cap v3 | |
execute "sudo /home/nick/.rvm/wrappers/my_app/bundle exec foreman export upstart /etc/init -e #{fetch(:rails_env)} -a #{fetch(:application)} -u #{fetch(:user)} -l /var/#{fetch(:application)}/log" | |
# on OS X the equivalent pid-finding command is `ps | grep '/puma' | head -n 1 | awk {'print $1'}` | |
execute "(kill -s SIGUSR1 $(ps -C ruby -F | grep '/puma' | awk {'print $2'})) || sudo service #{fetch(:application)} restart" | |
# foreman.restart # uncomment this (and comment line above) if we need to read changes to the procfile | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment