투표 후 플러그인이 이전 질문-답변 플러그인과 충돌

안녕하세요!

변경 사항 이후로 Discourse에서 큰 충돌이 발생하고 있습니다…

  1. 이전에는 다음을 사용했습니다:
- git clone https://github.com/discourse/discourse-question-answer
  1. 오늘 다음을 추가하려고 했습니다:
- git clone https://github.com/discourse/discourse-question-answer
- git clone https://github.com/discourse/discourse-post-voting

두 플러그인 사이에 충돌이 발생했습니다:

요약
I, [2022-12-09T10:13:26.139287 #1]  INFO -- : > cd /var/www/discourse && su discourse -c 'bundle exec rake db:migrate'
/var/www/discourse/plugins/discourse-question-answer/lib/question_answer/engine.rb:4: warning: already initialized constant QuestionAnswer::CREATE_AS_QA_DEFAULT
/var/www/discourse/plugins/discourse-post-voting/lib/question_answer/engine.rb:4: warning: previous definition of CREATE_AS_QA_DEFAULT was here
/var/www/discourse/plugins/discourse-question-answer/app/controllers/question_answer/votes_controller.rb:75: warning: already initialized constant QuestionAnswer::VotesController::VOTERS_LIMIT
/var/www/discourse/plugins/discourse-post-voting/app/controllers/question_answer/votes_controller.rb:75: warning: previous definition of VOTERS_LIMIT was here
/var/www/discourse/plugins/discourse-question-answer/app/models/question_answer_vote.rb:7: warning: already initialized constant QuestionAnswerVote::VOTABLE_TYPES
/var/www/discourse/plugins/discourse-post-voting/app/models/question_answer_vote.rb:7: warning: previous definition of VOTABLE_TYPES was here
/var/www/discourse/plugins/discourse-question-answer/app/models/question_answer_comment.rb:7: warning: already initialized constant QuestionAnswerComment::COOKED_VERSION
/var/www/discourse/plugins/discourse-post-voting/app/models/question_answer_comment.rb:7: warning: previous definition of COOKED_VERSION was here
/var/www/discourse/plugins/discourse-question-answer/app/models/question_answer_comment.rb:26: warning: already initialized constant QuestionAnswerComment::MARKDOWN_FEATURES
/var/www/discourse/plugins/discourse-post-voting/app/models/question_answer_comment.rb:26: warning: previous definition of MARKDOWN_FEATURES was here
/var/www/discourse/plugins/discourse-question-answer/app/models/question_answer_comment.rb:31: warning: already initialized constant QuestionAnswerComment::MARKDOWN_IT_RULES
/var/www/discourse/plugins/discourse-post-voting/app/models/question_answer_comment.rb:31: warning: previous definition of MARKDOWN_IT_RULES was here
/var/www/discourse/plugins/discourse-question-answer/extensions/topic_extension.rb:9: warning: already initialized constant Topic::QA_SUBTYPE
/var/www/discourse/plugins/discourse-post-voting/extensions/topic_extension.rb:9: warning: previous definition of QA_SUBTYPE was here
rake aborted!
ArgumentError: Invalid route name, already in use: 'question_answer' 
You may have defined two routes with the same name using the `:as` option, or you may be overriding a route already defined by a resource with the same naming. For the latter, you can restrict the routes created with `resources` as explained here: 
https://guides.rubyonrails.org/routing.html#restricting-the-routes-created
/var/www/discourse/vendor/bundle/ruby/2.7.0/gems/actionpack-6.1.6.1/lib/action_dispatch/routing/route_set.rb:587:in `add_route'
/var/www/discourse/vendor/bundle/ruby/2.7.0/gems/actionpack-6.1.6.1/lib/action_dispatch/routing/mapper.rb:1986:in `add_route'
/var/www/discourse/vendor/bundle/ruby/2.7.0/gems/actionpack-6.1.6.1/lib/action_dispatch/routing/mapper.rb:1957:in `decomposed_match'
/var/www/discourse/vendor/bundle/ruby/2.7.0/gems/actionpack-6.1.6.1/lib/action_dispatch/routing/mapper.rb:1921:in `block in map_match'
/var/www/discourse/vendor/bundle/ruby/2.7.0/gems/actionpack-6.1.6.1/lib/action_dispatch/routing/mapper.rb:1915:in `each'
/var/www/discourse/vendor/bundle/ruby/2.7.0/gems/actionpack-6.1.6.1/lib/action_dispatch/routing/mapper.rb:1915:in `map_match'
/var/www/discourse/vendor/bundle/ruby/2.7.0/gems/actionpack-6.1.6.1/lib/action_dispatch/routing/mapper.rb:1663:in `match'
/var/www/discourse/vendor/bundle/ruby/2.7.0/gems/actionpack-6.1.6.1/lib/action_dispatch/routing/mapper.rb:642:in `mount'
/var/www/discourse/plugins/discourse-question-answer/config/routes.rb:16:in `block in <main>'
/var/www/discourse/vendor/bundle/ruby/2.7.0/gems/actionpack-6.1.6.1/lib/action_dispatch/routing/route_set.rb:427:in `instance_exec'
/var/www/discourse/vendor/bundle/ruby/2.7.0/gems/actionpack-6.1.6.1/lib/action_dispatch/routing/route_set.rb:427:in `eval_block'
/var/www/discourse/vendor/bundle/ruby/2.7.0/gems/actionpack-6.1.6.1/lib/action_dispatch/routing/route_set.rb:434:in `block in finalize!'
/var/www/discourse/vendor/bundle/ruby/2.7.0/gems/actionpack-6.1.6.1/lib/action_dispatch/routing/route_set.rb:434:in `each'
/var/www/discourse/vendor/bundle/ruby/2.7.0/gems/actionpack-6.1.6.1/lib/action_dispatch/routing/route_set.rb:434:in `finalize!'
/var/www/discourse/vendor/bundle/ruby/2.7.0/gems/railties-6.1.6.1/lib/rails/application/routes_reloader.rb:51:in `each'
/var/www/discourse/vendor/bundle/ruby/2.7.0/gems/railties-6.1.6.1/lib/rails/application/routes_reloader.rb:51:in `finalize!'
/var/www/discourse/vendor/bundle/ruby/2.7.0/gems/railties-6.1.6.1/lib/rails/application/routes_reloader.rb:22:in `reload!'
/var/www/discourse/vendor/bundle/ruby/2.7.0/gems/railties-6.1.6.1/lib/rails/application/routes_reloader.rb:35:in `block in updater'
/var/www/discourse/vendor/bundle/ruby/2.7.0/gems/activesupport-6.1.6.1/lib/active_support/file_update_checker.rb:83:in `execute'
/var/www/discourse/vendor/bundle/ruby/2.7.0/gems/railties-6.1.6.1/lib/rails/application/routes_reloader.rb:10:in `execute'
/var/www/discourse/vendor/bundle/ruby/2.7.0/gems/railties-6.1.6.1/lib/rails/application/finisher.rb:195:in `block in <module:Finisher>'
/var/www/discourse/vendor/bundle/ruby/2.7.0/gems/railties-6.1.6.1/lib/rails/initializable.rb:32:in `instance_exec'
/var/www/discourse/vendor/bundle/ruby/2.7.0/gems/railties-6.1.6.1/lib/rails/initializable.rb:32:in `run'
/var/www/discourse/vendor/bundle/ruby/2.7.0/gems/railties-6.1.6.1/lib/rails/initializable.rb:61:in `block in run_initializers'
/var/www/discourse/vendor/bundle/ruby/2.7.0/gems/railties-6.1.6.1/lib/rails/initializable.rb:60:in `run_initializers'
/var/www/discourse/vendor/bundle/ruby/2.7.0/gems/railties-6.1.6.1/lib/rails/application.rb:391:in `initialize!'
/var/www/discourse/vendor/bundle/ruby/2.7.0/gems/railties-6.1.6.1/lib/rails/railtie.rb:207:in `public_send'
/var/www/discourse/vendor/bundle/ruby/2.7.0/gems/railties-6.1.6.1/lib/rails/railtie.rb:207:in `method_missing'
/var/www/discourse/config/environment.rb:7:in `<main>'
/var/www/discourse/vendor/bundle/ruby/2.7.0/gems/bootsnap-1.9.4/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:23:in `require'
/var/www/discourse/vendor/bundle/ruby/2.7.0/gems/bootsnap-1.9.4/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:23:in `block in require_with_bootsnap_lfi'
/var/www/discourse/vendor/bundle/ruby/2.7.0/gems/bootsnap-1.9.4/lib/bootsnap/load_path_cache/loaded_features_index.rb:88:in `register'
/var/www/discourse/vendor/bundle/ruby/2.7.0/gems/bootsnap-1.9.4/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:22:in `require_with_bootsnap_lfi'
/var/www/discourse/vendor/bundle/ruby/2.7.0/gems/bootsnap-1.9.4/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:31:in `require'
/var/www/discourse/vendor/bundle/ruby/2.7.0/gems/zeitwerk-2.6.0/lib/zeitwerk/kernel.rb:35:in `require'
/var/www/discourse/vendor/bundle/ruby/2.7.0/gems/activesupport-6.1.6.1/lib/active_support/dependencies.rb:332:in `block in require'
/var/www/discourse/vendor/bundle/ruby/2.7.0/gems/activesupport-6.1.6.1/lib/active_support/dependencies.rb:299:in `load_dependency'
/var/www/discourse/vendor/bundle/ruby/2.7.0/gems/activesupport-6.1.6.1/lib/active_support/dependencies.rb:332:in `require'
/var/www/discourse/vendor/bundle/ruby/2.7.0/gems/railties-6.1.6.1/lib/rails/application.rb:367:in `require_environment!'
/var/www/discourse/vendor/bundle/ruby/2.7.0/gems/railties-6.1.6.1/lib/rails/application.rb:533:in `block in run_tasks_blocks'
/var/www/discourse/vendor/bundle/ruby/2.7.0/gems/rake-13.0.6/exe/rake:27:in `<top (required)>'
/usr/local/bin/bundle:25:in `load'
/usr/local/bin/bundle:25:in `<main>'
Tasks: TOP => db:migrate => db:load_config => environment
(See full trace by running task with --trace)
I, [2022-12-09T10:13:36.170591 #1]  INFO -- : gem install rrule -v 0.4.4 -i /var/www/discourse/plugins/discourse-calendar/gems/2.7.6 --no-document --ignore-dependencies --no-user-install
Successfully installed rrule-0.4.4
1 gem installed



FAILED
--------------------
  1. 그런 다음 첫 번째 플러그인을 제거했습니다. 빌드는 성공했지만 더 이상 앱이 실행되지 않습니다:
    • HTTP 500 오류가 발생했습니다.
    • nginx 오류 로그에는 다음과 같은 내용이 표시됩니다:
    root@slazvmeutp01:/opt/discourse# cat /var/opt/discourse/var-log/nginx/error.log
    2022/12/09 10:47:34 [notice] 537#537: signal process started
    2022/12/09 10:47:37 [error] 554#554: *2 connect() failed (111: Connection refused) while connecting to upstream, client: 18.156.156.214, server: _, request: "POST /message-bus/76e1bd78eedf43a5a337b6f44a8b88d0/poll?dlp=t HTTP/2.0", upstream: "http://127.0.0.1:3000/message-bus/76e1bd78eedf43a5a337b6f44a8b88d0/poll?dlp=t", host: "mydiscourse.domain.com", referrer: "https://mydiscourse.domain.com/admin/plugins"
    2022/12/09 10:59:08 [crit] 554#554: *398 SSL_do_handshake() failed (SSL: error:141CF06C:SSL routines:tls_parse_ctos_key_share:bad key share) while SSL handshaking, client: 212.102.40.218, server: 0.0.0.0:443
    2022/12/09 11:25:50 [notice] 530#530: signal process started
    

Git 저장소 https://github.com/discourse/discourse-question-answer가 이제 두 번째 저장소인 https://github.com/discourse/discourse-post-voting으로 리다이렉트되는 것을 확인했습니다.
따라서 오늘 첫 번째 빌드 시 발생한 충돌을 설명할 수 있습니다.
하지만 지금은 어떻게 된 것일까요? 플러그인 오류 대신 TLS 오류가 언급되고 있습니다…

어떤 아이디어라도 있을까요?

discourse-post-voting만 사용하는 것이 올바른 방법입니다. :+1:

nginx 오류 로그에 대해서는 확신이 없지만, 플러그인 목록에 discourse-feature-voting도 함께 포함되어 있지는 않은가요?

오, 맞았네요!!
저도 설치되어 있었고, Git 저장소도 https://github.com/discourse/discourse-post-voting으로 리다이렉트되는 걸 확인했습니다!! :scream_cat:

하지만 잠깐… topic-voting과 q&a가 post-voting으로 통합된 건가요? 기능이 누적되는 건가요?

그래서 제 최신 플러그인 목록은 다음과 같습니다:

hooks:
  after_code:
    - exec:
        cd: $home/plugins
        cmd:
          - mkdir -p plugins
          - git clone https://github.com/discourse/docker_manager.git
          - git clone https://github.com/discourse/discourse-openid-connect
          - git clone https://github.com/discourse/discourse-solved
          - git clone https://github.com/discourse/discourse-yearly-review
          - git clone https://github.com/discourse/discourse-checklist
          - git clone https://github.com/discourse/discourse-docs
          - git clone https://github.com/discourse/discourse-reactions
            #- git clone https://github.com/discourse/discourse-feature-voting
          - git clone https://github.com/discourse/discourse-calendar
            #- git clone https://github.com/discourse/discourse-gamification
          - git clone https://github.com/discourse/discourse-gamification && cd discourse-gamification && git checkout 6a399b4c220f31de62049504d27ff6e50611fbef
          - git clone https://github.com/discourse/discourse-follow
          - git clone https://github.com/discourse/discourse-spoiler-alert
          - git clone https://github.com/paviliondev/discourse-news
          - git clone https://github.com/cfstras/discourse-konami.git
            #- git clone https://github.com/discourse/discourse-question-answer
          - git clone https://github.com/discourse/discourse-post-voting

드디어 Discourse가 응답합니다.
하지만 이제 다른 문제들이 생겼습니다:

  1. 플러그인 관리자에서 “질문 & 답변”(question & answer)이 여전히 표시되고 있습니다…
    image
  2. 토픽을 생성할 때, 항목 메뉴가 제대로 표시되지 않습니다:
  3. 카테고리 설정의 Config 항목에 q&a가 항상 표시됩니다.
    image

결국 q&a는 항상 존재하는 것 같습니다…

아니요, 제 말이 틀렸습니다!
별개의 프로젝트입니다. 죄송합니다.

discourse-feature-voting는 https://meta.discourse.org/t/discourse-topic-voting/40121의 이전 이름이었습니다. 여기에 이전 이름이 남아 있으면 post-voting도 함께 설치되어 있을 경우 로딩 충돌이 발생할 수 있습니다. 새로운 discourse-topic-voting을 추가하면 다시 둘 다 사용할 수 있어야 합니다. :+1:

왜 여전히 구식 Q&A 형식을 사용하고 계신지 모르겠습니다. 특정 Gamification 버전을 체크아웃하고 계신 것을 확인했는데, 이는 특정 호환성에 묶여 있기 때문인가요?

네!
저는 Discourse의 “stable” 버전을 추적하는 사람입니다 :sweat_smile:
여기서 언급했던 임시 조치입니다: Database migrate fails in "stable" version - #2 by gmoirod

알겠습니다. 지금 바로 테스트해 보겠습니다.

저도 모르겠습니다 :sob:

공식 post-voting 플러그인은 비교적 최근 'post-voting’으로 이름이 변경되었고, 그 동안 UI 등에서 Q&A 형식으로 사용되었습니다. Stable 버전을 추적하고 계시기 때문에 이러한 변경 사항이 설치 환경에 반영되지 않는 것일 수 있습니다.

플러그인을 제대로 "제거"하는 방법이 있을까요?
q&a와 post-voting을 제거한 후 post-voting을 다시 설치하는 데 사용하면 좋을 것 같습니다…

/admin/upgrade 페이지를 확인했을 때, 투표 후(post-voting) 옆에 표시되는 버전 번호는 무엇인가요?

테스트를 통과하고 최신 상태인 제 쪽의 버전은 다음과 같습니다: 5ea4dccf

수정: 페이지 주소를 올바르게 수정했습니다 :slight_smile:

지금은 topic-voting이 정상적으로 작동하는 것 같습니다.

저는 /plugins 페이지가 없습니다 :thinking:
하지만 /admin/upgrade 페이지에는 다음과 같은 내용이 표시됩니다:

  1. post-voting이 없습니다.
  2. q&a에 녹색 체크 표시가 없습니다.

9월에 아직 질의응답 방식이던 이 커밋에 고정되어 있는 것으로 보입니다:

Stable 버전으로 업데이트를 마쳤나요? 현재 사용 중인 버전은 무엇인가요?


괜찮아 보입니다.



새로운 문제가 발생했습니다…

  1. 깨끗한 상태에서 시작해 보려고 post-voting과 topic-voting을 제거하고 앱을 다시 빌드했습니다 (많은 시도가 있었기 때문에 q&a도 목록에 표시되지 않음): 좋습니다, 더 이상 플러그인이 없습니다.
  2. post-voting과 topic-voting을 다시 가져왔는데 이제 빌드가 실패합니다…
요약
I, [2022-12-09T14:27:32.724323 #1]  INFO -- : > cd /var/www/discourse && su discourse -c 'bundle exec rake themes:update assets:precompile'
Failed to update 'Discourse Loading Slider': Timeout::Error
rake aborted!
Timeout::Error: Timeout::Error
/var/www/discourse/lib/final_destination/resolver.rb:28:in `block in lookup'
/var/www/discourse/lib/final_destination/resolver.rb:7:in `synchronize'
/var/www/discourse/lib/final_destination/resolver.rb:7:in `lookup'
/var/www/discourse/lib/final_destination/ssrf_detector.rb:84:in `lookup_ips'
/var/www/discourse/lib/final_destination/ssrf_detector.rb:64:in `lookup_and_filter_ips'
/var/www/discourse/lib/theme_store/git_importer.rb:139:in `block in clone_http!'
/var/www/discourse/lib/theme_store/git_importer.rb:131:in `each'
/var/www/discourse/lib/theme_store/git_importer.rb:131:in `clone_http!'
/var/www/discourse/lib/theme_store/git_importer.rb:93:in `clone!'
/var/www/discourse/lib/theme_store/git_importer.rb:18:in `import!'
/var/www/discourse/app/models/remote_theme.rb:126:in `update_remote_version'
/var/www/discourse/lib/tasks/themes.rake:62:in `block in update_themes'
/var/www/discourse/vendor/bundle/ruby/2.7.0/gems/activerecord-6.1.6.1/lib/active_record/relation/batches.rb:71:in `block (2 levels) in find_each'
/var/www/discourse/vendor/bundle/ruby/2.7.0/gems/activerecord-6.1.6.1/lib/active_record/relation/batches.rb:71:in `each'
/var/www/discourse/vendor/bundle/ruby/2.7.0/gems/activerecord-6.1.6.1/lib/active_record/relation/batches.rb:71:in `block in find_each'
/var/www/discourse/vendor/bundle/ruby/2.7.0/gems/activerecord-6.1.6.1/lib/active_record/relation/batches.rb:138:in `block in find_in_batches'
/var/www/discourse/vendor/bundle/ruby/2.7.0/gems/activerecord-6.1.6.1/lib/active_record/relation/batches.rb:245:in `block in in_batches'
/var/www/discourse/vendor/bundle/ruby/2.7.0/gems/activerecord-6.1.6.1/lib/active_record/relation/batches.rb:229:in `loop'
/var/www/discourse/vendor/bundle/ruby/2.7.0/gems/activerecord-6.1.6.1/lib/active_record/relation/batches.rb:229:in `in_batches'
/var/www/discourse/vendor/bundle/ruby/2.7.0/gems/activerecord-6.1.6.1/lib/active_record/relation/batches.rb:137:in `find_in_batches'
/var/www/discourse/vendor/bundle/ruby/2.7.0/gems/activerecord-6.1.6.1/lib/active_record/relation/batches.rb:70:in `find_each'
/var/www/discourse/lib/tasks/themes.rake:56:in `update_themes'
/var/www/discourse/lib/tasks/themes.rake:87:in `block (2 levels) in <main>'
/var/www/discourse/vendor/bundle/ruby/2.7.0/gems/rails_multisite-4.0.0/lib/rails_multisite/connection_management.rb:80:in `with_connection'
/var/www/discourse/vendor/bundle/ruby/2.7.0/gems/rails_multisite-4.0.0/lib/rails_multisite/connection_management.rb:90:in `each_connection'
/var/www/discourse/lib/tasks/themes.rake:86:in `block in <main>'
/var/www/discourse/vendor/bundle/ruby/2.7.0/gems/rake-13.0.6/exe/rake:27:in `<top (required)>'
/usr/local/bin/bundle:25:in `load'
/usr/local/bin/bundle:25:in `<main>'
Tasks: TOP => themes:update
(See full trace by running task with --trace)
I, [2022-12-09T14:27:49.987988 #1]  INFO -- : Checking 'Modern Category + Group Boxes' for 'default'... up to date
Checking 'Dark-Light Toggle' for 'default'... updating from cd221006 to 3f72c88f
Checking 'Discourse Loading Slider' for 'default'... 


FAILED
--------------------

다시 빌드하니 통과했습니다.
즉, 'Discourse Loading Slider' 관련 마지막 문제는 단순한 일시적인 오류였습니다.
그건 잊어버리세요.

제 주된 문제는 투표 후에도 Q&A가 그대로 남아 있다는 점입니다…

이 문제는 현재 사용 중인 빌드와 호환성 문제로 인해 발생한 것일 수 있습니다. discourse-topic-voting이 표시되어야 할 위치에 페이지에서 여전히 discourse-voting으로 나타나고 있습니다.

그러니까 ‘tests-passed’ 버전의 Discourse를 사용해야 한다는 말씀이신가요?

최신 버전을 원하신다면. :slightly_smiling_face:

사실 ‘동작하는’ 버전이 더 낫습니다 :sweat_smile:
'tests-passed’가 곧 배포 가능하다는 것처럼 행세하는 버전을 사용해야 한다는 주제가 있다는 건 알고 있어요.
하지만 저는 일종의 'Debian 유저’거든요… 프로덕션 환경에서는 안정성이 중요하니까요!

저도 좋은 선택이라고 생각합니다. :+1: :slightly_smiling_face: 다만, 최신 업데이트를 Stable 버전에서 사용하려면 새 해에 출시될 3.0 버전을 기다려야 한다는 점은 참고해 주세요.

음…

플러그인 관리에서 주어진 git ref를 따라갈 수 있는 방법을 제공하지 않는다는 점은 다소 실망스럽습니다.
그리고 플러그인이 Discourse의 라이프사이클을 따릅니다.
그래서 Discourse와 플러그인 모두를 전역적으로 ‘stable’ 버전으로 따라갈 수 있어야 합니다.
사실 매번 재빌드하거나 플러그인을 도입할 때마다 마치 룰렛을 돌리는 것 같습니다.

Stable 브랜치에 대한 제 지식이 다소 제한적이라 정확한 답변은 어렵지만, Stable 브랜치는 변경 사항을 자주 하지 않는 쪽에 초점을 맞춘 것으로 보입니다. 따라서 Stable 릴리스 기간 외에 새로운 플러그인이나 추가 기능을 도입하는 것은 그 목적에 반하는 것이 아닐까요?

또한 대부분의 Discourse 사이트는 tests-passed를 사용하고 있으며, 일반적으로 눈에 띄는 문제가 발생하지 않습니다. tests-passed를 따르는 것이라 해도 매일 업데이트를 해서 최신 버전으로 유지해야 하는 것은 아니므로, 생각하시는 것만큼 자주 변경되는 것은 아닙니다. /upgrade 페이지에서 업데이트 버튼을 직접 누르거나 재빌드를 수행해야만 해당 변경 사항이 사이트에 반영됩니다.

대안으로, 매니지드 호스팅을 이용하면 이 과정이 더 쉬워집니다. 호스팅 업체가 모든 기술적인 업무를 처리해 주므로, 커뮤니티 운영에 집중할 수 있습니다. :+1: