Beta/tests-passed 샘플 컨테이너가 시작되지 않습니다

저와 이 여정을 시작하기 전에, 이 오류가 이미 이 포럼에서 두 번 언급되었음에도(하나 및 둘) '데이터 컨테이너 재빌드’라는 해결책이 효과가 없었다는 점을 참고해 주세요. 저는 완전히 비어 있는 데이터를 사용하고 있으며, 시도 사이에 모든 컨테이너/볼륨/저장 폴더를 삭제하고 있습니다.

또한 제 테스트는 제공된 샘플 파일에 기반하고 있다는 점도 참고해 주세요. 플러그인 문제는 아니며, 모든 플러그인을 제거해 보았습니다.


최신 tests-passed 및 beta 브랜치의 비어 있는 컨테이너를 시작하는 데 문제가 있습니다. Stable은 예상대로 작동합니다. 오류는 standalone 또는 web-only 모드(물론 data를 시작한 후)에서 발생합니다.

설정 오류를 배제하기 위해 다음과 같은 단계를 수행했습니다:

  • samples/standalone.yml 파일을 containers/로 복사했습니다.
  • 파일에서 다음 사항만 변경했습니다:
    • SMTP 주소를 임의의 값으로 변경했습니다.
    • discourse 주소를 임의의 값으로 변경했습니다.
    • 공유 데이터의 위치를 변경했습니다.
    • 443 포트를 제거하고 80 포트 매핑을 변경했습니다. 결과는 standalone.yml에 있습니다.
    • ./laucher rebuild standalone을 실행했습니다. 전체 로그는 rebuilding_standalone.txt에 있습니다.

그리고 다음과 같은 오류가 발생합니다:

RubyZip 3.0 is coming!
**********************

The public API of some Rubyzip classes has been modernized to use named
parameters for optional arguments. Please check your usage of the
following classes:
  * `Zip::File`
  * `Zip::Entry`
  * `Zip::InputStream`
  * `Zip::OutputStream`

Please ensure that your Gemfiles and .gemspecs are suitably restrictive
to avoid an unexpected breakage when 3.0 is released (e.g. ~> 2.3.0).
See https://github.com/rubyzip/rubyzip for details. The Changelog also
lists other enhancements and bugfixes that have been implemented since
version 2.3.0.

I, [2022-07-24T01:58:05.415957 #1]  INFO -- : > cd /var/www/discourse && su discourse -c 'bundle exec rake plugin:pull_compatible_all'
bundler: failed to load command: rake (/var/www/discourse/vendor/bundle/ruby/2.7.0/bin/rake)
/usr/local/lib/ruby/gems/2.7.0/gems/bundler-2.3.18/lib/bundler/runtime.rb:308:in `check_for_activated_spec!': You have already activated uri 0.10.0, but your Gemfile requires uri 0.11.0. Since uri is a default gem, you can either remove your dependency on it or try updating to a newer version of bundler that supports uri as a default gem. (Gem::LoadError)
	from /usr/local/lib/ruby/gems/2.7.0/gems/bundler-2.3.18/lib/bundler/runtime.rb:25:in `block in setup'
	from /usr/local/lib/ruby/gems/2.7.0/gems/bundler-2.3.18/lib/bundler/spec_set.rb:140:in `each'
	from /usr/local/lib/ruby/gems/2.7.0/gems/bundler-2.3.18/lib/bundler/spec_set.rb:140:in `each'
	from /usr/local/lib/ruby/gems/2.7.0/gems/bundler-2.3.18/lib/bundler/runtime.rb:24:in `map'
	from /usr/local/lib/ruby/gems/2.7.0/gems/bundler-2.3.18/lib/bundler/runtime.rb:24:in `setup'
	from /usr/local/lib/ruby/gems/2.7.0/gems/bundler-2.3.18/lib/bundler.rb:162:in `setup'
	from /usr/local/lib/ruby/gems/2.7.0/gems/bundler-2.3.18/lib/bundler/setup.rb:20:in `block in <top (required)>'
	from /usr/local/lib/ruby/gems/2.7.0/gems/bundler-2.3.18/lib/bundler/ui/shell.rb:136:in `with_level'
	from /usr/local/lib/ruby/gems/2.7.0/gems/bundler-2.3.18/lib/bundler/ui/shell.rb:88:in `silence'
	from /usr/local/lib/ruby/gems/2.7.0/gems/bundler-2.3.18/lib/bundler/setup.rb:20:in `<top (required)>'
	from /usr/local/lib/ruby/gems/2.7.0/gems/bundler-2.3.18/lib/bundler/cli/exec.rb:56:in `require_relative'
	from /usr/local/lib/ruby/gems/2.7.0/gems/bundler-2.3.18/lib/bundler/cli/exec.rb:56:in `kernel_load'
	from /usr/local/lib/ruby/gems/2.7.0/gems/bundler-2.3.18/lib/bundler/cli/exec.rb:23:in `run'
	from /usr/local/lib/ruby/gems/2.7.0/gems/bundler-2.3.18/lib/bundler/cli.rb:483:in `exec'
	from /usr/local/lib/ruby/gems/2.7.0/gems/bundler-2.3.18/lib/bundler/vendor/thor/lib/thor/command.rb:27:in `run'
	from /usr/local/lib/ruby/gems/2.7.0/gems/bundler-2.3.18/lib/bundler/vendor/thor/lib/thor/invocation.rb:127:in `invoke_command'
	from /usr/local/lib/ruby/gems/2.7.0/gems/bundler-2.3.18/lib/bundler/vendor/thor/lib/thor.rb:392:in `dispatch'
	from /usr/local/lib/ruby/gems/2.7.0/gems/bundler-2.3.18/lib/bundler/cli.rb:31:in `dispatch'
	from /usr/local/lib/ruby/gems/2.7.0/gems/bundler-2.3.18/lib/bundler/vendor/thor/lib/thor/base.rb:485:in `start'
	from /usr/local/lib/ruby/gems/2.7.0/gems/bundler-2.3.18/lib/bundler/cli.rb:25:in `start'
	from /usr/local/lib/ruby/gems/2.7.0/gems/bundler-2.3.18/exe/bundle:48:in `block in <top (required)>'
	from /usr/local/lib/ruby/gems/2.7.0/gems/bundler-2.3.18/lib/bundler/friendly_errors.rb:120:in `with_friendly_errors'
	from /usr/local/lib/ruby/gems/2.7.0/gems/bundler-2.3.18/exe/bundle:36:in `<top (required)>'
	from /usr/local/bin/bundle:23:in `load'
	from /usr/local/bin/bundle:23:in `<main>'
I, [2022-07-24T01:58:05.702191 #1]  INFO -- : 
I, [2022-07-24T01:58:05.702665 #1]  INFO -- : > cd /var/www/discourse && su discourse -c 'bundle exec rake db:migrate'
bundler: failed to load command: rake (/var/www/discourse/vendor/bundle/ruby/2.7.0/bin/rake)
/usr/local/lib/ruby/gems/2.7.0/gems/bundler-2.3.18/lib/bundler/runtime.rb:308:in `check_for_activated_spec!': You have already activated uri 0.10.0, but your Gemfile requires uri 0.11.0. Since uri is a default gem, you can either remove your dependency on it or try updating to a newer version of bundler that supports uri as a default gem. (Gem::LoadError)
	from /usr/local/lib/ruby/gems/2.7.0/gems/bundler-2.3.18/lib/bundler/runtime.rb:25:in `block in setup'
	from /usr/local/lib/ruby/gems/2.7.0/gems/bundler-2.3.18/lib/bundler/spec_set.rb:140:in `each'
	from /usr/local/lib/ruby/gems/2.7.0/gems/bundler-2.3.18/lib/bundler/spec_set.rb:140:in `each'
	from /usr/local/lib/ruby/gems/2.7.0/gems/bundler-2.3.18/lib/bundler/runtime.rb:24:in `map'
	from /usr/local/lib/ruby/gems/2.7.0/gems/bundler-2.3.18/lib/bundler/runtime.rb:24:in `setup'
	from /usr/local/lib/ruby/gems/2.7.0/gems/bundler-2.3.18/lib/bundler.rb:162:in `setup'
	from /usr/local/lib/ruby/gems/2.7.0/gems/bundler-2.3.18/lib/bundler/setup.rb:20:in `block in <top (required)>'
	from /usr/local/lib/ruby/gems/2.7.0/gems/bundler-2.3.18/lib/bundler/ui/shell.rb:136:in `with_level'
	from /usr/local/lib/ruby/gems/2.7.0/gems/bundler-2.3.18/lib/bundler/ui/shell.rb:88:in `silence'
	from /usr/local/lib/ruby/gems/2.7.0/gems/bundler-2.3.18/lib/bundler/setup.rb:20:in `<top (required)>'
	from /usr/local/lib/ruby/gems/2.7.0/gems/bundler-2.3.18/lib/bundler/cli/exec.rb:56:in `require_relative'
	from /usr/local/lib/ruby/gems/2.7.0/gems/bundler-2.3.18/lib/bundler/cli/exec.rb:56:in `kernel_load'
	from /usr/local/lib/ruby/gems/2.7.0/gems/bundler-2.3.18/lib/bundler/cli/exec.rb:23:in `run'
	from /usr/local/lib/ruby/gems/2.7.0/gems/bundler-2.3.18/lib/bundler/cli.rb:483:in `exec'
	from /usr/local/lib/ruby/gems/2.7.0/gems/bundler-2.3.18/lib/bundler/vendor/thor/lib/thor/command.rb:27:in `run'
	from /usr/local/lib/ruby/gems/2.7.0/gems/bundler-2.3.18/lib/bundler/vendor/thor/lib/thor/invocation.rb:127:in `invoke_command'
	from /usr/local/lib/ruby/gems/2.7.0/gems/bundler-2.3.18/lib/bundler/vendor/thor/lib/thor.rb:392:in `dispatch'
	from /usr/local/lib/ruby/gems/2.7.0/gems/bundler-2.3.18/lib/bundler/cli.rb:31:in `dispatch'
	from /usr/local/lib/ruby/gems/2.7.0/gems/bundler-2.3.18/lib/bundler/vendor/thor/lib/thor/base.rb:485:in `start'
	from /usr/local/lib/ruby/gems/2.7.0/gems/bundler-2.3.18/lib/bundler/cli.rb:25:in `start'
	from /usr/local/lib/ruby/gems/2.7.0/gems/bundler-2.3.18/exe/bundle:48:in `block in <top (required)>'
	from /usr/local/lib/ruby/gems/2.7.0/gems/bundler-2.3.18/lib/bundler/friendly_errors.rb:120:in `with_friendly_errors'
	from /usr/local/lib/ruby/gems/2.7.0/gems/bundler-2.3.18/exe/bundle:36:in `<top (required)>'
	from /usr/local/bin/bundle:23:in `load'
	from /usr/local/bin/bundle:23:in `<main>'
I, [2022-07-24T01:58:05.953429 #1]  INFO -- : 

두 개의 컨테이너 방식(data와 web_only)도 시도해 보았습니다. web only도 동일한 문제가 있습니다.

각 시도 사이에 모든 컨테이너를 중지하고 제거하며, 모든 데이터 폴더도 삭제합니다.

Stable 브랜치는 정상적으로 작동합니다. 이는 예상되지 않는다고 생각합니다.


상황을 설명드리자면, 현재 꽤 곤란한 처지에 놓여 있습니다.

현재 서버가 며칠 안에 종료될 예정이므로, Discourse 설치 환경을 현재 서버에서 새 서버로 급하게 이전해야 합니다.

현재 서버는 2.9.0.beta7 버전입니다. 새 서버는 2.8.6 버전으로 시작할 수 있지만, 다운그레이드이므로 현재 서버의 백업 파일을 새 서버에 적용할 수 없습니다. 또한 위에서 언급한 오류가 발생하기 때문에 2.9.0.beta7 버전으로 새로운 빈 서버를 시작하는 것도 불가능합니다.

현재 서버의 데이터 폴더가 너무 커서 디스크 공간이 부족하여 압축하거나 다른 곳에 복사할 수 없습니다. 설령 가능하다고 해도, 더 새로운 베타 버전의 데이터를 오래된 버전에서 사용하게 되면 문제가 발생할 것으로 추정됩니다. 혹시 모르니 현재 서버를 '다운그레이드’해 보기도 했지만, 이는 지원되지 않는 방식임을 알고 있었고 실제로도 작동하지 않았습니다.

왜 강제로 다운그레이드해야 합니까? 대상 호스트가 최신 버전인지 어떻게 보장할 수 없습니까?

다운그레이드는 원하지 않습니다. 하지만 이 게시글에 첨부한 에러 메시지 때문에 2.9.0.beta7 기반의 새 서버를 시작할 수 없습니다. 현재 2.8.6 버전에서만 새 서버를 시작할 수 있습니다. 샘플 파일과 제 자체 파일을 기반으로 여러 가지 다른 설정을 시도해 보았지만, beta 버전이든 tests-passed 버전이든 시작되지 않습니다. 이 정보가 첫 번째 메시지, 컨테이너 파일, 또는 로그 파일에 명확히 드러나지 않은 것 같아 추가적으로 말씀드립니다.

솔직히 말하자면, 저는 데이터를 한 서버에서 다른 서버로 이동할 수만 있으면 됩니다. 정확한 버전은 중요하지 않지만, 새 서버를 정상적으로 구동시키고 기존 데이터를 새 서버로 이전하는 것이 필요합니다.

현재 구 서버는 2.9.0.beta7 버전입니다. 따라서 최신 버전에서 새 서버를 시작할 수 있어야 하거나(현재 작동하지 않음), 아니면 제가 유일하게 시작할 수 있는 2.8.6 버전의 새 서버로 데이터를 이전하는 방법을 찾아야 합니다.

죄송합니다, 이제 이해했습니다. 그래서 그 에러에 집중해야 하나요?

이상적으로는 그렇습니다. 최신 버전이 설치된 새 서버를 받는 것이 저에게는 가장 간단하고 쉬운 방법입니다.

하지만 어떤 이유로든 그것이 불가능하다면, 다른 대안이 있다면 그것도 기꺼이 활용하겠습니다. 버전 문제로 고집을 부릴 처지는 아닙니다.

참고로 도움이 된다면, 서버의 docker 정보입니다:

# docker info
Client:
 Context:    default
 Debug Mode: false

Server:
 Containers: 2
  Running: 0
  Paused: 0
  Stopped: 2
 Images: 5
 Server Version: 20.10.12
 Storage Driver: overlay2
  Backing Filesystem: extfs
  Supports d_type: true
  Native Overlay Diff: true
  userxattr: false
 Logging Driver: json-file
 Cgroup Driver: systemd
 Cgroup Version: 2
 Plugins:
  Volume: local
  Network: bridge host ipvlan macvlan null overlay
  Log: awslogs fluentd gcplogs gelf journald json-file local logentries splunk syslog
 Swarm: inactive
 Runtimes: nvidia runc io.containerd.runc.v2 io.containerd.runtime.v1.linux
 Default Runtime: runc
 Init Binary: docker-init
 containerd version:
 runc version:
 init version:
 Security Options:
  apparmor
  seccomp
   Profile: default
  cgroupns
 Kernel Version: 5.15.0-41-generic
 Operating System: Ubuntu 22.04 LTS
 OSType: linux
 Architecture: x86_64
 CPUs: 2
 Total Memory: 5.797GiB
 Name: maji
 ID: OIRP:TYAE:HIPS:SIF3:NZRF:22QI:GO5A:64A4:OP2O:ALVA:PPLN:4TOH
 Docker Root Dir: /data/docker
 Debug Mode: false
 Registry: https://index.docker.io/v1/
 Labels:
 Experimental: false
 Insecure Registries:
  127.0.0.0/8
 Live Restore Enabled: false

저는 root 권한으로 런처를 실행하고 있습니다. 동일한 구성의 머신에서 다양한 docker 컨테이너를 실행해 왔는데, 문제가 발생하지 않았습니다.

현재 오류를 보면 파일 권한 문제일 것 같지는 않는데, 파일 권한이 원인이 될 수도 있을지 확실하지 않습니다.

/opt/discourse# ls -la
total 140
drwxr-xr-x 14 root root  4096 Jul 24 01:26 .
drwxr-xr-x  7 root root  4096 Jul 15 07:23 ..
drwxr-xr-x  8 root root  4096 Jul 24 02:30 .git
drwxr-xr-x  3 root root  4096 Jul 15 07:23 .github
-rw-r--r--  1 root root   309 Jul 15 07:23 .gitignore
-rw-r--r--  1 root root  1099 Jul 15 07:23 LICENSE
-rw-r--r--  1 root root  8285 Jul 15 07:23 README.md
drwxr-xr-x  2 root root  4096 Jul 15 07:23 bin
drwxr-xr-x  2 root root  4096 Jul 24 02:34 cids
drwxr-xr-x  2 root root  4096 Jul 24 02:30 containers
-rwxr-xr-x  1 root root 11956 Jul 15 07:23 discourse-doctor
-rwxr-xr-x  1 root root 27053 Jul 15 07:23 discourse-setup
drwxr-xr-x  8 root root  4096 Jul 15 07:23 image
-rwxr-xr-x  1 root root 22547 Jul 15 07:23 launcher
drwxr-xr-x  2 root root  4096 Jul 24 01:39 samples
drwxr-xr-x  2 root root  4096 Jul 15 07:23 scripts
drwxr-xr-x  2 root root  4096 Jul 15 07:23 shared
drwxr-xr-x  3 root root  4096 Jul 15 07:23 templates
drwxr-xr-x  2 root root  4096 Jul 15 07:23 tests
/opt/discourse# ls -la containers/
total 16
drwxr-xr-x  2 root root 4096 Jul 24 02:30 .
drwxr-xr-x 14 root root 4096 Jul 24 01:26 ..
-rw-r--r--  1 root root    0 Jul 15 07:23 .gitkeep
-rw-r--r--  1 root root 1258 Jul 24 02:08 data.yml
-rw-r--r--  1 root root 3542 Jul 24 02:30 web.yml
/opt/discourse# cd /data/discourse/
/data/discourse# ls -la
total 16
drwxr-xr-x 4 root root 4096 Jul 24 02:06 .
drwxr-xr-x 5 root root 4096 Jul 23 11:58 ..
drwxr-xr-x 6 root root 4096 Jul 24 02:09 data
drwxr-xr-x 7 root root 4096 Jul 24 02:34 web

bundle install라고 적혀 있는 줄(약 160번째 줄) 아래에 다음 줄들을 복사해 보세요.

  - exec:
      cd: $home
      cmd:
        - su discourse -c 'gem update uri'

run 블록을 exec: echo "Beginning of custom commands" 아래에 추가해 보았는데, 아마 너무 늦은 시점에 실행된 것 같습니다.

그래서 hooks: -> after_code:에 추가했습니다.

그랬더니 이런 오류가 떴습니다:

I, [2022-07-24T12:13:24.641982 #1]  INFO -- : > cd /var/www/discourse && su discourse -c 'gem update uri'
ERROR:  While executing gem ... (Gem::FilePermissionError)
    You don't have write permissions for the /usr/local/lib/ruby/gems/2.7.0 directory.
I, [2022-07-24T12:13:29.392041 #1]  INFO -- : Updating installed gems
Updating uri

FAILED
--------------------
Pups::ExecError: cd /var/www/discourse && su discourse -c 'gem update uri' failed with return #<Process::Status: pid 132 exit 1>
Location of failure: /pups/lib/pups/exec_command.rb:112:in `spawn'
exec failed with the params {"cd"=>"$home", "cmd"=>["su discourse -c 'gem update uri'"]}

혹시 도움이 될까 싶어 su discourse를 제거해 보았습니다. 그제야 잘 진행되었고, 다른 오류에 부딪혔습니다:

I, [2022-07-24T12:21:17.497935 #1]  INFO -- : > cd /var/www/discourse && su discourse -c 'bundle exec rake themes:update assets:precompile'
sh: 1: yarn: not found
I, [2022-07-24T12:21:19.397390 #1]  INFO -- :


FAILED
--------------------
Pups::ExecError: cd /var/www/discourse && su discourse -c 'bundle exec rake themes:update assets:precompile' failed with return #<Process::Status: pid 5373 exit 127>
Location of failure: /pups/lib/pups/exec_command.rb:112:in `spawn'

그 다음에는 yarn을 수동으로 설치해야 하는 건가 싶었습니다. 혹시 모르니 docker_manager를 포함해 모든 플러그인을 삭제했습니다. 그래도 yarn을 요구하길래, 아예 설치해 보기로 했습니다:

I, [2022-07-24T12:37:42.295754 #1]  INFO -- : > cd /var/www/discourse && su discourse -c 'bundle exec rake plugin:pull_compatible_all'
WARNING: Plugins were activated before running `rake plugin:pull_compatible_all`
  You should prefix this command with LOAD_PLUGINS=0
I, [2022-07-24T12:37:44.807237 #1]  INFO -- :
I, [2022-07-24T12:37:44.807548 #1]  INFO -- : > cd /var/www/discourse && su discourse -c 'bundle exec rake db:migrate'
I, [2022-07-24T12:37:48.578845 #1]  INFO -- :
I, [2022-07-24T12:37:48.579098 #1]  INFO -- : > cd /var/www/discourse && su discourse -c 'bundle exec rake themes:update assets:precompile'
error Command "ember" not found.
I, [2022-07-24T12:37:50.795001 #1]  INFO -- : yarn run v1.22.19
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.



FAILED
--------------------
Pups::ExecError: cd /var/www/discourse && su discourse -c 'bundle exec rake themes:update assets:precompile' failed with return #<Process::Status: pid 5409 exit 1>
Location of failure: /pups/lib/pups/exec_command.rb:112:in `spawn'
exec failed with the params {"cd"=>"$home", "hook"=>"assets_precompile", "cmd"=>["su discourse -c 'bundle exec rake themes:update assets:precompile'"]}

그러자 이번에는 ember를 지적하기 시작했습니다. 수동으로 설치하려고 해도 마찬가지였습니다.

현재 제 after_code는 다음과 같습니다:

hooks:
  after_code:
    - exec:
        cd: $home
        cmd:
          - gem update uri
          - npm install -g yarn
          - npm install -g ember
        #- exec:
        # cd: $home/plugins
        #cmd:
            #- git clone https://github.com/discourse/docker_manager.git

이것이 올바른 경로인지 확실하지 않습니다.

좋은 소식은 이 명령어가 이제 실행되고 있는 것 같다는 점입니다.

이전에 LOAD_PLUGINS가 빠져 있는 것을 알아차렸지만 언급하지 않았습니다. 해당 부분을 제거하셨나요? 원래 템플릿에는 포함되어 있습니다. 템플릿을 수정하셨다면 다른 변경 사항이 있는지 확인해 보시는 것이 나쁠 것은 없습니다. 아니면 구버전을 사용하고 계신 것일 수도 있습니다. git pull을 실행한 후에 rebuild app을 하셨나요?

저는 그 부분을 건드리지 않았습니다. web_only.yml이나 standalone.yml 샘플 파일에서도 찾을 수 없습니다. 제가 추가한 것도 아니지만, 아마도 경고 수준에 불과한 것 같습니다.

제가 겪었던 에러는 플러그인이 아니라 ember와 관련이 있습니다.


솔직히 말하면, git pull을 수십 번이나 실행했지만 꽤 안정적이었고 새로운 커밋이 가져와지지 않았습니다.

해당 커밋의 정확한 링크를 확인하던 중, 제 자동화 스크립트가 master 브랜치를 체크아웃하고 있다는 사실을 깨달았습니다. 아마도 이 경우 경고나 알림이 전혀 표시되지 않는 것 같습니다. main 브랜치를 체크아웃했을 때 정상적으로 작동했습니다. master 브랜치가 지난 해에 변경된 것 같습니다.

그것은 알고 있지만, LOAD_PLUGINS=0이 없었던 것이 저에게는 레포지토리의 이전 버전을 실행하고 있다는 신호였습니다.

런처 시작 부분에 레거시 브랜치를 실행 중이라는 사실을 참조하는 로그 라인이 하나 있었다면 좋았을 것입니다. 그랬으면 많은 노력을 절약할 수 있었을 텐데요.

런처가 자동으로 git 브랜치를 변경해 주는 것이 기대되는 동작인지 모르겠지만, 제 경우에는 분명히 그렇게 되지 않았습니다.