Problem upgrading multi-site/multi-containers Discourse instance

AI-generated summary

User jtraulle is encountering a bundler error while upgrading a multi-site, multi-container Discourse instance from 2.8.0.beta8 to 2.9.0.beta4. The error occurs during the multisite:migrate step and references a conflict with the uri gem (0.10.0 vs. required 0.11.0), despite uri not appearing explicitly in the Gemfile. Benjamin_D notes that uri was added in a recent commit. jtraulle successfully upgraded to 2.8.3 by manually specifying a commit hash and later found that upgrading to 2.9.0.beta2 worked, but beta3 failed — requiring a rebuild of the data container to update Redis to 6.2. pfaffman suggested checking PostgreSQL version (confirmed as 13.2) and removing the migratepassword plugin, which didn’t resolve the issue. Another user, swiebe, reports the same error on a non-multi-site upgrade, indicating the issue may be broader. The root appears to be a Ruby gem version conflict introduced in newer Discourse versions, potentially requiring container rebuilds or manual version pinning to bypass.

Hello,

I am trying to upgrade a Discourse instance that is currently in 2.8.0.beta8 (0ededb1454) to 2.9.0.beta4.

It worked great so far but this time, I have an error when trying to bootstrap my new web_only container.

It is a multi-site install and multi container (web_only and data).

It hangs on this :

I, [2022-05-13T05:52:47.051709 #1]  INFO -- : > cd /var/www/discourse && sudo -E -u discourse bundle exec rake multisite:migrate
bundler: failed to load command: rake (/var/www/discourse/vendor/bundle/ruby/2.7.0/bin/rake)
/usr/local/lib/ruby/gems/2.7.0/gems/bundler-2.3.13/lib/bundler/runtime.rb:309:in `check_for_activated_spec!': You have already activated uri 0.10.0, but your Gemfile requires uri 0.11.0. Since uri is a default gem, you can either remove your dependency on it or try updating to a newer version of bundler that supports uri as a default gem. (Gem::LoadError)
	from /usr/local/lib/ruby/gems/2.7.0/gems/bundler-2.3.13/lib/bundler/runtime.rb:25:in `block in setup'
	from /usr/local/lib/ruby/gems/2.7.0/gems/bundler-2.3.13/lib/bundler/spec_set.rb:136:in `each'
	from /usr/local/lib/ruby/gems/2.7.0/gems/bundler-2.3.13/lib/bundler/spec_set.rb:136:in `each'
	from /usr/local/lib/ruby/gems/2.7.0/gems/bundler-2.3.13/lib/bundler/runtime.rb:24:in `map'
	from /usr/local/lib/ruby/gems/2.7.0/gems/bundler-2.3.13/lib/bundler/runtime.rb:24:in `setup'
	from /usr/local/lib/ruby/gems/2.7.0/gems/bundler-2.3.13/lib/bundler.rb:151:in `setup'
	from /usr/local/lib/ruby/gems/2.7.0/gems/bundler-2.3.13/lib/bundler/setup.rb:20:in `block in <top (required)>'
	from /usr/local/lib/ruby/gems/2.7.0/gems/bundler-2.3.13/lib/bundler/ui/shell.rb:136:in `with_level'
	from /usr/local/lib/ruby/gems/2.7.0/gems/bundler-2.3.13/lib/bundler/ui/shell.rb:88:in `silence'
	from /usr/local/lib/ruby/gems/2.7.0/gems/bundler-2.3.13/lib/bundler/setup.rb:20:in `<top (required)>'
	from /usr/local/lib/ruby/gems/2.7.0/gems/bundler-2.3.13/lib/bundler/cli/exec.rb:56:in `require_relative'
	from /usr/local/lib/ruby/gems/2.7.0/gems/bundler-2.3.13/lib/bundler/cli/exec.rb:56:in `kernel_load'
	from /usr/local/lib/ruby/gems/2.7.0/gems/bundler-2.3.13/lib/bundler/cli/exec.rb:23:in `run'
	from /usr/local/lib/ruby/gems/2.7.0/gems/bundler-2.3.13/lib/bundler/cli.rb:483:in `exec'
	from /usr/local/lib/ruby/gems/2.7.0/gems/bundler-2.3.13/lib/bundler/vendor/thor/lib/thor/command.rb:27:in `run'
	from /usr/local/lib/ruby/gems/2.7.0/gems/bundler-2.3.13/lib/bundler/vendor/thor/lib/thor/invocation.rb:127:in `invoke_command'
	from /usr/local/lib/ruby/gems/2.7.0/gems/bundler-2.3.13/lib/bundler/vendor/thor/lib/thor.rb:392:in `dispatch'
	from /usr/local/lib/ruby/gems/2.7.0/gems/bundler-2.3.13/lib/bundler/cli.rb:31:in `dispatch'
	from /usr/local/lib/ruby/gems/2.7.0/gems/bundler-2.3.13/lib/bundler/vendor/thor/lib/thor/base.rb:485:in `start'
	from /usr/local/lib/ruby/gems/2.7.0/gems/bundler-2.3.13/lib/bundler/cli.rb:25:in `start'
	from /usr/local/lib/ruby/gems/2.7.0/gems/bundler-2.3.13/exe/bundle:48:in `block in <top (required)>'
	from /usr/local/lib/ruby/gems/2.7.0/gems/bundler-2.3.13/lib/bundler/friendly_errors.rb:103:in `with_friendly_errors'
	from /usr/local/lib/ruby/gems/2.7.0/gems/bundler-2.3.13/exe/bundle:36:in `<top (required)>'
	from /usr/local/bin/bundle:23:in `load'
	from /usr/local/bin/bundle:23:in `<main>'
I, [2022-05-13T05:52:47.425596 #1]  INFO -- : 


FAILED
--------------------
Pups::ExecError: cd /var/www/discourse && sudo -E -u discourse bundle exec rake multisite:migrate failed with return #<Process::Status: pid 6089 exit 1>
Location of failure: /pups/lib/pups/exec_command.rb:112:in `spawn'
exec failed with the params "cd /var/www/discourse && sudo -E -u discourse bundle exec rake multisite:migrate"
df18312b372c1b6866b4219c5f8678dbcab50711a643f7ed8d627cae998d59e9
** FAILED TO BOOTSTRAP ** please scroll up and look for earlier error messages, there may be more than one.

Extract of ./discourse-doctor regarding plugins and containers :

==================== DOCKER INFO ====================
DOCKER VERSION: Docker version 19.03.13, build 4484c46d9d

DOCKER PROCESSES (docker ps -a)

CONTAINER ID        IMAGE                      COMMAND             CREATED             STATUS              PORTS                      NAMES
ef7f5c75b666        local_discourse/web_only   "/sbin/boot"        7 months ago        Up 2 months         127.0.0.1:8800->80/tcp     web_only
418c82bdeb7b        local_discourse/data       "/sbin/boot"        14 months ago       Up 2 months         127.0.0.1:5432->5432/tcp   data

ef7f5c75b666        local_discourse/web_only   "/sbin/boot"        7 months ago        Up 2 months         127.0.0.1:8800->80/tcp     web_only

Discourse container web_only is running


==================== PLUGINS ====================
          - git clone https://github.com/discourse/docker_manager.git
          - git clone https://github.com/discourse/discourse-solved.git
          - git clone https://github.com/discourse/discourse-bbcode.git
          - git clone https://github.com/discourse/discourse-whos-online.git
          - git clone https://github.com/discoursehosting/discourse-migratepassword.git
          - git clone https://github.com/discourse/discourse-github.git

No non-official plugins detected.

Any clue on how to resolve this ?

Thanks !

May be related to

https://github.com/rubygems/rubygems/issues/5016#issuecomment-951808558

Are you using pg13?

You can probably remove the migrate password plugin.

But the other issue suggested might be the cause.

Hey, thanks for your reply @pfaffman

Yes :

psql (13.2 (Debian 13.2-1.pgdg100+1))

I tried to comment the plugin migratepassword but same error.

Any idea how to get away with this ?

My understanding is that all dependencies stuff are done within the builded container so I do not understand why it hang on this :

/usr/local/lib/ruby/gems/2.7.0/gems/bundler-2.3.13/lib/bundler/runtime.rb:309:in 
`check_for_activated_spec!': You have already activated uri 0.10.0, but your 
Gemfile requires uri 0.11.0. Since uri is a default gem, you can either remove 
your dependency on it or try updating to a newer version of bundler that supports 
uri as a default gem. (Gem::LoadError)

And I do not understand the reference to uri because it is not in the Gemfile

At the begining of the process, we have

I, [2022-05-13T18:22:51.511137 #1]  INFO -- : Running `bundle install --deployment --jobs 4 --retry 3 --verbose --without "test" "development"` with bundler 2.3.13
Frozen, using resolution from the lockfile
The definition is missing ["bootsnap-1.11.1", "actionmailer-7.0.3", "actionpack-7.0.3", "actionview-7.0.3", "activemodel-7.0.3", "activerecord-7.0.3", "activesupport-7.0.3", "railties-7.0.3", "sprockets-rails-3.4.2", "json-2.6.1", "mail-2.8.0.rc1", "mini_mime-1.1.2", "mini_suffix-0.3.3", "redis-4.5.1", "redis-namespace-1.8.2", "discourse-fonts-0.0.9", "message_bus-4.2.0", "rails_multisite-4.0.1", "fastimage-2.2.6", "aws-sdk-s3-1.114.0", "aws-sdk-sns-1.53.0", "excon-0.92.3", "image_optim-0.31.1", "nokogiri-1.13.6-x86_64-linux", "loofah-2.17.0", "css_parser-1.11.0", "omniauth-facebook-9.0.0", "omniauth-oauth2-1.7.2", "oj-3.13.11", "pg-1.3.5", "mini_sql-1.4.0", "rake-13.0.6", "thor-1.2.1", "sidekiq-6.4.2", "mini_racer-0.6.2", "rack-protection-2.2.0", "addressable-2.8.0", "json_schemer-0.2.21", "fast_blank-1.0.1", "rack-mini-profiler-3.0.0", "unicorn-6.1.0", "puma-5.6.4", "rss-0.2.9", "stackprof-0.2.19", "cppjieba_rb-0.4.2", "lograge-0.12.0", "logster-2.11.2", "rqrcode-2.1.1", "rubyzip-2.3.2", "sanitize-6.0.0", "rails_failover-0.8.1", "net-http-0.2.2", "msgpack-1.5.1", "activejob-7.0.3", "net-imap-0.2.3", "net-pop-0.1.1", "net-smtp-0.3.1", "rails-html-sanitizer-1.4.2", "concurrent-ruby-1.1.10", "i18n-1.10.0", "minitest-5.15.0", "zeitwerk-2.5.4", "ffi-1.15.5", "aws-sdk-core-3.130.2", "aws-sdk-kms-1.56.0", "aws-sigv4-1.5.0", "unf_ext-0.0.8.1", "image_size-3.0.1", "in_threads-1.6.0", "racc-1.6.0", "hashie-5.0.0", "jwt-2.3.0", "libv8-node-16.10.0.0-x86_64-linux", "public_suffix-4.0.7", "ecma-re-validator-0.4.0", "regexp_parser-2.4.0", "raindrops-0.20.0", "nio4r-2.5.8", "rexml-3.2.5", "request_store-1.5.1", "rqrcode_core-1.2.0", "uri-0.11.0", "globalid-1.0.0", "digest-3.1.0", "net-protocol-0.1.3", "strscan-3.0.3", "timeout-0.2.0", "aws-eventstream-1.2.0", "aws-partitions-1.583.0", "jmespath-1.6.1", "oauth-0.5.10", "faraday-1.10.0", "openssl-2.2.1", "faraday-httpclient-1.0.1", "faraday-multipart-1.0.3", "faraday-net_http_persistent-1.2.0", "faraday-patron-1.0.0", "faraday-rack-1.0.0", "faraday-retry-1.0.3", "ruby2_keywords-0.0.5", "ipaddr-1.2.4"]

"uri-0.11.0"

Grumpf, it drives me nuts :triumph:

Could it be a version conflict with bundler ?

/usr/local/lib/ruby/gems/2.7.0/gems/bundler-2.3.13

And in the Gemfile from 2.9.0.beta4

BUNDLED WITH
   2.3.5

Hi Jean,

it was introduced here:
https://github.com/discourse/discourse/commit/008b700a3f24fdbb0feb9897321b61a3deabe0e2

Hi @Benjamin_D and thanks for the tip,

I was able to upgrade to 2.8.3 by manually writing commit ref a9a643bcdc5808802a5a0d73f107cc3a63e2e095 to params: version: in my .yml

Will try to upgrade by steps.

Getting the exact same error when attempting to upgrade (not multi-site) to 2.9.0.beta4.

Upgrading to beta2 is OK.


Upgrading to beta3 is not.


After investigating, I needeed to rebuild my data container to upgrade Redis to 6.2