Commit 585963ae1f48474605aa7f991a63d3a9d16bb1d4
1 parent
7e1172c4
Exists in
master
and in
27 other branches
Restart with zero downtime
Showing
2 changed files
with
16 additions
and
5 deletions
Show diff stats
etc/init.d/noosfero
script/production
| ... | ... | @@ -45,6 +45,16 @@ do_stop() { |
| 45 | 45 | stop_via_pid_file tmp/pids/delayed_job.pid tmp/pids/delayed_job.*.pid tmp/pids/feed-updater.*.pid |
| 46 | 46 | } |
| 47 | 47 | |
| 48 | +do_restart() { | |
| 49 | + rake db:migrate SCHEMA=/dev/null | |
| 50 | + environments_loop stop || | |
| 51 | + stop_via_pid_file tmp/pids/delayed_job.pid tmp/pids/delayed_job.*.pid tmp/pids/feed-updater.*.pid | |
| 52 | + environments_loop start | |
| 53 | + | |
| 54 | + clear_cache | |
| 55 | + ruby -S thin -C config/thin.yml restart --onebyone | |
| 56 | +} | |
| 57 | + | |
| 48 | 58 | stop_via_pid_file() { |
| 49 | 59 | for pidfile in $@; do |
| 50 | 60 | if [ -e "$pidfile" ]; then |
| ... | ... | @@ -84,9 +94,7 @@ case "$ACTION" in |
| 84 | 94 | ;; |
| 85 | 95 | |
| 86 | 96 | restart) |
| 87 | - do_stop | |
| 88 | - sleep 1 | |
| 89 | - do_start | |
| 97 | + do_restart | |
| 90 | 98 | ;; |
| 91 | 99 | |
| 92 | 100 | *) | ... | ... |