Trying to update Discourse via the manual procedure
git pull
./launcher rebuild app
...
./discourse-doctor shows an error
I, [2023-06-16T11:39:43.530890 #1] INFO -- : > cd /var/www/discourse && su discourse -c 'yarn install --frozen-lockfile && yarn cache clean'
error An unexpected error occurred: "https://registry.yarnpkg.com/date-fns/-/date-fns-2.29.3.tgz: ESOCKETTIMEDOUT".
FAILED
--------------------
Pups::ExecError: cd /var/www/discourse && su discourse -c 'yarn install --frozen-lockfile && yarn cache clean' failed with return #<Process::Status: pid 281 exit 1>
Location of failure: /usr/local/lib/ruby/gems/3.2.0/gems/pups-1.1.1/lib/pups/exec_command.rb:117:in `spawn'
exec failed with the params {"cd"=>"$home", "cmd"=>["su discourse -c 'yarn install --frozen-lockfile && yarn cache clean'"]}
bootstrap failed with exit code 1
** 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.
f485460571ab9e30e0d6917b05c9a8fe1772df13d8cae9fe67108961fae71039
==================== END REBUILD LOG ====================
The same problem when I tried to run ./launcher rebuild app
I tried downloading date-fns-2.29.3.tgz on a Linux host, and it works.
wget https://registry.yarnpkg.com/date-fns/-/date-fns-2.29.3.tgz
Connecting to registry.yarnpkg.com (104.16.26.35:443)
saving to 'date-fns-2.29.3.tgz'
date-fns-2.29.3.tgz 100% |*************************************************************************************************************| 712k 0:00:00 ETA
'date-fns-2.29.3.tgz' saved
However, when I was waiting for Step 9 to complete (after running ./discourse-setup) and everything being built, it would fail with an ESOCKETTIMEDOUT error related to yarn. The last message that tries to run is [ ! -d 'node_modules' ] || su discourse -c 'yarn install --production && yarn cache clean'.
The Fix
You need to install an editor; I prefer nano so apt-get install nano does the trick. Then go to /var/discourse/templates and run: nano web.template.yml. For comparison, here is the file you cloned from github and the area of interest is around line 159. Look familiar? It’s the same command noted above before it failed. We need to add a new section above this line to increase the timeout.
Save this change then rerun ./discourse-setup and viola, completion! It will definitely take a while, especially the brotli compression step, but it will finish.