Zammad Migration 3.6.x -> 4.1.0 502 Bad Gateway / DB & Ruby Errors

Hi,

I was tasked to check if an update from our 3.6.x production to the latest version (4.1.0) works, thus I set up a test system, installed the latest version and tried to restore our current production backup file but was unable to do so. Maybe I’m also approaching this the wrong way? Would it be better to restore a 3.6.x backup to a 3.6.x test-system and then try to upgrade?

  • Used Zammad version:
    zammad-4.1.0-1625488657.bb7d5010.centos7.x86_64
  • Used Zammad installation type: (source, package, docker-compose, …)
    Package
  • Operating system:
    Centos 7 (core)
  • Browser + version:
    all browsers / all versions

Expected behavior:

  • Restore works

Actual behavior:

  • Restore returns multiple errors (below) but script returns “successfully finished”.
[root@zammad-test backup]# ./zammad_restore.sh

# Zammad restored started - Wed Jul  7 12:47:54 CEST 2021!

The restore will delete your current config and database!
Be sure to have a backup available!

Enter 'yes' if you want to proceed!
Restore?: yes
Enter file date to restore:
20210628210002
File date: 20210628210002
Enter db date to restore:
20210628210002
DB date: 20210628210002
# Stopping Zammad
# Checking requirements
# ... Dropping current database zammad
Dropped database 'zammad'
# ... Creating database zammad for owner zammad
CREATE DATABASE
# Restoring PostgrSQL DB
ERROR:  relation "public.tickets" does not exist
*Multiple relation errors....*
ERROR:  index "links_uniq_total" does not exist
*Multiple index errors...*
ERROR:  index "index_users_on_source" does not exist
*Multiple sequence & table errors....*
ERROR:  sequence "users_id_seq" does not exist

ERROR:  must be owner of extension plpgsql
ERROR:  must be owner of schema public
ERROR:  schema "public" already exists
ERROR:  must be owner of schema public
CREATE EXTENSION
ERROR:  must be owner of extension plpgsql
SET
SET
SET
CREATE TABLE
CREATE SEQUENCE
ALTER SEQUENCE
CREATE TABLE
.....
# Restoring Files
# Ensuring correct file rights ...
# Clearing Cache ...
Traceback (most recent call last):
        66: from /opt/zammad/bin/rails:9:in `<main>'
        65: from /opt/zammad/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.4.5/lib/active_support/dependencies.rb:291:in `require'
        64: from /opt/zammad/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.4.5/lib/active_support/dependencies.rb:257:in `load_dependency'
        63: from /opt/zammad/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.4.5/lib/active_support/dependencies.rb:291:in `block in require'
        62: 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'
        61: 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'
        60: 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'
        59: 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'
        58: 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'
        57: from /opt/zammad/vendor/bundle/ruby/2.6.0/gems/railties-5.2.4.5/lib/rails/commands.rb:18:in `<main>'
        56: from /opt/zammad/vendor/bundle/ruby/2.6.0/gems/railties-5.2.4.5/lib/rails/command.rb:46:in `invoke'
        55: from /opt/zammad/vendor/bundle/ruby/2.6.0/gems/railties-5.2.4.5/lib/rails/command/base.rb:69:in `perform'
        54: from /opt/zammad/vendor/bundle/ruby/2.6.0/gems/thor-1.1.0/lib/thor.rb:392:in `dispatch'
        53: from /opt/zammad/vendor/bundle/ruby/2.6.0/gems/thor-1.1.0/lib/thor/invocation.rb:127:in `invoke_command'
        52: from /opt/zammad/vendor/bundle/ruby/2.6.0/gems/thor-1.1.0/lib/thor/command.rb:27:in `run'
        51: from /opt/zammad/vendor/bundle/ruby/2.6.0/gems/railties-5.2.4.5/lib/rails/commands/runner/runner_command.rb:29:in `perform'
        50: from /opt/zammad/vendor/bundle/ruby/2.6.0/gems/railties-5.2.4.5/lib/rails/command/actions.rb:15:in `require_application_and_environment!'
        49: from /opt/zammad/vendor/bundle/ruby/2.6.0/gems/railties-5.2.4.5/lib/rails/command/actions.rb:28:in `require_environment!'
        48: from /opt/zammad/vendor/bundle/ruby/2.6.0/gems/railties-5.2.4.5/lib/rails/application.rb:337:in `require_environment!'
        47: from /opt/zammad/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.4.5/lib/active_support/dependencies.rb:291:in `require'
        46: from /opt/zammad/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.4.5/lib/active_support/dependencies.rb:257:in `load_dependency'
        45: from /opt/zammad/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.4.5/lib/active_support/dependencies.rb:291:in `block in require'
        44: 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'
        43: 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'
        42: 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'
        41: 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'
        40: 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'
        39: from /opt/zammad/config/environment.rb:5:in `<main>'
        38: from /opt/zammad/vendor/bundle/ruby/2.6.0/gems/railties-5.2.4.5/lib/rails/application.rb:361:in `initialize!'
        37: from /opt/zammad/vendor/bundle/ruby/2.6.0/gems/railties-5.2.4.5/lib/rails/initializable.rb:60:in `run_initializers'
        36: from /opt/zammad/vendor/ruby-2.6.6/lib/ruby/2.6.0/tsort.rb:205:in `tsort_each'
        35: from /opt/zammad/vendor/ruby-2.6.6/lib/ruby/2.6.0/tsort.rb:226:in `tsort_each'
        34: from /opt/zammad/vendor/ruby-2.6.6/lib/ruby/2.6.0/tsort.rb:347:in `each_strongly_connected_component'
        33: from /opt/zammad/vendor/ruby-2.6.6/lib/ruby/2.6.0/tsort.rb:347:in `call'
        32: from /opt/zammad/vendor/ruby-2.6.6/lib/ruby/2.6.0/tsort.rb:347:in `each'
        31: from /opt/zammad/vendor/ruby-2.6.6/lib/ruby/2.6.0/tsort.rb:349:in `block in each_strongly_connected_component'
        30: from /opt/zammad/vendor/ruby-2.6.6/lib/ruby/2.6.0/tsort.rb:431:in `each_strongly_connected_component_from'
        29: from /opt/zammad/vendor/ruby-2.6.6/lib/ruby/2.6.0/tsort.rb:350:in `block (2 levels) in each_strongly_connected_component'
        28: from /opt/zammad/vendor/ruby-2.6.6/lib/ruby/2.6.0/tsort.rb:228:in `block in tsort_each'
        27: from /opt/zammad/vendor/bundle/ruby/2.6.0/gems/railties-5.2.4.5/lib/rails/initializable.rb:61:in `block in run_initializers'
        26: from /opt/zammad/vendor/bundle/ruby/2.6.0/gems/railties-5.2.4.5/lib/rails/initializable.rb:32:in `run'
        25: from /opt/zammad/vendor/bundle/ruby/2.6.0/gems/railties-5.2.4.5/lib/rails/initializable.rb:32:in `instance_exec'
        24: from /opt/zammad/vendor/bundle/ruby/2.6.0/gems/railties-5.2.4.5/lib/rails/application/finisher.rb:69:in `block in <module:Finisher>'
        23: from /opt/zammad/vendor/bundle/ruby/2.6.0/gems/railties-5.2.4.5/lib/rails/application/finisher.rb:69:in `each'
        22: from /opt/zammad/vendor/bundle/ruby/2.6.0/gems/railties-5.2.4.5/lib/rails/engine.rb:356:in `eager_load!'
        21: from /opt/zammad/vendor/bundle/ruby/2.6.0/gems/railties-5.2.4.5/lib/rails/engine.rb:475:in `eager_load!'
        20: from /opt/zammad/vendor/bundle/ruby/2.6.0/gems/railties-5.2.4.5/lib/rails/engine.rb:475:in `each'
        19: from /opt/zammad/vendor/bundle/ruby/2.6.0/gems/railties-5.2.4.5/lib/rails/engine.rb:477:in `block in eager_load!'
        18: from /opt/zammad/vendor/bundle/ruby/2.6.0/gems/railties-5.2.4.5/lib/rails/engine.rb:477:in `each'
        17: from /opt/zammad/vendor/bundle/ruby/2.6.0/gems/railties-5.2.4.5/lib/rails/engine.rb:478:in `block (2 levels) in eager_load!'
        16: from /opt/zammad/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.4.5/lib/active_support/dependencies.rb:246:in `require_dependency'
        15: from /opt/zammad/vendor/bundle/ruby/2.6.0/gems/bootsnap-1.3.2/lib/bootsnap/load_path_cache/core_ext/active_support.rb:80:in `depend_on'
        14: from /opt/zammad/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.4.5/lib/active_support/dependencies.rb:334:in `depend_on'
        13: from /opt/zammad/vendor/bundle/ruby/2.6.0/gems/bootsnap-1.3.2/lib/bootsnap/load_path_cache/core_ext/active_support.rb:45:in `require_or_load'
        12: from /opt/zammad/vendor/bundle/ruby/2.6.0/gems/bootsnap-1.3.2/lib/bootsnap/load_path_cache/core_ext/active_support.rb:16:in `allow_bootsnap_retry'
        11: from /opt/zammad/vendor/bundle/ruby/2.6.0/gems/bootsnap-1.3.2/lib/bootsnap/load_path_cache/core_ext/active_support.rb:46:in `block in require_or_load'
        10: from /opt/zammad/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.4.5/lib/active_support/dependencies.rb:356:in `require_or_load'
         9: from /opt/zammad/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.4.5/lib/active_support/dependencies.rb:37:in `load_interlock'
         8: from /opt/zammad/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.4.5/lib/active_support/dependencies/interlock.rb:13:in `loading'
         7: from /opt/zammad/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.4.5/lib/active_support/concurrency/share_lock.rb:151:in `exclusive'
         6: from /opt/zammad/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.4.5/lib/active_support/dependencies/interlock.rb:14:in `block in loading'
         5: from /opt/zammad/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.4.5/lib/active_support/dependencies.rb:37:in `block in load_interlock'
         4: from /opt/zammad/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.4.5/lib/active_support/dependencies.rb:378:in `block in require_or_load'
         3: from /opt/zammad/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.4.5/lib/active_support/dependencies.rb:291:in `require'
         2: from /opt/zammad/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.4.5/lib/active_support/dependencies.rb:257:in `load_dependency'
         1: from /opt/zammad/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.4.5/lib/active_support/dependencies.rb:291:in `block in require'
/opt/zammad/vendor/bundle/ruby/2.6.0/gems/bootsnap-1.3.2/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:32:in `require': No such file to load -- observer/chat/leave/background_job.rb (LoadError)
        62: from /opt/zammad/bin/rails:9:in `<main>'
        61: 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'
        60: 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'
        59: 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'
        58: 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'
        57: 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'
        56: from /opt/zammad/vendor/bundle/ruby/2.6.0/gems/railties-5.2.4.5/lib/rails/commands.rb:18:in `<main>'
        55: from /opt/zammad/vendor/bundle/ruby/2.6.0/gems/railties-5.2.4.5/lib/rails/command.rb:46:in `invoke'
        54: from /opt/zammad/vendor/bundle/ruby/2.6.0/gems/railties-5.2.4.5/lib/rails/command/base.rb:69:in `perform'
        53: from /opt/zammad/vendor/bundle/ruby/2.6.0/gems/thor-1.1.0/lib/thor.rb:392:in `dispatch'
        52: from /opt/zammad/vendor/bundle/ruby/2.6.0/gems/thor-1.1.0/lib/thor/invocation.rb:127:in `invoke_command'
        51: from /opt/zammad/vendor/bundle/ruby/2.6.0/gems/thor-1.1.0/lib/thor/command.rb:27:in `run'
        50: from /opt/zammad/vendor/bundle/ruby/2.6.0/gems/railties-5.2.4.5/lib/rails/commands/runner/runner_command.rb:29:in `perform'
        49: from /opt/zammad/vendor/bundle/ruby/2.6.0/gems/railties-5.2.4.5/lib/rails/command/actions.rb:15:in `require_application_and_environment!'
        48: from /opt/zammad/vendor/bundle/ruby/2.6.0/gems/railties-5.2.4.5/lib/rails/command/actions.rb:28:in `require_environment!'
        47: from /opt/zammad/vendor/bundle/ruby/2.6.0/gems/railties-5.2.4.5/lib/rails/application.rb:337:in `require_environment!'
        46: 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'
        45: 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'
        44: 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'
        43: 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'
        42: 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'
        41: from /opt/zammad/config/environment.rb:5:in `<main>'
        40: from /opt/zammad/vendor/bundle/ruby/2.6.0/gems/railties-5.2.4.5/lib/rails/application.rb:361:in `initialize!'
        39: from /opt/zammad/vendor/bundle/ruby/2.6.0/gems/railties-5.2.4.5/lib/rails/initializable.rb:60:in `run_initializers'
        38: from /opt/zammad/vendor/ruby-2.6.6/lib/ruby/2.6.0/tsort.rb:205:in `tsort_each'
        37: from /opt/zammad/vendor/ruby-2.6.6/lib/ruby/2.6.0/tsort.rb:226:in `tsort_each'
        36: from /opt/zammad/vendor/ruby-2.6.6/lib/ruby/2.6.0/tsort.rb:347:in `each_strongly_connected_component'
        35: from /opt/zammad/vendor/ruby-2.6.6/lib/ruby/2.6.0/tsort.rb:347:in `call'
        34: from /opt/zammad/vendor/ruby-2.6.6/lib/ruby/2.6.0/tsort.rb:347:in `each'
        33: from /opt/zammad/vendor/ruby-2.6.6/lib/ruby/2.6.0/tsort.rb:349:in `block in each_strongly_connected_component'
        32: from /opt/zammad/vendor/ruby-2.6.6/lib/ruby/2.6.0/tsort.rb:431:in `each_strongly_connected_component_from'
        31: from /opt/zammad/vendor/ruby-2.6.6/lib/ruby/2.6.0/tsort.rb:350:in `block (2 levels) in each_strongly_connected_component'
        30: from /opt/zammad/vendor/ruby-2.6.6/lib/ruby/2.6.0/tsort.rb:228:in `block in tsort_each'
        29: from /opt/zammad/vendor/bundle/ruby/2.6.0/gems/railties-5.2.4.5/lib/rails/initializable.rb:61:in `block in run_initializers'
        28: from /opt/zammad/vendor/bundle/ruby/2.6.0/gems/railties-5.2.4.5/lib/rails/initializable.rb:32:in `run'
        27: from /opt/zammad/vendor/bundle/ruby/2.6.0/gems/railties-5.2.4.5/lib/rails/initializable.rb:32:in `instance_exec'
        26: from /opt/zammad/vendor/bundle/ruby/2.6.0/gems/railties-5.2.4.5/lib/rails/application/finisher.rb:69:in `block in <module:Finisher>'
        25: from /opt/zammad/vendor/bundle/ruby/2.6.0/gems/railties-5.2.4.5/lib/rails/application/finisher.rb:69:in `each'
        24: from /opt/zammad/vendor/bundle/ruby/2.6.0/gems/railties-5.2.4.5/lib/rails/engine.rb:356:in `eager_load!'
        23: from /opt/zammad/vendor/bundle/ruby/2.6.0/gems/railties-5.2.4.5/lib/rails/engine.rb:475:in `eager_load!'
        22: from /opt/zammad/vendor/bundle/ruby/2.6.0/gems/railties-5.2.4.5/lib/rails/engine.rb:475:in `each'
        21: from /opt/zammad/vendor/bundle/ruby/2.6.0/gems/railties-5.2.4.5/lib/rails/engine.rb:477:in `block in eager_load!'
        20: from /opt/zammad/vendor/bundle/ruby/2.6.0/gems/railties-5.2.4.5/lib/rails/engine.rb:477:in `each'
        19: from /opt/zammad/vendor/bundle/ruby/2.6.0/gems/railties-5.2.4.5/lib/rails/engine.rb:478:in `block (2 levels) in eager_load!'
        18: from /opt/zammad/vendor/bundle/ruby/2.6.0/gems/bootsnap-1.3.2/lib/bootsnap/load_path_cache/core_ext/active_support.rb:79:in `depend_on'
        17: from /opt/zammad/vendor/bundle/ruby/2.6.0/gems/bootsnap-1.3.2/lib/bootsnap/load_path_cache/core_ext/active_support.rb:84:in `rescue in depend_on'
        16: from /opt/zammad/vendor/bundle/ruby/2.6.0/gems/bootsnap-1.3.2/lib/bootsnap/load_path_cache/core_ext/active_support.rb:8:in `without_bootsnap_cache'
        15: from /opt/zammad/vendor/bundle/ruby/2.6.0/gems/bootsnap-1.3.2/lib/bootsnap/load_path_cache/core_ext/active_support.rb:84:in `block in depend_on'
        14: from /opt/zammad/vendor/bundle/ruby/2.6.0/gems/bootsnap-1.3.2/lib/bootsnap/load_path_cache/core_ext/active_support.rb:45:in `require_or_load'
        13: from /opt/zammad/vendor/bundle/ruby/2.6.0/gems/bootsnap-1.3.2/lib/bootsnap/load_path_cache/core_ext/active_support.rb:16:in `allow_bootsnap_retry'
        12: from /opt/zammad/vendor/bundle/ruby/2.6.0/gems/bootsnap-1.3.2/lib/bootsnap/load_path_cache/core_ext/active_support.rb:46:in `block in require_or_load'
        11: from /opt/zammad/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.4.5/lib/active_support/dependencies/interlock.rb:13:in `loading'
        10: from /opt/zammad/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.4.5/lib/active_support/concurrency/share_lock.rb:151:in `exclusive'
         9: from /opt/zammad/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.4.5/lib/active_support/dependencies/interlock.rb:14:in `block in loading'
         8: 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'
         7: 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'
         6: 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'
         5: 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'
         4: 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'
         3: from /opt/zammad/app/models/observer/chat/leave/background_job.rb:1:in `<main>'
         2: from /opt/zammad/vendor/bundle/ruby/2.6.0/gems/bootsnap-1.3.2/lib/bootsnap/load_path_cache/core_ext/active_support.rb:57:in `load_missing_constant'
         1: from /opt/zammad/vendor/bundle/ruby/2.6.0/gems/bootsnap-1.3.2/lib/bootsnap/load_path_cache/core_ext/active_support.rb:16:in `allow_bootsnap_retry'
/opt/zammad/vendor/bundle/ruby/2.6.0/gems/bootsnap-1.3.2/lib/bootsnap/load_path_cache/core_ext/active_support.rb:58:in `block in load_missing_constant': uninitialized constant Observer (NameError)
# Starting Zammad

# Zammad restored successfully - Wed Jul  7 12:49:06 CEST 2021!

Accessing zammad via browser returns nginx 502 Bad Gateway.
Running any “zammad run rails”-commands returns multiple ruby errors (can post those if needed)

Steps to reproduce the behavior:

  • Install Zammad 4.1.0 via package for centos 7
  • Check if /etc/nginx/conf.d/zammad.conf matches production system
  • Check if /opt/zammad/config/database.yml matches production system
  • Check if zammad is reachable via browser (works)
  • Create /var/tmp/zammad_backup → put production backup files there → Chown zammad
  • CP /opt/zammad/contrib/backup/config.dist → config → Chown zammad
  • Start /opt/zammad/contrib/backup/restore.sh as either zammad or root

Any feedback or help is highly appreciated!
Thank you & BR
Rafael

Please read and follow the documentation step by step.
The ruby errors are currently normal because you’re restoring from different OS and version.

https://docs.zammad.org/en/latest/appendix/backup-and-restore.html#migrating-from-another-zammad-host

Thank you for your fast reply. Zammad Version differs yes, but OS Version is the same.

I’ll check the documentation again (though I did thoroughly)

BR

I worked through the provided documentation again - thanks again.

According to the documentation:

  • The Zammad-Version on the destination system has to be the same or newer (migration from 3.6.0 to 4.1.0 so should work)
  • You can’t mix database types (stayed postgresql)
  • Ensure you have enough free space on your drive (yes)
  • If not source code installation: You need a fresh Zammad installation (this is probably what I missed before)

So: I now additionally stopped all zammad services and manually removed /opt/zammad after zammad_restore.sh was done. Then I reinstalled zammad again via package. Again - lots of ruby errors but this time I’m able to get to the front-page but as soon as I want to login with any user account I get a “CSRF token verification failed!”-error.

Ruby errors during re-install:

Running transaction
  Updating   : zammad-4.1.0-1625647640.e4156ba2.centos7.x86_64                                                                                                                                      1/2
# (Re)creating init scripts
Nothing to do.
Nothing to do.
Nothing to do.
# Enabling Zammad on boot
# Stopping Zammad
# Installing zammad on postgresql
# Preparing postgresql server
Data directory is not empty!

# Creating postgresql bootstart
# Restarting postgresql server
# Creating zammad postgresql user
ERROR:  role "zammad" already exists
# Creating zammad postgresql db
createdb: database creation failed: ERROR:  database "zammad" already exists
# Grant privileges to new postgresql user
GRANT
# Updating database.yml
rake aborted!
StandardError: An error has occurred, this and all later migrations canceled:

PG::SyntaxError: ERROR:  zero-length delimited identifier at or near """"
LINE 1: DELETE FROM "settings" WHERE "settings"."" = $1

^^^^ 3 Times

Tasks: TOP => db:migrate
(See full trace by running task with --trace)
== 20201013095141 ElasticSearchLower65Obsolete: migrating =====================
Run `rails db:migrate` to update your database then try again.
You have 26 pending migrations:
  20201013095141 ElasticSearchLower65Obsolete
  20201110000001 MentionInit
  20201111133905 MaintenanceAssociationsCleanup
  20201118140850 Issue2671PendingTillCanBeChangedByCustomer
  20201201000001 SettingAddSenderFormatAgentName
  20201202080338 Issue3270SelectorUpdate
  20201210075534 MaintenanceMissingKbUniqueIndexes
  20210113000001 GitLabSupport
  20210118095820 Issue3372WebhooksAdminView
  20210215000001 SettingEsTotalMaxSizeInMb
  20210308000001 GitHubSupport
  20210310090351 ActiverecordSessionStore114
  20210311130946 RemoveUnfixableGenericOauth2Login
  20210414000000 InitSessionTimeout
  20210426000000 SchedulerSessionTimeout
  20210426000002 UpdateSessionTimeoutDefaults
  20210426184355 Issue3446Microsoft365Tenants
  20210428125300 Issue3523NewOperator
  20210507131905 Issue3548DataPrivacyTaskPreferencesToText
  20210510092410 Issue3550SetPretty
  20210528000000 UpdateSessionTimeoutDropdown
  20210528092410 Issue3567AutoAssignment
  20210607000000 SessionTimeoutDescription
  20210617051913 Issue3618GoogleCalendarUrlHttps
  20210622144000 Issue3617UserImageSourceFix
  202104070000001 SettingAddInternalArticleCheck

Running zammad run rails db:migrate again returns the same ruby errors as above.

Is there something I’m still missing?

Thanks again & BR

Most common reason for this is differential between http or https.
The documentation has you covered:
https://docs.zammad.org/en/latest/getting-started/configure-webserver.html

This confused me.
Why would Zammad try to create a new Zammad DB and user if you did successfully migrate?

If I had to guess you’re purging instead of forced reinstalling?
After removing the Zammad package, is /opt/zammad/ still available before reinstall?

I’m sure it’s either not existing or incomplete:

That’s the responsible par tthat back fires at you.


You have two options:

This will save you from forced reinstalls because they’re no longer required.

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