Created
October 28, 2013 22:38
-
-
Save anonymous/7206059 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
╰─$ cap staging deploy:restart | |
INFO [0efe436a] Running PATH=$PATH:~/.rvm/bin/ rvmsudo foreman export upstart /etc/init -e staging -a foo -u nick -l /var/foo/log on localhost | |
DEBUG [0efe436a] Command: PATH=$PATH:~/.rvm/bin/ rvmsudo foreman export upstart /etc/init -e staging -a foo -u nick -l /var/foo/log | |
DEBUG [0efe436a] Warning: can not check `/etc/sudoers` for `secure_path`, falling back to call via `/usr/bin/env`, this breaks rules from `/etc/sudoers`. Run: | |
DEBUG [0efe436a] | |
DEBUG [0efe436a] export rvmsudo_secure_path=1 | |
DEBUG [0efe436a] | |
DEBUG [0efe436a] to avoid the warning, put it in shell initialization file to make it persistent. | |
DEBUG [0efe436a] | |
DEBUG [0efe436a] In case there is no `secure_path` in `/etc/sudoers`. Run: | |
DEBUG [0efe436a] | |
DEBUG [0efe436a] export rvmsudo_secure_path=0 | |
DEBUG [0efe436a] | |
DEBUG [0efe436a] to avoid the warning, put it in shell initialization file to make it persistent. | |
DEBUG [0efe436a] [sudo] password for nick: | |
^ hangs forever |
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/bin/rvmsudo 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 | |
#invoke "foreman:export" # <-- this does not work in cap v3 | |
# cmd won't run without prepending the path | |
execute "PATH=$PATH:~/.rvm/bin/ rvmsudo 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