Updating and container rebuild fails

I was trying to update my Discourse instance but it failed at some point.

Log
$ bundle install --deployment --jobs 4 --without test development
[DEPRECATED] The `--deployment` flag is deprecated because it relies on being remembered across bundler invocations, which bundler will no longer do in future versions. Instead please use `bundle config set --local deployment 'true'`, and stop using this flag
[DEPRECATED] The `--without` flag is deprecated because it relies on being remembered across bundler invocations, which bundler will no longer do in future versions. Instead please use `bundle config set --local without 'test development'`, and stop using this flag
Warning: the running version of Bundler (2.2.4) is older than the version that created the lockfile (2.2.6). We suggest you to upgrade to the version that created the lockfile by running `gem install bundler:2.2.6`.
Fetching source index from https://rubygems.org/

Retrying fetcher due to error (2/4): Bundler::HTTPError Could not fetch specs from https://rubygems.org/ due to underlying error <timed out (https://rubygems.org/specs.4.8.gz)>

Retrying fetcher due to error (3/4): Bundler::HTTPError Could not fetch specs from https://rubygems.org/ due to underlying error <timed out (https://rubygems.org/specs.4.8.gz)>

Retrying fetcher due to error (4/4): Bundler::HTTPError Could not fetch specs from https://rubygems.org/ due to underlying error <timed out (https://rubygems.org/specs.4.8.gz)>

Could not fetch specs from https://rubygems.org/ due to underlying error <timed
out (https://rubygems.org/specs.4.8.gz)>
Docker Manager: FAILED TO UPGRADE
#<RuntimeError: RuntimeError>
/var/www/discourse/plugins/docker_manager/lib/docker_manager/upgrader.rb:196:in `run'
/var/www/discourse/plugins/docker_manager/lib/docker_manager/upgrader.rb:93: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/2.7.0/gems/bootsnap-1.5.1/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:59:in `load'
/var/www/discourse/vendor/bundle/ruby/2.7.0/gems/bootsnap-1.5.1/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:59:in `load'
/var/www/discourse/vendor/bundle/ruby/2.7.0/gems/railties-6.0.3.3/lib/rails/commands/runner/runner_command.rb:42:in `perform'
/var/www/discourse/vendor/bundle/ruby/2.7.0/gems/thor-1.0.1/lib/thor/command.rb:27:in `run'
/var/www/discourse/vendor/bundle/ruby/2.7.0/gems/thor-1.0.1/lib/thor/invocation.rb:127:in `invoke_command'
/var/www/discourse/vendor/bundle/ruby/2.7.0/gems/thor-1.0.1/lib/thor.rb:392:in `dispatch'
/var/www/discourse/vendor/bundle/ruby/2.7.0/gems/railties-6.0.3.3/lib/rails/command/base.rb:69:in `perform'
/var/www/discourse/vendor/bundle/ruby/2.7.0/gems/railties-6.0.3.3/lib/rails/command.rb:46:in `invoke'
/var/www/discourse/vendor/bundle/ruby/2.7.0/gems/railties-6.0.3.3/lib/rails/commands.rb:18:in `<main>'
/var/www/discourse/vendor/bundle/ruby/2.7.0/gems/bootsnap-1.5.1/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:23:in `require'
/var/www/discourse/vendor/bundle/ruby/2.7.0/gems/bootsnap-1.5.1/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:23:in `block in require_with_bootsnap_lfi'
/var/www/discourse/vendor/bundle/ruby/2.7.0/gems/bootsnap-1.5.1/lib/bootsnap/load_path_cache/loaded_features_index.rb:92:in `register'
/var/www/discourse/vendor/bundle/ruby/2.7.0/gems/bootsnap-1.5.1/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:22:in `require_with_bootsnap_lfi'
/var/www/discourse/vendor/bundle/ruby/2.7.0/gems/bootsnap-1.5.1/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:31:in `require'
/var/www/discourse/vendor/bundle/ruby/2.7.0/gems/activesupport-6.0.3.3/lib/active_support/dependencies.rb:324:in `block in require'
/var/www/discourse/vendor/bundle/ruby/2.7.0/gems/activesupport-6.0.3.3/lib/active_support/dependencies.rb:291:in `load_dependency'
/var/www/discourse/vendor/bundle/ruby/2.7.0/gems/activesupport-6.0.3.3/lib/active_support/dependencies.rb:324:in `require'
bin/rails:17:in `<main>'
Spinning up 7 Unicorn worker(s) that were stopped initially

When I try to rebuild the container manually using ./launcher rebuild app it also fails while trying to update gems:

Log
I, [2021-02-26T12:23:11.223827 #1]  INFO -- : > cd /var/www/discourse && gem update bundler
ERROR:  While executing gem ... (Gem::RemoteFetcher::UnknownHostError)
    timed out (https://rubygems.org/specs.4.8.gz)
I, [2021-02-26T12:24:11.735359 #1]  INFO -- :
I, [2021-02-26T12:24:11.736230 #1]  INFO -- : Terminating async processes
I, [2021-02-26T12:24:11.736294 #1]  INFO -- : Sending INT to HOME=/var/lib/postgresql USER=postgres exec chpst -u postgres:postgres:ssl-cert -U postgres:postgres:ssl-cert /usr/lib/postgresql/13/bin/postmaster -D /etc/postgresql/13/main pid: 51
I, [2021-02-26T12:24:11.736371 #1]  INFO -- : Sending TERM to exec chpst -u redis -U redis /usr/bin/redis-server /etc/redis/redis.conf pid: 168
2021-02-26 12:24:11.736 UTC [51] LOG:  received fast shutdown request
168:signal-handler (1614342251) Received SIGTERM scheduling shutdown...
2021-02-26 12:24:11.741 UTC [51] LOG:  aborting any active transactions
2021-02-26 12:24:11.744 UTC [51] LOG:  background worker "logical replication launcher" (PID 60) exited with exit code 1
2021-02-26 12:24:11.747 UTC [55] LOG:  shutting down
2021-02-26 12:24:11.789 UTC [51] LOG:  database system is shut down
168:M 26 Feb 2021 12:24:11.810 # User requested shutdown...
168:M 26 Feb 2021 12:24:11.810 * Saving the final RDB snapshot before exiting.
168:M 26 Feb 2021 12:24:11.865 * DB saved on disk
168:M 26 Feb 2021 12:24:11.865 # Redis is now ready to exit, bye bye...


FAILED
--------------------
Pups::ExecError: cd /var/www/discourse && gem update bundler failed with return #<Process::Status: pid 305 exit 1>
Location of failure: /pups/lib/pups/exec_command.rb:112:in `spawn'
exec failed with the params {"cd"=>"$home", "hook"=>"web", "cmd"=>["gem update bundler", "find $home ! -user discourse -exec chown discourse {} \\+"]}
7e5c5abe3bf7402b1f3464d4675df48d306251160de17810bc0ebba248e8b6fe
** FAILED TO BOOTSTRAP ** please scroll up and look for earlier error messages, there may be more than one.
./discourse-doctor may help diagnose the problem.

The error suggest that it can’t resolve the hostname but when I manually go into a container (debian:buster-slim) everything works fine (I can curl rubygems.org).
Is the Discourse image doing anything funky regarding DNS that could cause this?

1 Like