10년 된 사이트 업데이트 문제

음. 비슷한 문제에 부딪힌 것 같습니다. 이제 10년이나 된(!) Discourse 인스턴스를 운영 중인데, 마이그레이션을 한 번도 하지 않았고 업데이트도 일관성 없이 계속 진행해 왔습니다 :slight_smile:

오늘 대시보드에서 Docker Manager를 업데이트하려고 했는데, 관리자 설정(구체적으로는 "일부 프론트엔드 구성 요소를 비활성화해 보세요"라는 메시지에서 생성되는 Customize 링크)을 렌더링할 때 브라우저 콘솔에 다음과 같은 오류가 표시됩니다:

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

CLI에서 리빌드를 시도할 때 PUPS 오류가 발생합니다:

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.

부트스트랩 과정에서 다른 눈에 띄는 오류는 없습니다. 이건 싱글 컨테이너 설치 환경인데… 어떻게 빠져나갈 수 있을까요? 사이트는 아직 켜져 있지만 상태가 매우 좋지 않습니다.

아 잠깐, PUPS 오류가 이 때문일지도 모르겠네:

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

도대체 왜 이런 거지…

자, 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'

근데 내가 이걸 추가한 적은 없는데… 그리고 여기 어딘가에서 yarn 버전 불일치가 있어서 문제가 발생하는 것 같아?

결국 문제를 해결하셨나요? 오래된 설정을 고치기보다 백업을 새 서버에 복원하는 것이 이 경우에도 가장 좋은 해결책이 될 수 있습니다.

결국 해결했어요! 사실 일 년 전에 main에서 깨진 문제를 해결하기 위해 커밋을 체리픽했는데, Docker 업데이트 매니저 플러그인이 그걸 전혀 좋아하지 않았어요 (분리된 git head에 대한 체크가 없었던 것 같네요). 그 때문에 배포가 깨진 거였어요. 결국 서버에서 git reset –hard && ./launcher rebuild app만 실행하니 해결이 됐지만, 그 사이에는 정말 혼란스러웠어요 :slight_smile: