Commit e65387e7408406ad977b1a583364c3fa90e3bace

Authored by Antonio Terceiro
1 parent 0ee683a4

0-downtime upgrades with the Debian package

Instead of stopping the service, running migrations etc (those take
time), and then starting again, let's only restart the service after the
uprada has already happened. Now that we are using unicorn, which
supports restarting with dropping connections, with this we should have
0 downtime upgrades.

Also removed some unecessary buts deom debian/noosfero.prerm:

- remove restarting of memcached, which is broken behavior as it could
  affect other services using memcached. Just set a namespace for our
  cache keys, and all caches will be automatically invalidated when the
  application is restarted after an upgrade with a new version number

- remove removal of cache/*, since script/production already does that.

NOTE: since this behavior change depends on changes to the prerm
script, this won't take effect until the next upgrade _after_ the
upgrade to first version including this change.
config/environments/production.rb
... ... @@ -44,7 +44,7 @@ Noosfero::Application.configure do
44 44 # config.logger = ActiveSupport::TaggedLogging.new(SyslogLogger.new)
45 45  
46 46 # Use a different cache store in production
47   - config.cache_store = :dalli_store, "127.0.0.1:11211"
  47 + config.cache_store = :dalli_store, "127.0.0.1:11211", { :namespace => "noosfero/#{Noosfero::VERSION}" }
48 48  
49 49 # Enable serving of images, stylesheets, and javascripts from an asset server
50 50 # config.action_controller.asset_host = "http://assets.example.com"
... ...
debian/noosfero.prerm
... ... @@ -8,14 +8,7 @@ dbc_go noosfero $@
8 8  
9 9 #DEBHELPER#
10 10  
11   -# some dirty work is needed after Noosfero is stopped
12 11 if [ "$1" = "upgrade" ]; then
13   - # delete cached files
14   - rm -f /var/lib/noosfero-data/cache/*
15   -
16   - # restart memcache
17   - invoke-rc.d memcached restart
18   -
19 12 # stop debconf to avoid the problem with infinite hanging, cfe
20 13 # http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=295477
21 14 db_stop
... ...
debian/rules
... ... @@ -25,7 +25,7 @@ override_dh_auto_install:
25 25 debian/filter-gemfile > $(CURDIR)/debian/noosfero/usr/share/noosfero/Gemfile
26 26  
27 27 override_dh_installinit:
28   - dh_installinit -pnoosfero --onlyscripts
  28 + dh_installinit -pnoosfero --onlyscripts --restart-after-upgrade
29 29  
30 30 override_dh_clean:
31 31 dh_clean
... ...