수 시간 후 discourse 업데이트 실패 - POSTGRES 업그레이드 실패

오랜만에 Discourse를 업그레이드하려고 오늘 시도해 보았습니다. 브라우저에서 admin/update 페이지를 열었는데, 모든 것이 최신 상태라는 메시지가 표시되지만, 현재 표시되는 버전은 v2.4.0.beta2 +17입니다. 최신 버전이 3.6.0.beta2라는 것을 알고 있습니다.

그래서 터미널에서 ./launcher rebuild app 명령어를 사용하여 업데이트를 시도해 보았으나, UPGRADE OF POSTGRES FAILED(포스트그레SQL 업그레이드 실패)라는 메시지와 함께 실패했습니다. 지원 페이지를 읽고 해당 페이지와 포스트그레SQL 업데이트 문제와 관련된 유사한 게시물의 모든 지시를 따랐지만, 문제를 해결하지 못했습니다.

/var/discourse/shared/standalone/log/var-log/postgres의 로그를 확인해 보았는데, 다음과 같은 반복적인 오류 메시지를 발견했습니다:

2025-11-19 21:42:13.815 GMT [242] LOG: skipping missing configuration file “/shared/postgres_data/postgresql.auto.conf”
2025-11-19 21:42:13.816 UTC [242] FATAL: data directory “/shared/postgres_data” has wrong ownership
2025-11-19 21:42:13.816 UTC [242] HINT: The server must be started by the user that owns the data directory.

한 가지 이해가 안 되는 점은 /shared/postgres_data 디렉터리가 없고, /shared/standalone/postgres_data 디렉터리가 있다는 것입니다.

터미널에서 발생한 오류 메시지는 아래에 포함해 두었습니다. 업그레이드가 정상적으로 작동하도록 도와주는 힌트가 있다면 감사하겠습니다.

감사합니다,

Nick


Success. You can now start the database server using:



    /usr/lib/postgresql/13/bin/pg_ctl -D /shared/postgres_data_new -l logfile start



Ign:1 
 buster-pgdg InRelease

Ign:2 
 buster/updates InRelease

Err:3 
 buster-pgdg Release

  404  Not Found [IP: 151.101.67.52 80]

Err:4 
 buster/updates Release

  404  Not Found [IP: 151.101.2.132 80]

Ign:5 
 buster InRelease

Ign:6 
 buster-updates InRelease

Err:7 
 buster Release

  404  Not Found [IP: 151.101.2.132 80]

Err:8 
 buster-updates Release

  404  Not Found [IP: 151.101.2.132 80]

Get:9 https://deb.nodesource.com/node_15.x buster InRelease [4,584 B]

Reading package lists...

Reading package lists...

Building dependency tree...

Reading state information...

The following additional packages will be installed:

  postgresql-client-10

Suggested packages:

  postgresql-doc-10

The following NEW packages will be installed:

  postgresql-10 postgresql-client-10

0 upgraded, 2 newly installed, 0 to remove and 0 not upgraded.

Need to get 6,441 kB of archives.

After this operation, 30.6 MB of additional disk space will be used.

Err:1 
 buster-pgdg/main amd64 postgresql-client-10 amd64 10.17-1.pgdg100+1

  404  Not Found [IP: 151.101.195.52 80]

Err:2 
 buster-pgdg/main amd64 postgresql-10 amd64 10.17-1.pgdg100+1

  404  Not Found [IP: 151.101.195.52 80]

Stopping PostgreSQL 13 database server: main.



check for "/usr/lib/postgresql/10/bin" failed: No such file or directory



Failure, exiting

-------------------------------------------------------------------------------------

UPGRADE OF POSTGRES FAILED



Please visit 
 for support.



You can run ./launcher start app to restart your app in the meanwhile



FAILED

--------------------

Pups::ExecError: /root/upgrade_postgres failed with return #<Process::Status: pid 50 exit 1>

Location of failure: /pups/lib/pups/exec_command.rb:112:in `spawn'

exec failed with the params "/root/upgrade_postgres"

9f400ba2cca88f79359496e95027cf26c2d5a3672837c5594793cf723585407b

** 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.

명령줄에서 두 번 재구축해야 합니다. PostgreSQL 15 업데이트를 참고하세요.

음. app.yml에서 비표준 바인딩을 사용하고 있을 가능성이 있습니다. 또한 운영체제도 거의 확실히 오래되었습니다. 새로운 VM으로 이동하여 그곳에서 데이터베이스를 복원하는 것을 권장합니다. rsync를 사용하여 Discourse 사이트를 다른 VPS로 이동하기를 참고하세요.

데이터베이스를 복사하지 마세요. 백업을 복원하는 것이 더 쉽습니다.

답변해 주셔서 감사합니다, Jay. 새 VM을 생성하고 기사에서 새 VPS 준비 섹션의 단계를 따랐습니다. 이제 무엇을 해야 할지 모르겠습니다. 새 VPS로 파일 복사 섹션의 단계를 계속 진행해야 하는지 궁금합니다. Discourse를 새로 설치한 후 기존 설치 환경의 데이터베이스를 복원하는 것인지, 아니면 기존 설치 환경의 Discourse 파일을 복사해 오는 것인지 혼란스럽습니다. 기존 VM의 Discourse 파일을 그대로 복사해 오면 기존 VM에서 발생했던 문제가 새 VM에서도 재현될 것 같다는 생각이 듭니다. 하지만 제가 무언가를 오해하고 있는 것 같기도 합니다.

너무 오래된 버전이므로, 클린 인스톨을 수행한 뒤 백업 파일만 새 서버로 복사하는 것을 권장합니다.

  • 기존 사이트 백업
  • rsync -rav oldsite:/var/discourse/shared/backups /var/discourse/shared/
  • DNS를 새 서버로 전환
  • 새 서버에서 ./discourse-setup 실행 (SMTP 값은 기존 app.yml에서 가져오기)
  • ./launcher enter app
  • discourse backup (이 명령은 올바른 권한으로 기본 백업 디렉토리를 생성합니다)
  • discourse enable_restore
  • discourse restore (사용 가능한 백업 목록이 출력됩니다)
  • 복원 명령을 복사하여 붙여넣기

더 복잡한 방법은 데이터베이스를 제외한 모든 것을 다음과 같이 rsync로 동기화하는 것입니다:

rsync -rav --numeric-ids OLD-IP:/var/discourse/shared/ /var/discourse/shared/ --exclude log --exclude postgres_* --exclude redis_data --exclude letsencrypt --exclude ssl --exclude log --exclude tmp --exclude state

제이, 다시 한번 감사합니다. 말씀해 주신 설명에 따라 Discourse를 새로 설치하고 기존 VM의 백업을 복원했는데, 모든 것이 잘 작동하고 있습니다. 앞으로 더 자주 업데이트를 해야겠습니다!

좋아요! 정말 좋습니다. 잘 해결되어서 기쁩니다!

제 게시글이 해결책이었다면, 주제가 닫히도록 :check_mark:을 클릭해 주세요.