새로 설치한 Discourse에서 phpBB import 컨테이너 빌드 실패

새로운 Discourse를 설치했습니다. 모든 기능이 정상적으로 작동합니다. 초기 계정을 만들고, 이메일을 받으며, 로그인 등도 가능합니다.

이제 phpbb3 포럼을 가져와야 합니다. Discourse에 과거 데이터를 채우기 위해 가져오기(import) 유틸리티를 사용하려고 하므로 Migrate a phpBB3 forum to Discourse 에 있는 지침을 따랐습니다.

복사 명령을 실행했습니다.

cp containers/app.yml containers/import.yml

그리고 템플릿 라인을 추가하기 위해 파일을 수정했습니다. 제 사이트는 TLS 인증서를 위해 LetsEncrypt를 사용하므로 SSL과 LetsEncrypt 템플릿 라인이 주석 처리되지 않은 상태입니다 - 이는 지침에 표시된 예시와 약간 다릅니다. 어쨌든, 해당 라인을 주석 처리한 상태와 안 한 상태로 모두 시도해 보았으므로, 그 라인이 문제가 될 것 같지는 않습니다.

나머지 지침을 계속 따라가며 결국 컨테이너 재빌드(rebuild) 명령을 실행했습니다. 명령이 성공적으로 완료되지 않습니다.

94:M 23 Jul 2024 20:14:40.761 * Saving the final RDB snapshot before exiting.
94:M 23 Jul 2024 20:14:40.855 * DB saved on disk
94:M 23 Jul 2024 20:14:40.857 # Redis is now ready to exit, bye bye...
2024-07-23 20:14:41.235 UTC [32] LOG:  database system is shut down


FAILED
--------------------
Errno::ENOENT: No such file or directory @ rb_sysopen - /etc/service/unicorn/run
Location of failure: /usr/local/lib/ruby/gems/3.3.0/gems/pups-1.2.1/lib/pups/replace_command.rb:11:in `read'
replace failed with the params {"tag"=>"precompile", "filename"=>"/etc/service/unicorn/run", "from"=>"PRECOMPILE_ON_BOOT=1", "to"=>"PRECOMPILE_ON_BOOT=0"}
bootstrap failed with exit code 1
** 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.
6f1a0b5cd0cfc8ed542938b7439aeff0a21a0135c58617fa5a05e68fd6fcc70d

이 문제를 어떻게 해결해야 할지 확실하지 않습니다. 여러 곳에서 여러 번 설치해 본 경험이 있습니다. 읽은 내용으로 판단할 때, 이 재빌드 단계(실제 데이터 가져오기가 아닌 단계)는 그냥 실행되어야 하는 것 같습니다. 이것이 최신 버전의 Discourse 관련 문제일 수 있을까요? 몇 달 전에는 테스트로 가져오기를 처음부터 끝까지 성공적으로 수행한 적이 있습니다.

네.

출력의 더 많은 부분을 공유하거나 이해해야 합니다.

공통된 시작점을 만들기 위해 VPS(Ubuntu 22.04)를 재설치하고 apt update && apt upgrade를 실행한 후, 표준 Discourse 설치 과정을 시작했습니다.

이 정보가 관련이 있을 수 있으므로, 첫 번째 ./discourse-setup 실행 중 정보를 입력하는 과정에서 실수를 저질렀습니다. 그 결과 Ctrl+C를 눌러 중단한 뒤 ./discourse-setup를 다시 실행했습니다. 두 번째 ./discourse-setup 실행에서는 다음과 같이 새로운 discourse/base가 가져와지는 것이 확인됩니다…

root@discourse:/var/discourse# ./discourse-setup 
The configuration file containers/app.yml already exists!

. . . reconfiguring . . .


Saving old file as app.yml.2024-07-29-151604.bak
Stopping existing container in 5 seconds or Control-C to cancel.
x86_64 arch detected.

WARNING: We are about to start downloading the Discourse base image
This process may take anywhere between a few minutes to an hour, depending on your network speed

Please be patient

2.0.20240708-0023: Pulling from discourse/base
76956b537f14: Pull complete 
c5ffad89ad3c: Pull complete 
71c31a50a587: Pull complete 
c1a1234dcb61: Pull complete 
9980a27afc32: Pull complete 
4f4fb700ef54: Pull complete 
304b565c70c9: Pull complete 
8ad811162d08: Pull complete 
2c324dce526d: Pull complete 
52d141c2b1c8: Pull complete 
4c08fdcd145a: Pull complete 
1b6035ac25c0: Pull complete 
9208d0f90623: Pull complete 
513dccf6f63f: Pull complete 
e0b141854963: Pull complete 
4476d7dd9441: Pull complete 
0fad77941078: Pull complete 
46c34476ea19: Pull complete 
ff0b86516349: Pull complete 
c33170d09c8b: Pull complete 
ed4a793ffe51: Pull complete 
3a7b2554e089: Pull complete 
3ad8a6408839: Pull complete 
e7c58bcc7f57: Pull complete 
59b2407fe431: Pull complete 
315160f4d4f8: Pull complete 
ad328ba96976: Pull complete 
825dca2e642e: Pull complete 
9fbd8c908047: Pull complete 
b1d30330e969: Pull complete 
8c76c65bb8e8: Pull complete 
9279965667b5: Pull complete 
a0ae3eb4d088: Pull complete 
819fb509ef8b: Pull complete 
c962935d47d4: Pull complete 
63b444b5bd1e: Pull complete 
7efa1c09faf6: Pull complete 
46c4327ce462: Pull complete 
b095ebe7bdf6: Pull complete 
3aa16a533cab: Pull complete 
41419e4f1948: Pull complete 
589837814d9a: Pull complete 
bd025ad1b844: Pull complete 
24762ff7528f: Pull complete 
fe364253c657: Pull complete 
Digest: sha256:025e9c1f6848c4726544c6ae873d710c62f547b72afb7f537aaa44eb5377cb5c
Status: Downloaded newer image for discourse/base:2.0.20240708-0023
docker.io/discourse/base:2.0.20240708-0023
app was not started !
./discourse-doctor may help diagnose the problem.

Found 3GB of memory and 2 physical CPU cores
setting db_shared_buffers = 768MB
setting UNICORN_WORKERS = 4
containers/app.yml memory parameters updated.

Discourse 설치는 계속 진행되어 완료되었습니다. 초기 계정을 생성하고 로그인하는 데 성공했습니다.

I, [2024-07-29T15:42:21.624379 #1]  INFO -- : Replacing location @discourse { with location @discourse {
add_header Strict-Transport-Security 'max-age=31536000'; # remember the certificate for a year and automatically connect to HTTPS for this domain in /etc/nginx/conf.d/discourse.conf
I, [2024-07-29T15:42:21.627858 #1]  INFO -- : > echo "Beginning of custom commands"
I, [2024-07-29T15:42:21.634022 #1]  INFO -- : Beginning of custom commands

I, [2024-07-29T15:42:21.637436 #1]  INFO -- : > echo "End of custom commands"
I, [2024-07-29T15:42:21.642766 #1]  INFO -- : End of custom commands

I, [2024-07-29T15:42:21.648034 #1]  INFO -- : Terminating async processes
I, [2024-07-29T15:42:21.649479 #1]  INFO -- : Sending INT to HOME=/var/lib/postgresql USER=postgres exec chpst -u postgres:postgres:ssl-cert -U postgres:postgres:ssl-cert /usr/lib/postgresql/13/bin/postmaster -D /etc/postgresql/13/main pid: 57
2024-07-29 15:42:21.651 UTC [57] LOG:  received fast shutdown request
I, [2024-07-29T15:42:21.652067 #1]  INFO -- : Sending TERM to exec chpst -u redis -U redis /usr/bin/redis-server /etc/redis/redis.conf pid: 120
120:signal-handler (1722267741) Received SIGTERM scheduling shutdown...
2024-07-29 15:42:21.658 UTC [57] LOG:  aborting any active transactions
120:M 29 Jul 2024 15:42:21.667 # User requested shutdown...
120:M 29 Jul 2024 15:42:21.668 * Saving the final RDB snapshot before exiting.
2024-07-29 15:42:21.682 UTC [57] LOG:  background worker "logical replication launcher" (PID 72) exited with exit code 1
120:M 29 Jul 2024 15:42:21.682 * DB saved on disk
120:M 29 Jul 2024 15:42:21.683 # Redis is now ready to exit, bye bye...
2024-07-29 15:42:21.685 UTC [67] LOG:  shutting down
2024-07-29 15:42:21.806 UTC [57] LOG:  database system is shut down
sha256:6a6d6a8ea3559ad031a84fd48a164686e9440d7e857cb39619c2baba84a4b966
2b8eddd7b72415507d10cc404c40459c19c7ad3e025cb7bb69bcddb3c98b0197

+ /usr/bin/docker run --shm-size=512m -d --restart=always -e LANG=en_US.UTF-8 -e RAILS_ENV=production -e UNICORN_WORKERS=4 -e UNICORN_SIDEKIQS=1 -e RUBY_GC_HEAP_GROWTH_MAX_SLOTS=40000 -e RUBY_GC_HEAP_INIT_SLOTS=400000 -e RUBY_GC_HEAP_OLDOBJECT_LIMIT_FACTOR=1.5 -e DISCOURSE_DB_SOCKET=/var/run/postgresql -e DISCOURSE_DB_HOST= -e DISCOURSE_DB_PORT= -e LETSENCRYPT_DIR=/shared/letsencrypt -e DISCOURSE_FORCE_HTTPS=true -e LC_ALL=en_US.UTF-8 -e LANGUAGE=en_US.UTF-8 -e DISCOURSE_HOSTNAME=discourse3.greenbullfrog.com -e DISCOURSE_DEVELOPER_EMAILS=discourse-admin@greenbullfrog.com -e DISCOURSE_SMTP_ADDRESS=box.greenbullfrog.com -e DISCOURSE_SMTP_PORT=587 -e DISCOURSE_SMTP_USER_NAME=discourse@greenbullfrog.com -e DISCOURSE_SMTP_PASSWORD=lAtDyjbyqztzhrG -e DISCOURSE_SMTP_DOMAIN=discourse3.greenbullfrog.com -e DISCOURSE_NOTIFICATION_EMAIL=noreply@discourse3.greenbullfrog.com -e LETSENCRYPT_ACCOUNT_EMAIL=letsencrypt@greenbullfrog.com -h discourse-app -e DOCKER_HOST_IP=172.17.0.1 --name app -t -p 80:80 -p 443:443 -v /var/discourse/shared/standalone:/shared -v /var/discourse/shared/standalone/log/var-log:/var/log --mac-address 02:f9:8c:dd:3d:63 local_discourse/app /sbin/boot
a78541042858ed6a4dd739bb7c8243a50a4064f595fdf968c22c8b63afb68979
root@discourse:/var/discourse# 

그 후, Migrate a phpBB3 forum to Discourse 에 설명된 과정을 시작했습니다.

제 import.yml 파일의 상단 부분입니다…

root@discourse:/var/discourse# head -23 containers/import.yml 
## this is the all-in-one, standalone Discourse Docker container template
##
## After making changes to this file, you MUST rebuild
## /var/discourse/launcher rebuild app
##
## BE *VERY* CAREFUL WHEN EDITING!
## YAML FILES ARE SUPER SUPER SENSITIVE TO MISTAKES IN WHITESPACE OR ALIGNMENT!
## visit http://www.yamllint.com/ to validate this file as needed

templates:
  - "templates/postgres.template.yml"
  - "templates/redis.template.yml"
  - "templates/web.template.yml"
  ## Uncomment the next line to enable the IPv6 listener
  #- "templates/web.ipv6.template.yml"
  - "templates/web.ratelimited.template.yml"
  ## Uncomment these two lines if you wish to add Lets Encrypt (https)
  - "templates/web.ssl.template.yml"
  - "templates/web.letsencrypt.ssl.template.yml"
  - "templates/import/phpbb3.template.yml"

## which TCP/IP ports should this container expose?
## If you want Discourse to share a port with another webserver like Apache or nginx,
root@discourse:/var/discourse# 

문제는 */var/discourse/launcher rebuild import* 명령을 실행할 때 발생합니다. 길이가 길어 해당 명령의 로그를 게시하는 것은 불가능합니다. 그러나 다음 NextCloud 링크에서 다운로드할 수 있습니다…

https://box.greenbullfrog.com/cloud/index.php/s/tAFNPJqBaJ3qA6r

@gerhard, 이 문제는 여전히 당신의 전문 분야일 수 있습니다.

문제는 phpbb3 템플릿이 /etc/service/unicorn을 삭제한 후, 웹 템플릿이 해당 파일을 수정하려고 시도하기 때문인 것 같습니다.

가장 쉬운 방법은 web.template.yml에서 다음 줄들을 삭제하는 것입니다.

  - replace:
      tag: precompile
      filename: /etc/service/unicorn/run
      from: PRECOMPILE_ON_BOOT=1
      to: "PRECOMPILE_ON_BOOT=0"

다만, 원래 컨테이너를 빌드한 후에 이 작업을 수행하고, 다시 빌드하기 전에 다음과 같이 해야 합니다.

git checkout templates/web.template.yml

@pfaffman, 안내해 주셔서 감사합니다.

불행히도 재빌드(rebuild)를 실행한 채로 자리를 비웠다가 돌아왔더니 SSH 세션이 끊겨 있어 빌드 출력을 모두 캡처하지 못했습니다. 재빌드는 Docker 이미지를 생성하고 컨테이너를 시작했기 때문에 정상적으로 완료되었을 것으로 상당히 확신을 갖고 있었습니다.

phpbb3 데이터를 로컬 가져오기(import)에 맞게 올바른 위치에 배치하고 시작 명령을 실행했습니다. 현재 가져오기가 진행 중이지만 완료까지 시간이 좀 걸릴 것으로 보입니다. 결과를 확인해서 내일 다시 답변드리겠습니다.

가져오기가 완료되었고 대부분의 데이터가 성공적으로 마이그레이션된 것으로 보입니다. 일부 phpbb 사용자 계정은 Discourse에서 문제를 일으키는 이메일 주소를 가지고 있는 것 같습니다. 아마도 끝에 공백이 있는 것 같습니다. 전체 절차를 다시 실행하기 전에 먼저 정리해 보겠습니다.

도와주셔서 감사합니다. 현재 버전의 Discourse에서는 빌드가 실패하는 가져오기 유틸리티에 대한 수정이 있을 것으로 추정됩니다. 많은 사람들이 문제를 파고들 기술적인 역량을 갖추지 못해 오류를 만나면 그냥 포기할 가능성이 큽니다. 그렇게 되면 Discourse 커뮤니티가 줄어들고, 방치되거나 삭제된 phpbb 사이트의 과거 토론들이 사라지게 될 것입니다.