How to upgrade from zammad4.1.0 with postgresql9.2?

Infos:

  • Used Zammad version: 4.1.0
  • Used Zammad installation type: package
  • Operating system: centos7
  • Browser + version: chrome(version not related)

Since zammad 5+ not support old postgresql, we tried upgrade postgresql from 9.2 to 13 firstly using pg_dump and psql restore. But zammad 5.1 failed to take advantage of these old database data.
We also tried to using zammad_backup.sh to backup zammad4.1 itself, then init a clean postgresql13 database, upgrade zammad to 5.1 and finally using zammad_restore.sh to recover data. But zammad_restore.sh also failed and report something like:

# Restoring Files
# Ensuring correct file permissions ...
# Clearing Cache ...
/opt/zammad/vendor/bundle/ruby/2.6.0/gems/railties-5.2.4.6/lib/rails/railtie/configuration.rb:97:in `method_missing': undefined method `websocket_session_store' for #<Rails::Application::Configuration:0x000055b36b617668> (NoMethodError)
        from /opt/zammad/config/initializers/log_websocket_session_store.rb:3:in `<main>'
        from /opt/zammad/vendor/bundle/ruby/2.6.0/gems/bootsnap-1.3.2/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:50:in `load'
        from /opt/zammad/vendor/bundle/ruby/2.6.0/gems/bootsnap-1.3.2/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:50:in `load'
        from /opt/zammad/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.4.6/lib/active_support/dependencies.rb:285:in `block in load'
        from /opt/zammad/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.4.6/lib/active_support/dependencies.rb:257:in `load_dependency'
        from /opt/zammad/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.4.6/lib/active_support/dependencies.rb:285:in `load'
        from /opt/zammad/vendor/bundle/ruby/2.6.0/gems/railties-5.2.4.6/lib/rails/engine.rb:663:in `block in load_config_initializer'
        from /opt/zammad/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.4.6/lib/active_support/notifications.rb:170:in `instrument'
        from /opt/zammad/vendor/bundle/ruby/2.6.0/gems/railties-5.2.4.6/lib/rails/engine.rb:662:in `load_config_initializer'
        from /opt/zammad/vendor/bundle/ruby/2.6.0/gems/railties-5.2.4.6/lib/rails/engine.rb:620:in `block (2 levels) in <class:Engine>'
        from /opt/zammad/vendor/bundle/ruby/2.6.0/gems/railties-5.2.4.6/lib/rails/engine.rb:619:in `each'
        from /opt/zammad/vendor/bundle/ruby/2.6.0/gems/railties-5.2.4.6/lib/rails/engine.rb:619:in `block in <class:Engine>'
        from /opt/zammad/vendor/bundle/ruby/2.6.0/gems/railties-5.2.4.6/lib/rails/initializable.rb:32:in `instance_exec'
        from /opt/zammad/vendor/bundle/ruby/2.6.0/gems/railties-5.2.4.6/lib/rails/initializable.rb:32:in `run'
        from /opt/zammad/vendor/bundle/ruby/2.6.0/gems/railties-5.2.4.6/lib/rails/initializable.rb:61:in `block in run_initializers'
        from /opt/zammad/vendor/ruby-2.6.8/lib/ruby/2.6.0/tsort.rb:228:in `block in tsort_each'
        from /opt/zammad/vendor/ruby-2.6.8/lib/ruby/2.6.0/tsort.rb:350:in `block (2 levels) in each_strongly_connected_component'
        from /opt/zammad/vendor/ruby-2.6.8/lib/ruby/2.6.0/tsort.rb:422:in `block (2 levels) in each_strongly_connected_component_from'
        from /opt/zammad/vendor/ruby-2.6.8/lib/ruby/2.6.0/tsort.rb:431:in `each_strongly_connected_component_from'
        from /opt/zammad/vendor/ruby-2.6.8/lib/ruby/2.6.0/tsort.rb:421:in `block in each_strongly_connected_component_from'
        from /opt/zammad/vendor/bundle/ruby/2.6.0/gems/railties-5.2.4.6/lib/rails/initializable.rb:50:in `each'
        from /opt/zammad/vendor/bundle/ruby/2.6.0/gems/railties-5.2.4.6/lib/rails/initializable.rb:50:in `tsort_each_child'
        from /opt/zammad/vendor/ruby-2.6.8/lib/ruby/2.6.0/tsort.rb:415:in `call'
        from /opt/zammad/vendor/ruby-2.6.8/lib/ruby/2.6.0/tsort.rb:415:in `each_strongly_connected_component_from'
        from /opt/zammad/vendor/ruby-2.6.8/lib/ruby/2.6.0/tsort.rb:349:in `block in each_strongly_connected_component'
        from /opt/zammad/vendor/ruby-2.6.8/lib/ruby/2.6.0/tsort.rb:347:in `each'
        from /opt/zammad/vendor/ruby-2.6.8/lib/ruby/2.6.0/tsort.rb:347:in `call'
        from /opt/zammad/vendor/ruby-2.6.8/lib/ruby/2.6.0/tsort.rb:347:in `each_strongly_connected_component'
        from /opt/zammad/vendor/ruby-2.6.8/lib/ruby/2.6.0/tsort.rb:226:in `tsort_each'
        from /opt/zammad/vendor/ruby-2.6.8/lib/ruby/2.6.0/tsort.rb:205:in `tsort_each'
        from /opt/zammad/vendor/bundle/ruby/2.6.0/gems/railties-5.2.4.6/lib/rails/initializable.rb:60:in `run_initializers'
        from /opt/zammad/vendor/bundle/ruby/2.6.0/gems/railties-5.2.4.6/lib/rails/application.rb:361:in `initialize!'
        from /opt/zammad/config/environment.rb:5:in `<main>'
        from /opt/zammad/vendor/bundle/ruby/2.6.0/gems/bootsnap-1.3.2/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:21:in `require'
        from /opt/zammad/vendor/bundle/ruby/2.6.0/gems/bootsnap-1.3.2/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:21:in `block in require_with_bootsnap_lfi'
        from /opt/zammad/vendor/bundle/ruby/2.6.0/gems/bootsnap-1.3.2/lib/bootsnap/load_path_cache/loaded_features_index.rb:65:in `register'
        from /opt/zammad/vendor/bundle/ruby/2.6.0/gems/bootsnap-1.3.2/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:20:in `require_with_bootsnap_lfi'
        from /opt/zammad/vendor/bundle/ruby/2.6.0/gems/bootsnap-1.3.2/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:29:in `require'
        from /opt/zammad/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.4.6/lib/active_support/dependencies.rb:291:in `block in require'
        from /opt/zammad/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.4.6/lib/active_support/dependencies.rb:257:in `load_dependency'
        from /opt/zammad/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.4.6/lib/active_support/dependencies.rb:291:in `require'
        from /opt/zammad/vendor/bundle/ruby/2.6.0/gems/railties-5.2.4.6/lib/rails/application.rb:337:in `require_environment!'
        from /opt/zammad/vendor/bundle/ruby/2.6.0/gems/railties-5.2.4.6/lib/rails/command/actions.rb:28:in `require_environment!'
        from /opt/zammad/vendor/bundle/ruby/2.6.0/gems/railties-5.2.4.6/lib/rails/command/actions.rb:15:in `require_application_and_environment!'
        from /opt/zammad/vendor/bundle/ruby/2.6.0/gems/railties-5.2.4.6/lib/rails/commands/runner/runner_command.rb:29:in `perform'
        from /opt/zammad/vendor/bundle/ruby/2.6.0/gems/thor-1.1.0/lib/thor/command.rb:27:in `run'
        from /opt/zammad/vendor/bundle/ruby/2.6.0/gems/thor-1.1.0/lib/thor/invocation.rb:127:in `invoke_command'
        from /opt/zammad/vendor/bundle/ruby/2.6.0/gems/thor-1.1.0/lib/thor.rb:392:in `dispatch'
        from /opt/zammad/vendor/bundle/ruby/2.6.0/gems/railties-5.2.4.6/lib/rails/command/base.rb:69:in `perform'
        from /opt/zammad/vendor/bundle/ruby/2.6.0/gems/railties-5.2.4.6/lib/rails/command.rb:46:in `invoke'
        from /opt/zammad/vendor/bundle/ruby/2.6.0/gems/railties-5.2.4.6/lib/rails/commands.rb:18:in `<main>'
        from /opt/zammad/vendor/bundle/ruby/2.6.0/gems/bootsnap-1.3.2/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:21:in `require'
        from /opt/zammad/vendor/bundle/ruby/2.6.0/gems/bootsnap-1.3.2/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:21:in `block in require_with_bootsnap_lfi'
        from /opt/zammad/vendor/bundle/ruby/2.6.0/gems/bootsnap-1.3.2/lib/bootsnap/load_path_cache/loaded_features_index.rb:65:in `register'
        from /opt/zammad/vendor/bundle/ruby/2.6.0/gems/bootsnap-1.3.2/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:20:in `require_with_bootsnap_lfi'
        from /opt/zammad/vendor/bundle/ruby/2.6.0/gems/bootsnap-1.3.2/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:29:in `require'
        from /opt/zammad/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.4.6/lib/active_support/dependencies.rb:291:in `block in require'
        from /opt/zammad/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.4.6/lib/active_support/dependencies.rb:257:in `load_dependency'
        from /opt/zammad/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.4.6/lib/active_support/dependencies.rb:291:in `require'
        from /opt/zammad/bin/rails:9:in `<main>'
./zammad_restore.sh: line 37: ore: command not found

So what is the correct way to upgrade both zammad and postgresql?
By the way our elasticsearch is 7.17.4.

I upgraded my Zammad instance from 4.x to 5.x, had the same issue as you. I followed the guide here: CentOS: Upgrade PostgreSQL from 9.2 to 9.6 – Blog of Kliment Andreev – A place so I won't forget things
The idea is just upgrade pg and use the pg_upgrade command to migrate the database files.
After the upgrade of PG, then upgrade Zammad. I got a few errors after successfully upgraded Zammad. In the end, I used the command to migrate the db:

zammad run rake db :migrate

in short, upgrade PG, then Zammad. my case not sure why the db could not migrate by the script, it was fixed by running the above command.

good luck!

Well, you remind me that stay in postgresql 9 with only minor version upgrade may be a shortcut. I tried to upgrade psql over major version along with zammad.
So can we conclude that zammad doesn’t support upgrade over different psql major version?

It does.
However, you can’t upgrade your database server and Zammad at the same time.

Stop zammad, upgrade your database server before, ensure everything works as expected (removing the old version of pgsql should be fine if you did everything correctly) and then upgrade Zammad.

This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.