Trouble updating 10 year old site

AI-generated summary

A user, axfelix, is struggling to update a 10-year-old Discourse instance, encountering issues with the Docker Manager plugin and a yarn version mismatch during rebuilds. The error Could not find module 'discourse/lib/decorators' appears in the browser console, and a PUPS error occurs due to a mismatch between the project’s packageManager setting (yarn@pnpm@9.15.5) and the globally installed Yarn 1.22.22. axfelix initially suspected the issue was related to a web.template.yml configuration but later discovered the root cause was a cherrypicked commit that left the git repository in a detached state, which the Docker update manager plugin couldn’t handle. The problem was resolved by running git reset --hard && ./launcher rebuild app. tobiaseigen suggests that restoring a backup to a new server might be a better long-term solution for such an outdated setup.

Hmmm. I think I’m hitting a similar issue. Running a now 10 year old (!) Discourse instance that’s never been migrated and has been updated consistently inconsistently :slight_smile:

Tried updating Docker Manager via the Dashboard today and am now getting this in browser console when trying to render the Admin settings (specifically, the Customize link generated by the “try disabling some frontend components” message):

loader.js:247 Uncaught (in promise) Error: Could not find module `discourse/lib/decorators` imported from `discourse/plugins/docker_manager/discourse/routes/update`

Getting a PUPS error when trying to rebuild on the CLI:

FAILED
--------------------
Pups::ExecError: cd /var/www/discourse && su discourse -c 'yarn config set network-timeout 60000 -g' failed with return #<Process::Status: pid 280 exit 1>
Location of failure: /usr/local/lib/ruby/gems/3.3.0/gems/pups-1.2.1/lib/pups/exec_command.rb:132:in `spawn'
exec failed with the params {"cd"=>"$home", "hook"=>"yarn", "cmd"=>["if [ \"$version\" != \"tests-passed\" ]; then\n  rm -rf app/assets/javascripts/node_modules\nfi", "su discourse -c 'yarn config set network-timeout 60000 -g'", "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.

There are no other apparent errors in the bootstrap. This is a single-container install… any ideas for how I get unstuck? The site is currently still up but in a pretty bad state.

Oh wait, the PUPS error might be from this:

error This project's package.json defines "packageManager": "yarn@pnpm@9.15.5". However the current global version of Yarn is 1.22.22.

Why in the world…

OK, it looks like this is present in templates/web.template.yml:

  - exec:
      cd: $home
      hook: yarn
      cmd:
        - |-
          if [ "$version" != "tests-passed" ]; then
            rm -rf app/assets/javascripts/node_modules
          fi
        - su discourse -c 'yarn config set network-timeout 60000 -g'
        - su discourse -c 'yarn install --frozen-lockfile && yarn cache clean'

I never added it though… and it looks like there’s a yarn version mismatch in here somehow that’s causing the issue?

Were you able to resolve your problem in the end? Restoring a backup to a new server might end up serving you best here too, rather than wrangling with an ancient setup.

Figured it out, actually! We’d cherrypicked a commit a year ago to deal with something broken in main, and the Docker update manager plugin did not like that (it must not have had a check for a detached git head), which broke the deploy. Just doing a git reset –hard && ./launcher rebuild app on the server fixed it in the end, but it was very confusing in the meantime :slight_smile: