[Solved] Discourse crashed during update

AI-generated summary

The thread addresses a Discourse update failure reported by vin100, where the Docker Manager failed due to a Ruby version mismatch (3.3.8 vs 3.4) and the system crashed during the upgrade process. After sharing the error logs, vin100 initially struggled with SSH commands, receiving guidance from NateDhaliwal to navigate to the /var/discourse directory. This resolved the issue, and vin100 confirmed the fix.

Following the resolution, vin100 asked for the correct procedure when both Docker and Discourse updates are pending. Canapin clarified that a rebuild app command handles both updates. While vin100 summarized the steps including git pull, Canapin corrected that git pull is redundant as the rebuild performs it automatically, and sudo is unnecessary when logged in as root. Ed_S added a caveat that while git pull is often redundant, it can be useful in specific edge cases where rebuilds fail.

I don’t undestand what’s happend and what to do.

My Discourse crashed when I did the last update.

Any help would be very appreciated

Waiting for Unicorn to reload...............
Stopping 1 Unicorn worker(s), to free up memory
$ cd /var/www/discourse && git fetch --tags --prune-tags --prune --force
$ cd /var/www/discourse && git reset --hard
HEAD is now at 44bf7b363ac I18N: Update translations (#37404)
$ cd /var/www/discourse && git -c advice.detachedHead=false checkout beta
Previous HEAD position was 44bf7b363ac I18N: Update translations (#37404)
HEAD is now at f863bbf1553 Revert "FIX: Add server-side trust level check for delete all posts (… [backport 2026.2] (#38095)
$ bundle install --retry 3 --jobs 4
Your Ruby version is 3.3.8, but your Gemfile specified ~> 3.4
Docker Manager: FAILED TO UPGRADE
#<RuntimeError: RuntimeError>
/var/www/discourse/plugins/docker_manager/lib/docker_manager/upgrader.rb:205:in `run'
/var/www/discourse/plugins/docker_manager/lib/docker_manager/upgrader.rb:94:in `upgrade'
/var/www/discourse/plugins/docker_manager/scripts/docker_manager_upgrade.rb:19:in `block in <main>'
/var/www/discourse/plugins/docker_manager/scripts/docker_manager_upgrade.rb:6:in `fork'
/var/www/discourse/plugins/docker_manager/scripts/docker_manager_upgrade.rb:6:in `<main>'
/var/www/discourse/vendor/bundle/ruby/3.3.0/gems/railties-8.0.4/lib/rails/commands/runner/runner_command.rb:44:in `load'
/var/www/discourse/vendor/bundle/ruby/3.3.0/gems/railties-8.0.4/lib/rails/commands/runner/runner_command.rb:44:in `block in perform'
/var/www/discourse/vendor/bundle/ruby/3.3.0/gems/activesupport-8.0.4/lib/active_support/execution_wrapper.rb:91:in `wrap'
/var/www/discourse/vendor/bundle/ruby/3.3.0/gems/railties-8.0.4/lib/rails/commands/runner/runner_command.rb:70:in `conditional_executor'
/var/www/discourse/vendor/bundle/ruby/3.3.0/gems/railties-8.0.4/lib/rails/commands/runner/runner_command.rb:43:in `perform'
/var/www/discourse/vendor/bundle/ruby/3.3.0/gems/thor-1.4.0/lib/thor/command.rb:28:in `run'
/var/www/discourse/vendor/bundle/ruby/3.3.0/gems/thor-1.4.0/lib/thor/invocation.rb:127:in `invoke_command'
/var/www/discourse/vendor/bundle/ruby/3.3.0/gems/railties-8.0.4/lib/rails/command/base.rb:178:in `invoke_command'
/var/www/discourse/vendor/bundle/ruby/3.3.0/gems/thor-1.4.0/lib/thor.rb:538:in `dispatch'
/var/www/discourse/vendor/bundle/ruby/3.3.0/gems/railties-8.0.4/lib/rails/command/base.rb:73:in `perform'
/var/www/discourse/vendor/bundle/ruby/3.3.0/gems/railties-8.0.4/lib/rails/command.rb:65:in `block in invoke'
/var/www/discourse/vendor/bundle/ruby/3.3.0/gems/railties-8.0.4/lib/rails/command.rb:143:in `with_argv'
/var/www/discourse/vendor/bundle/ruby/3.3.0/gems/railties-8.0.4/lib/rails/command.rb:63:in `invoke'
/var/www/discourse/vendor/bundle/ruby/3.3.0/gems/railties-8.0.4/lib/rails/commands.rb:18:in `<main>'
/usr/local/lib/ruby/3.3.0/bundled_gems.rb:69:in `require'
/usr/local/lib/ruby/3.3.0/bundled_gems.rb:69:in `block (2 levels) in replace_require'
/var/www/discourse/vendor/bundle/ruby/3.3.0/gems/bootsnap-1.19.0/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:30:in `require'
bin/rails:18:in `<main>'
Spinning up 1 Unicorn worker(s) that were stopped initially

Perhaps have a look at

Alas…

root@forum:~# sudo git pull
sudo ./launcher rebuild app
fatal: not a git repository (or any of the parent directories): .git
sudo: ./launcher: command not found

You should navigate to the discourse directory first with cd /var/discourse.

Thanks, it’s working now. I’ll get back to you when it’s finished.

Thank you very much, it’s fixed!

For next time and for other users, since it seems more efficient to perform updates via SSH, what commands should be executed when the Admin Panel indicates a Docker update AND a Discourse update? And in what order should we proceed?

A rebuild upgrades both :slight_smile:

Thanks! So in summary

cd /var/discourse
sudo git pull
sudo ./launcher rebuild app

I don’t think git pull is necessary, a rebuild performs it. edit: see ed’s post below

sudo isn’t required if you are logged in as root.

You can also run it as a single command: /var/discourse/launcher rebuild app.

I don’t think this is universally true. See for example
‘rebuild app’ failed. looks like pnpm problem

It’s also very cheap, so I’m not sure it helps to note that it might not be necessary.