[Git][noosfero/noosfero][master] 0-downtime upgrades with the Debian package

Antonio Terceiro gitlab at mg.gitlab.com
Fri Nov 27 19:13:00 BRST 2015


Antonio Terceiro pushed to branch master at Noosfero / noosfero


Commits:
e65387e7 by Antonio Terceiro at 2015-11-27T19:12:12Z
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.

- - - - -


3 changed files:

- config/environments/production.rb
- debian/noosfero.prerm
- debian/rules


Changes:

=====================================
config/environments/production.rb
=====================================
--- a/config/environments/production.rb
+++ b/config/environments/production.rb
@@ -44,7 +44,7 @@ Noosfero::Application.configure do
   # config.logger = ActiveSupport::TaggedLogging.new(SyslogLogger.new)
 
   # Use a different cache store in production
-  config.cache_store = :dalli_store, "127.0.0.1:11211"
+  config.cache_store = :dalli_store, "127.0.0.1:11211", { :namespace => "noosfero/#{Noosfero::VERSION}" }
 
   # Enable serving of images, stylesheets, and javascripts from an asset server
   # config.action_controller.asset_host                  = "http://assets.example.com"


=====================================
debian/noosfero.prerm
=====================================
--- a/debian/noosfero.prerm
+++ b/debian/noosfero.prerm
@@ -8,14 +8,7 @@ dbc_go noosfero $@
 
 #DEBHELPER#
 
-# some dirty work is needed after Noosfero is stopped
 if [ "$1" = "upgrade" ]; then
-  # delete cached files
-  rm -f /var/lib/noosfero-data/cache/*
-
-  # restart memcache
-  invoke-rc.d memcached restart
-
   # stop debconf to avoid the problem with infinite hanging, cfe
   # http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=295477
   db_stop


=====================================
debian/rules
=====================================
--- a/debian/rules
+++ b/debian/rules
@@ -25,7 +25,7 @@ override_dh_auto_install:
 	debian/filter-gemfile > $(CURDIR)/debian/noosfero/usr/share/noosfero/Gemfile
 
 override_dh_installinit:
-	dh_installinit -pnoosfero --onlyscripts
+	dh_installinit -pnoosfero --onlyscripts --restart-after-upgrade
 
 override_dh_clean:
 	dh_clean



View it on GitLab: https://gitlab.com/noosfero/noosfero/commit/e65387e7408406ad977b1a583364c3fa90e3bace
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://listas.softwarelivre.org/pipermail/noosfero-dev/attachments/20151127/a4c92a83/attachment.html>


More information about the Noosfero-dev mailing list