Zammad_restore.sh ends in 502 Bad Gateway

I try to migrate to a new server.

old server:

  • Debian 10
  • Zammad 4.1.1 installed from packages

new server:

  • Debian 10
  • Zammad 5.0.1 installed from packages

I used zammad_backup.sh on the old server. I installed a fresh zammad
on the new server and run zammad_restore.sh:

root@support:/opt/zammad/contrib/backup# ./zammad_restore.sh

# Zammad restored started - Fri Oct 22 09:52:09 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:
20211016044201
20211017044201
20211018044201
20211019044201
20211020044201
20211021044201
File date: 20211021044201
Enter db date to restore:
20211016044201
20211017044201
20211018044201
20211019044201
20211020044201
20211021044201
DB date: 20211021044201
# Stopping Zammad
# Checking requirements
# ... Dropping current database zammad
Dropped database 'zammad'
# ... Creating database zammad for owner zammad
CREATE DATABASE
# Restoring PostgreSQL DB
psql: FATAL:  Peer authentication failed for user "zammad"
# Restoring Files
# Ensuring correct file rights ...
# 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:0x000055fc03598800> (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 39: _zammad: command not found
# Starting Zammad

# Zammad restored successfully - Fri Oct 22 09:52:49 CEST 2021!

After restore I get “502 Bad Gateway” in the browser.

2021/10/22 10:17:47 [error] 7466#7466: *42 connect() failed (111: Connection refused) while connecting to upstream, client: 91.5.25.xyz, server: support.abc.com, request: "GET / HTTP/2.0", upstream: "http://127.0.0.1:3000/", host: "support.abc.com"

no service lists on port 3000
the services zammad-web, zammad-worker and zammad-websocket are active and running.

Any ideas what wents wrong?

Kind regards,
Thomas

1 Like

ThomasS, if you are trying to update Zammad it’s only update how on the below link Updating Zammad — Zammad documentation

But if you need migrate to a new zammad, you have to remember that you need to stay in the same version of zammad.

Hi JDRodriguez,
regarding
https://docs.zammad.org/en/latest/appendix/backup-and-restore.html
the version of thedestination system has to the same or newer…
Regards,
Thomas.

If ss -tulpen|grep "3000" does not return processes then the service is not running the way it should.
But the service runs? → stop the Zammad service and remove the pid directory: rm -rf /opt/zammad/tmp/pids/ (ONLY DO THIS IF NOT RUNNING)

Start the service.
Zammad should start to listen to the port in question.

there is no service listening on port 3000!

# rm -rf  /opt/zammad/tmp/pids/
# systemctl start zammad

# systemctl | grep zammad
zammad-web-1.service                                     loaded active running   zammad-web-1.service                                      
zammad-web.service                                       loaded active running   zammad-web.service                                        
zammad-websocket-1.service                               loaded active running   zammad-websocket-1.service                                
zammad-websocket.service                                 loaded active running   zammad-websocket.service                                  
zammad-worker-1.service                                  loaded active running   zammad-worker-1.service                                   
zammad-worker.service                                    loaded active running   zammad-worker.service                                     
zammad.service                                           loaded active running   zammad.service            

# ss -tulpen|grep "3000"
tcp    LISTEN  0       128       [::ffff:127.0.0.1]:9200                *:*      users:(("java",pid=1832,fd=323)) uid:102 ino:147784498 sk:ffff9e44396b3000 v6only:0 <->

I think, the puma service is not started and I’m not familar with puma. There are logfiles? Is there a way to debug?

Kind regards,
Thomas.

Having the exact same issue

The trick is first create a backup on the new server. (new Zammad installation).
Then combine the backup of the old server with the new server:
Take the database part of the old server and the files part of the new server.
start the restore.sh script.
After it is finished start a reindex action with: zammad run rake searchindex:rebuild
start Zammad and it works!
I upgraded this way from Zammad 3.x docker to a 4.1 server installation.
Kind regards,
Oscar

I tried your way but I still get the same issue.

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