업데이트 문제: 포럼 오류

안녕하세요,

마지막 업데이트 후 문제가 발생했습니다. 제 포럼이 깨져 버렸네요.
SSH에서 다음과 같은 메시지가 표시됩니다.

FAILED
--------------------
Pups::ExecError: cd /var/www/discourse && su discourse -c 'bundle exec rake db:migrate' failed with return #<Process::Status: pid 2472 exit 1>
Location of failure: /usr/local/lib/ruby/gems/2.7.0/gems/pups-1.1.1/lib/pups/exec_command.rb:117:in `spawn'
exec failed with the params {"cd"=>"$home", "hook"=>"db_migrate", "cmd"=>["su discourse -c 'bundle exec rake db:migrate'"]}
3d52a3f170f714bf580dcd30effbf9306fbf6e0ef1f786cf9dd4e326b066e6a4
** 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.

문제가 어디에 있는지, 어떻게 해결해야 하는지 아이디어가 있으신가요?

정말 감사합니다.

위쪽으로 스크롤하여 더 구체적인 오류가 있는지 확인하고, 어떤 내용인지 살펴봐 주시겠어요?

안녕하세요,

전체 프로세스에 대한 pastebin 링크를 첨부합니다. 문제가 거기서 비롯된 것인지는 확신할 수 없지만, postgresql과 관련된 오류가 분명히 존재합니다.

https://pastebin.com/nqLWDRAC

어떻게 설치하셨나요? 어떤 Postgres 버전을 사용 중이신가요?

Caused by:
PG::InsufficientPrivilege: ERROR:  permission denied to create extension "unaccent"
HINT:  Must be superuser to create this extension.

root로 로그인했습니다.
더 높은 권한을 가질 수는 없죠 :slight_smile:

postgres에 대해서는 잘 모르겠어요.
“‘pg_config’ 프로그램은 다음 패키지에 포함되어 있습니다:”

포럼이 온라인 상태입니다.
서버를 재시작했습니다.

첫 번째 문제는 해결되었지만 두 번째 문제가 있습니다.

게시물을 생성하거나 답글을 작성할 때 “500 Internal Server Error” 오류가 발생합니다.

이 오류를 수정하는 방법에 대해 아이디어가 있으신가요?

안녕하세요,

로그 파일에서 이 오류를 발견했습니다.

 ActiveRecord::StatementInvalid (PG::InFailedSqlTransaction: ERROR: current transaction is aborted, commands ignored until end of transaction block ) app/models/post.rb:973:in `block in link_post_uplo 
ActiveRecord::StatementInvalid (PG::InFailedSqlTransaction: ERROR:  current transaction is aborted, commands ignored until end of transaction block
)
app/models/post.rb:973:in `block in link_post_uploads'
app/models/post.rb:972:in `link_post_uploads'
lib/post_creator.rb:217:in `block in create'
lib/post_creator.rb:409:in `block (2 levels) in transaction'
lib/post_creator.rb:408:in `block in transaction'
lib/distributed_mutex.rb:33:in `block in synchronize'
lib/distributed_mutex.rb:29:in `synchronize'
lib/distributed_mutex.rb:29:in `synchronize'
lib/distributed_mutex.rb:14:in `synchronize'
lib/post_creator.rb:407:in `transaction'
lib/post_creator.rb:205:in `create'
lib/new_post_manager.rb:285:in `perform_create_post'
lib/new_post_manager.rb:223:in `perform'
app/controllers/posts_controller.rb:193:in `create'
app/controllers/application_controller.rb:400:in `block in with_resolved_locale'
app/controllers/application_controller.rb:400:in `with_resolved_locale'
lib/middleware/omniauth_bypass_middleware.rb:71:in `call'
lib/content_security_policy/middleware.rb:12:in `call'
lib/middleware/anonymous_cache.rb:358:in `call'
config/initializers/100-quiet_logger.rb:23:in `call'
config/initializers/100-silence_logger.rb:31:in `call'
lib/middleware/enforce_hostname.rb:23:in `call'
lib/middleware/request_tracker.rb:202:in `call'

문제가 무엇인지 혹시 아시는 분 있으신가요?

이것은 표준 설치인가요?

네,

6년 동안 포럼을 이용하고 있습니다.

현재 설치된 마지막 버전은 2.9.0.beta3입니다.

플러그인이 설치되어 있나요? app.yml을 공유해 주시겠어요?

postgres 버전이 어떻게 되나요? launcher enter app을 실행한 후 psql -V를 입력해 보세요.

안녕하세요,

테스트는 해 보았지만 원래 문제가 다시 발생했습니다.

Pups::ExecError: cd /var/www/discourse && su discourse -c 'bundle exec rake db:migrate' failed with return #<Process::Status: pid 2458 exit 1>
Location of failure: /usr/local/lib/ruby/gems/2.7.0/gems/pups-1.1.1/lib/pups/exec_command.rb:117:in `spawn'
exec failed with the params {"cd"=>"$home", "hook"=>"db_migrate", "cmd"=>["su discourse -c 'bundle exec rake db:migrate'"]}
45d3621c802f025ef80ad34e77ec3318a48677b0de0134210120ef7690b6e6f4
** 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.

업데이트할 때 하드 디스크 공간이 부족해서 문제가 생긴 것 같습니다. 공간을 일부 확보해서 지금은 67%가 비어 있습니다. 하지만 기존 문제가 여전히 남아 있는데, 어떤 문제일까요?

‘psql’ 프로그램이 현재 설치되어 있지 않습니다.
설치해야 하나요?

psql 명령을 실행하기 전에

  launcher enter app

을 실행하셨나요?

동일합니다.
설치를 시도했지만 다음과 같은 메시지가 표시됩니다.

E: The package libperl5.22 needs to be reinstalled, but I can't find an archive for it.

pastebin 로그 파일을 다시 확인해 보았습니다. Postgres 10이라고 나와 있습니다.
이것이 discourse/docs/INSTALL-cloud.md at main · discourse/discourse · GitHub 에 따라 설치된 표준 설정이라는 것을 확신하십니까?

이전에 말씀드린 것처럼, 이 포럼은 여러 해 동안 운영되어 왔고 큰 문제는 없었습니다. 보통 재설치나 업데이트만 하면 모든 것이 다시 정상적으로 작동했습니다.
네, 일반적인 설치 방식입니다.

마지막 시도입니다.

아래 내용을 복사해서 답글로 붙여넣어 주시겠어요? 명령어와 출력 결과를 모두 포함해서요.

cd /var/discourse
./launcher enter app
psql -V
psql (PostgreSQL) 10.19 (Debian 10.19-1.pgdg110+1)

네, 좋습니다. 지난번과는 다른 결과네요.
이제 다음을 수행해 주세요

cd /var/discourse
git pull
./launcher rebuild app

오류가 발생하면 명령어를 포함하여 전체 출력을 답변에 (또는 Pastebin에) 올려 주세요.

흥미롭게도 저도 동일하거나 유사한 오류를 경험했습니다. Discourse 2.9.0.beta2를 사용하다가 ß3로 업데이트를 시도했습니다. ./launcher rebuild app을 실행하기 위해 docker_manager를 제외한 모든 플러그인을 비활성화했습니다. 외부 PGSQL 데이터베이스를 사용 중이며 버전은 다음과 같습니다:

$ psql --version
psql (PostgreSQL) 14.1 (Ubuntu 14.1-1.pgdg18.04+1)

실패 후 ./launcher restart app으로 컨테이너를 재시작할 수는 있지만, 응답이 500 오류를 반환합니다.

리빌드/업그레이드 중 발생한 최종 오류는 다음과 같습니다:

FAILED
--------------------
Pups::ExecError: cd /var/www/discourse && su discourse -c 'bundle exec rake db:migrate' failed with return #<Process::Status: pid 658 exit 1>
Location of failure: /usr/local/lib/ruby/gems/2.7.0/gems/pups-1.1.1/lib/pups/exec_command.rb:117:in `spawn'
exec failed with the params {"cd"=>"$home", "hook"=>"db_migrate", "cmd"=>["su discourse -c 'bundle exec rake db:migrate'"]}
bootstrap failed with exit code 1
** FAILED TO BOOTSTRAP ** please scroll up and look for earlier error messages, there may be more than one.

실제로 의미 있는 오류는 여기에서 찾을 수 있습니다: https://p153.p0.n0.cdn.getcloudapp.com/items/jkuvPekN/feb38236-3b84-410e-8fac-d1864d02ba69.txt?v=eb1d15e029cb07a73300d8ec07318876

이것이 실제 권한 문제라고 믿기 어렵고, Discourse DB 사용자에게 pgsql에 대해 super user/root 권한을 부여하는 데는 망설여집니다.

이렇게 최근에 발생한 문제와 관련하여 무엇이 일어나고 있는지 다른 의견이 있으신가요?