Migrate a vBulletin 4 forum to Discourse

걱정 마, 제이. 여기서 내 손을 잡아줄 사람이 있다는 게 정말 고마워 :smiley:

내가 제일 걱정하는 건, 변경 사항을 적용했는데 첨부 파일이 하나도 업로드되지 않고 마이그레이션에서는 전부 완료 처리가 되어 있어 처음부터 다시 해야 하는 상황이 생기는 거야.

디스코스에서 short_url 속성이 구체적으로 어떤 용도로 쓰이는지 혹시 알고 있어? 내 취향대로 변경해도 되는 건지, 아니면 나중에 게시글과 첨부 파일을 연결할 때 객체와 일치해야 하는 건지 궁금해.

2개의 좋아요

short_url은 Upload 모델에 있는 함수입니다. 작동하지 않는다면 Upload가 존재하지 않기 때문일 것입니다. 다음으로 find_upload에서 반환되는 upload를 살펴볼 것 같습니다. 실제로 찾지 못하고 있을 수도 있으니까요.

2개의 좋아요

아래는 출력 결과입니다.

식별 데이터(파일 이름 및 S3 버킷 URL)를 변경했습니다.

#418은 작동하지만, #419는 작동하지 않습니다. 속성 데이터가 다르다는 점을 제외하면, 문제없어 보이는데?

419의 파일 이름에는 밑줄이 사용되었지만 418에는 없습니다. 그러나 이전에 밑줄이 포함된 파일 이름도 정상적으로 작동했습니다.

또한 실패한 파일 이름보다 훨씬 더 긴 다른 파일 이름들도 있으므로, 파일 이름 때문이라고 생각되지 않습니다.

2개의 좋아요

위 게시글은 오류가 있었습니다. @pfaffman 님의 추정이 정확했습니다.

제 코드에 제가 추가한 로직 때문에 스크립트가 제 코드에서 충돌했기 때문에, 표시된 마지막 항목이 실제로는 마지막까지 성공적으로 처리된 항목이었습니다.

문제가 된 항목은 파일명을 제외한 모든 속성이 nil로 설정되어 있었습니다.

sha1 속성이 nil인지 간단히 확인하는 로직을 추가하면 문제가 해결되었습니다.

@pfaffman 님께 큰 감사드립니다 <3

3개의 좋아요

내 인생의 이야기!

2개의 좋아요

pfaffman님, 또 귀찮게 해서 죄송합니다. 그런데 이건 정상적인가요?

3679343 / 3550728 (103.6%)

첨부 파일을 업로드하는 동안 100%를 넘은 것 같은데?

1개의 좋아요

즉, 첨부파일의 총 개수를 가져오는 쿼리와 첨부파일 목록을 가져오는 쿼리가 서로 다르다는 뜻입니다. 아마도 첨부파일 수가 잘못되었을 가능성이 큽니다. 무한히 계속된다면, 뭔가 문제가 있는 것입니다. :wink:

1개의 좋아요

@Jack51 님의 훌륭한 단계별 요약글을 시도해 보았습니다.

하지만 (DigitalOcean 환경에서 시도하는 중) mariadb 단계가 실패합니다… 해당 설명에 따라 진행했는데 (10.3 대신 10.5로), 설치 후 mysql 서비스가 인식되지 않습니다.

아마 apt-utils가 설치되지 않았기 때문일 수도 있고… 또한 다음 오류도 발생합니다.
invoke-rc.d: policy-rc.d denied execution of restart.

어떻게 진행해야 할지 모르겠습니다.

수정: discourse를 다시 구축하고 apt-utils를 먼저 설치하도록 했는데… 여전히 같은 오류가 나네요. mariadb 서버를 시작할 수 없습니다.

# apt-get update && apt-get install mariadb-server mariadb-client libmariadbd-dev
Hit:1 http://deb.debian.org/debian bullseye InRelease
Hit:2 http://deb.debian.org/debian bullseye-updates InRelease                                                                                                            
Hit:3 http://deb.debian.org/debian bullseye-backports InRelease                                                                                                          
Hit:4 http://security.debian.org/debian-security bullseye-security InRelease                                                                                             
Hit:5 https://dl.yarnpkg.com/debian stable InRelease                                                                                                                     
Hit:6 http://apt.postgresql.org/pub/repos/apt bullseye-pgdg InRelease                                                                                  
Hit:7 https://deb.nodesource.com/node_16.x bullseye InRelease
Reading package lists... Done
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
The following additional packages will be installed:
  galera-4 iproute2 libaio1 libatm1 libbpf0 libcgi-fast-perl libcgi-pm-perl libclone-perl libconfig-inifiles-perl libdbd-mariadb-perl libdbi-perl libelf1
  libencode-locale-perl libfcgi-bin libfcgi-perl libfcgi0ldbl libhtml-parser-perl libhtml-tagset-perl libhtml-template-perl libhttp-date-perl libhttp-message-perl
  libio-html-perl liblwp-mediatypes-perl libmariadb-dev libmariadb3 libmariadbd19 libmnl0 libsnappy1v5 libterm-readkey-perl libtimedate-perl liburi-perl libxtables12
  lsof mariadb-client-10.5 mariadb-client-core-10.5 mariadb-common mariadb-server-10.5 mariadb-server-core-10.5 mysql-common
Suggested packages:
  iproute2-doc libmldbm-perl libnet-daemon-perl libsql-statement-perl libdata-dump-perl libipc-sharedcache-perl libwww-perl mailx mariadb-test netcat-openbsd
The following NEW packages will be installed:
  galera-4 iproute2 libaio1 libatm1 libbpf0 libcgi-fast-perl libcgi-pm-perl libclone-perl libconfig-inifiles-perl libdbd-mariadb-perl libdbi-perl libelf1
  libencode-locale-perl libfcgi-bin libfcgi-perl libfcgi0ldbl libhtml-parser-perl libhtml-tagset-perl libhtml-template-perl libhttp-date-perl libhttp-message-perl
  libio-html-perl liblwp-mediatypes-perl libmariadb-dev libmariadb3 libmariadbd-dev libmariadbd19 libmnl0 libsnappy1v5 libterm-readkey-perl libtimedate-perl liburi-perl
  libxtables12 lsof mariadb-client mariadb-client-10.5 mariadb-client-core-10.5 mariadb-common mariadb-server mariadb-server-10.5 mariadb-server-core-10.5 mysql-common
0 upgraded, 42 newly installed, 0 to remove and 0 not upgraded.
Need to get 28.9 MB of archives.
After this operation, 227 MB of additional disk space will be used.
Do you want to continue? [Y/n] y
Get:1 http://deb.debian.org/debian bullseye/main amd64 mysql-common all 5.8+1.0.7 [7,464 B]
Get:2 http://deb.debian.org/debian bullseye/main amd64 mariadb-common all 1:10.5.15-0+deb11u1 [36.7 kB]
Get:3 http://deb.debian.org/debian bullseye/main amd64 galera-4 amd64 26.4.11-0+deb11u1 [804 kB]
Get:4 http://deb.debian.org/debian bullseye/main amd64 libelf1 amd64 0.183-1 [165 kB]
Get:5 http://deb.debian.org/debian bullseye/main amd64 libbpf0 amd64 1:0.3-2 [98.3 kB]
Get:6 http://deb.debian.org/debian bullseye/main amd64 libmnl0 amd64 1.0.4-3 [12.5 kB]
Get:7 http://deb.debian.org/debian bullseye/main amd64 libxtables12 amd64 1.8.7-1 [45.1 kB]
Get:8 http://deb.debian.org/debian bullseye/main amd64 iproute2 amd64 5.10.0-4 [930 kB]
Get:9 http://deb.debian.org/debian bullseye/main amd64 libdbi-perl amd64 1.643-3+b1 [780 kB]
Get:10 http://deb.debian.org/debian bullseye/main amd64 lsof amd64 4.93.2+dfsg-1.1 [319 kB]
Get:11 http://deb.debian.org/debian bullseye/main amd64 libconfig-inifiles-perl all 3.000003-1 [52.1 kB]
Get:12 http://deb.debian.org/debian bullseye/main amd64 libmariadb3 amd64 1:10.5.15-0+deb11u1 [176 kB]
Get:13 http://deb.debian.org/debian bullseye/main amd64 mariadb-client-core-10.5 amd64 1:10.5.15-0+deb11u1 [783 kB]
Get:14 http://deb.debian.org/debian bullseye/main amd64 mariadb-client-10.5 amd64 1:10.5.15-0+deb11u1 [1,509 kB]
Get:15 http://deb.debian.org/debian bullseye/main amd64 libaio1 amd64 0.3.112-9 [12.5 kB]
Get:16 http://deb.debian.org/debian bullseye/main amd64 libsnappy1v5 amd64 1.1.8-1 [17.9 kB]
Get:17 http://deb.debian.org/debian bullseye/main amd64 mariadb-server-core-10.5 amd64 1:10.5.15-0+deb11u1 [6,689 kB]
Get:18 http://deb.debian.org/debian bullseye/main amd64 mariadb-server-10.5 amd64 1:10.5.15-0+deb11u1 [4,260 kB]
Get:19 http://deb.debian.org/debian bullseye/main amd64 libatm1 amd64 1:2.5.1-4 [71.3 kB]
Get:20 http://deb.debian.org/debian bullseye/main amd64 libhtml-tagset-perl all 3.20-4 [13.0 kB]
Get:21 http://deb.debian.org/debian bullseye/main amd64 liburi-perl all 5.08-1 [90.6 kB]
Get:22 http://deb.debian.org/debian bullseye/main amd64 libhtml-parser-perl amd64 3.75-1+b1 [105 kB]
Get:23 http://deb.debian.org/debian bullseye/main amd64 libcgi-pm-perl all 4.51-1 [224 kB]
Get:24 http://deb.debian.org/debian bullseye/main amd64 libfcgi0ldbl amd64 2.4.2-2 [26.1 kB]
Get:25 http://deb.debian.org/debian bullseye/main amd64 libfcgi-perl amd64 0.79+ds-2 [27.6 kB]
Get:26 http://deb.debian.org/debian bullseye/main amd64 libcgi-fast-perl all 1:2.15-1 [12.1 kB]
Get:27 http://deb.debian.org/debian bullseye/main amd64 libclone-perl amd64 0.45-1+b1 [15.4 kB]
Get:28 http://deb.debian.org/debian bullseye/main amd64 libdbd-mariadb-perl amd64 1.21-3 [110 kB]
Get:29 http://deb.debian.org/debian bullseye/main amd64 libencode-locale-perl all 1.05-1.1 [13.2 kB]
Get:30 http://deb.debian.org/debian bullseye/main amd64 libfcgi-bin amd64 2.4.2-2 [12.9 kB]
Get:31 http://deb.debian.org/debian bullseye/main amd64 libhtml-template-perl all 2.97-1.1 [66.2 kB]
Get:32 http://deb.debian.org/debian bullseye/main amd64 libtimedate-perl all 2.3300-2 [39.3 kB]
Get:33 http://deb.debian.org/debian bullseye/main amd64 libhttp-date-perl all 6.05-1 [10.4 kB]
Get:34 http://deb.debian.org/debian bullseye/main amd64 libio-html-perl all 1.004-2 [16.1 kB]
Get:35 http://deb.debian.org/debian bullseye/main amd64 liblwp-mediatypes-perl all 6.04-1 [19.9 kB]
Get:36 http://deb.debian.org/debian bullseye/main amd64 libhttp-message-perl all 6.28-1 [79.6 kB]
Get:37 http://deb.debian.org/debian bullseye/main amd64 libmariadb-dev amd64 1:10.5.15-0+deb11u1 [185 kB]
Get:38 http://deb.debian.org/debian bullseye/main amd64 libmariadbd19 amd64 1:10.5.15-0+deb11u1 [4,917 kB]
Get:39 http://deb.debian.org/debian bullseye/main amd64 libmariadbd-dev amd64 1:10.5.15-0+deb11u1 [6,085 kB]
Get:40 http://deb.debian.org/debian bullseye/main amd64 libterm-readkey-perl amd64 2.38-1+b2 [27.8 kB]
Get:41 http://deb.debian.org/debian bullseye/main amd64 mariadb-client all 1:10.5.15-0+deb11u1 [35.2 kB]
Get:42 http://deb.debian.org/debian bullseye/main amd64 mariadb-server all 1:10.5.15-0+deb11u1 [35.3 kB]
Fetched 28.9 MB in 0s (124 MB/s)             
Extracting templates from packages: 100%
Preconfiguring packages ...
Selecting previously unselected package mysql-common.
(Reading database ... 38903 files and directories currently installed.)
Preparing to unpack .../00-mysql-common_5.8+1.0.7_all.deb ...
Unpacking mysql-common (5.8+1.0.7) ...
Selecting previously unselected package mariadb-common.
Preparing to unpack .../01-mariadb-common_1%3a10.5.15-0+deb11u1_all.deb ...
Unpacking mariadb-common (1:10.5.15-0+deb11u1) ...
Selecting previously unselected package galera-4.
Preparing to unpack .../02-galera-4_26.4.11-0+deb11u1_amd64.deb ...
Unpacking galera-4 (26.4.11-0+deb11u1) ...
Selecting previously unselected package libelf1:amd64.
Preparing to unpack .../03-libelf1_0.183-1_amd64.deb ...
Unpacking libelf1:amd64 (0.183-1) ...
Selecting previously unselected package libbpf0:amd64.
Preparing to unpack .../04-libbpf0_1%3a0.3-2_amd64.deb ...
Unpacking libbpf0:amd64 (1:0.3-2) ...
Selecting previously unselected package libmnl0:amd64.
Preparing to unpack .../05-libmnl0_1.0.4-3_amd64.deb ...
Unpacking libmnl0:amd64 (1.0.4-3) ...
Selecting previously unselected package libxtables12:amd64.
Preparing to unpack .../06-libxtables12_1.8.7-1_amd64.deb ...
Unpacking libxtables12:amd64 (1.8.7-1) ...
Selecting previously unselected package iproute2.
Preparing to unpack .../07-iproute2_5.10.0-4_amd64.deb ...
Unpacking iproute2 (5.10.0-4) ...
Selecting previously unselected package libdbi-perl:amd64.
Preparing to unpack .../08-libdbi-perl_1.643-3+b1_amd64.deb ...
Unpacking libdbi-perl:amd64 (1.643-3+b1) ...
Selecting previously unselected package lsof.
Preparing to unpack .../09-lsof_4.93.2+dfsg-1.1_amd64.deb ...
Unpacking lsof (4.93.2+dfsg-1.1) ...
Selecting previously unselected package libconfig-inifiles-perl.
Preparing to unpack .../10-libconfig-inifiles-perl_3.000003-1_all.deb ...
Unpacking libconfig-inifiles-perl (3.000003-1) ...
Selecting previously unselected package libmariadb3:amd64.
Preparing to unpack .../11-libmariadb3_1%3a10.5.15-0+deb11u1_amd64.deb ...
Unpacking libmariadb3:amd64 (1:10.5.15-0+deb11u1) ...
Selecting previously unselected package mariadb-client-core-10.5.
Preparing to unpack .../12-mariadb-client-core-10.5_1%3a10.5.15-0+deb11u1_amd64.deb ...
Unpacking mariadb-client-core-10.5 (1:10.5.15-0+deb11u1) ...
Selecting previously unselected package mariadb-client-10.5.
Preparing to unpack .../13-mariadb-client-10.5_1%3a10.5.15-0+deb11u1_amd64.deb ...
Unpacking mariadb-client-10.5 (1:10.5.15-0+deb11u1) ...
Selecting previously unselected package libaio1:amd64.
Preparing to unpack .../14-libaio1_0.3.112-9_amd64.deb ...
Unpacking libaio1:amd64 (0.3.112-9) ...
Selecting previously unselected package libsnappy1v5:amd64.
Preparing to unpack .../15-libsnappy1v5_1.1.8-1_amd64.deb ...
Unpacking libsnappy1v5:amd64 (1.1.8-1) ...
Selecting previously unselected package mariadb-server-core-10.5.
Preparing to unpack .../16-mariadb-server-core-10.5_1%3a10.5.15-0+deb11u1_amd64.deb ...
Unpacking mariadb-server-core-10.5 (1:10.5.15-0+deb11u1) ...
Setting up mysql-common (5.8+1.0.7) ...
update-alternatives: using /etc/mysql/my.cnf.fallback to provide /etc/mysql/my.cnf (my.cnf) in auto mode
Setting up mariadb-common (1:10.5.15-0+deb11u1) ...
update-alternatives: using /etc/mysql/mariadb.cnf to provide /etc/mysql/my.cnf (my.cnf) in auto mode
Selecting previously unselected package mariadb-server-10.5.
(Reading database ... 39534 files and directories currently installed.)
Preparing to unpack .../00-mariadb-server-10.5_1%3a10.5.15-0+deb11u1_amd64.deb ...
Unpacking mariadb-server-10.5 (1:10.5.15-0+deb11u1) ...
Selecting previously unselected package libatm1:amd64.
Preparing to unpack .../01-libatm1_1%3a2.5.1-4_amd64.deb ...
Unpacking libatm1:amd64 (1:2.5.1-4) ...
Selecting previously unselected package libhtml-tagset-perl.
Preparing to unpack .../02-libhtml-tagset-perl_3.20-4_all.deb ...
Unpacking libhtml-tagset-perl (3.20-4) ...
Selecting previously unselected package liburi-perl.
Preparing to unpack .../03-liburi-perl_5.08-1_all.deb ...
Unpacking liburi-perl (5.08-1) ...
Selecting previously unselected package libhtml-parser-perl.
Preparing to unpack .../04-libhtml-parser-perl_3.75-1+b1_amd64.deb ...
Unpacking libhtml-parser-perl (3.75-1+b1) ...
Selecting previously unselected package libcgi-pm-perl.
Preparing to unpack .../05-libcgi-pm-perl_4.51-1_all.deb ...
Unpacking libcgi-pm-perl (4.51-1) ...
Selecting previously unselected package libfcgi0ldbl:amd64.
Preparing to unpack .../06-libfcgi0ldbl_2.4.2-2_amd64.deb ...
Unpacking libfcgi0ldbl:amd64 (2.4.2-2) ...
Selecting previously unselected package libfcgi-perl:amd64.
Preparing to unpack .../07-libfcgi-perl_0.79+ds-2_amd64.deb ...
Unpacking libfcgi-perl:amd64 (0.79+ds-2) ...
Selecting previously unselected package libcgi-fast-perl.
Preparing to unpack .../08-libcgi-fast-perl_1%3a2.15-1_all.deb ...
Unpacking libcgi-fast-perl (1:2.15-1) ...
Selecting previously unselected package libclone-perl.
Preparing to unpack .../09-libclone-perl_0.45-1+b1_amd64.deb ...
Unpacking libclone-perl (0.45-1+b1) ...
Selecting previously unselected package libdbd-mariadb-perl.
Preparing to unpack .../10-libdbd-mariadb-perl_1.21-3_amd64.deb ...
Unpacking libdbd-mariadb-perl (1.21-3) ...
Selecting previously unselected package libencode-locale-perl.
Preparing to unpack .../11-libencode-locale-perl_1.05-1.1_all.deb ...
Unpacking libencode-locale-perl (1.05-1.1) ...
Selecting previously unselected package libfcgi-bin.
Preparing to unpack .../12-libfcgi-bin_2.4.2-2_amd64.deb ...
Unpacking libfcgi-bin (2.4.2-2) ...
Selecting previously unselected package libhtml-template-perl.
Preparing to unpack .../13-libhtml-template-perl_2.97-1.1_all.deb ...
Unpacking libhtml-template-perl (2.97-1.1) ...
Selecting previously unselected package libtimedate-perl.
Preparing to unpack .../14-libtimedate-perl_2.3300-2_all.deb ...
Unpacking libtimedate-perl (2.3300-2) ...
Selecting previously unselected package libhttp-date-perl.
Preparing to unpack .../15-libhttp-date-perl_6.05-1_all.deb ...
Unpacking libhttp-date-perl (6.05-1) ...
Selecting previously unselected package libio-html-perl.
Preparing to unpack .../16-libio-html-perl_1.004-2_all.deb ...
Unpacking libio-html-perl (1.004-2) ...
Selecting previously unselected package liblwp-mediatypes-perl.
Preparing to unpack .../17-liblwp-mediatypes-perl_6.04-1_all.deb ...
Unpacking liblwp-mediatypes-perl (6.04-1) ...
Selecting previously unselected package libhttp-message-perl.
Preparing to unpack .../18-libhttp-message-perl_6.28-1_all.deb ...
Unpacking libhttp-message-perl (6.28-1) ...
Selecting previously unselected package libmariadb-dev.
Preparing to unpack .../19-libmariadb-dev_1%3a10.5.15-0+deb11u1_amd64.deb ...
Unpacking libmariadb-dev (1:10.5.15-0+deb11u1) ...
Selecting previously unselected package libmariadbd19:amd64.
Preparing to unpack .../20-libmariadbd19_1%3a10.5.15-0+deb11u1_amd64.deb ...
Unpacking libmariadbd19:amd64 (1:10.5.15-0+deb11u1) ...
Selecting previously unselected package libmariadbd-dev.
Preparing to unpack .../21-libmariadbd-dev_1%3a10.5.15-0+deb11u1_amd64.deb ...
Unpacking libmariadbd-dev (1:10.5.15-0+deb11u1) ...
Selecting previously unselected package libterm-readkey-perl.
Preparing to unpack .../22-libterm-readkey-perl_2.38-1+b2_amd64.deb ...
Unpacking libterm-readkey-perl (2.38-1+b2) ...
Selecting previously unselected package mariadb-client.
Preparing to unpack .../23-mariadb-client_1%3a10.5.15-0+deb11u1_all.deb ...
Unpacking mariadb-client (1:10.5.15-0+deb11u1) ...
Selecting previously unselected package mariadb-server.
Preparing to unpack .../24-mariadb-server_1%3a10.5.15-0+deb11u1_all.deb ...
Unpacking mariadb-server (1:10.5.15-0+deb11u1) ...
Setting up libconfig-inifiles-perl (3.000003-1) ...
Setting up galera-4 (26.4.11-0+deb11u1) ...
Setting up libfcgi0ldbl:amd64 (2.4.2-2) ...
Setting up libclone-perl (0.45-1+b1) ...
Setting up libhtml-tagset-perl (3.20-4) ...
Setting up liblwp-mediatypes-perl (6.04-1) ...
Setting up libfcgi-bin (2.4.2-2) ...
Setting up libencode-locale-perl (1.05-1.1) ...
Setting up libatm1:amd64 (1:2.5.1-4) ...
Setting up libsnappy1v5:amd64 (1.1.8-1) ...
Setting up libmnl0:amd64 (1.0.4-3) ...
Setting up libio-html-perl (1.004-2) ...
Setting up libmariadb3:amd64 (1:10.5.15-0+deb11u1) ...
Setting up libxtables12:amd64 (1.8.7-1) ...
Setting up lsof (4.93.2+dfsg-1.1) ...
Setting up libmariadb-dev (1:10.5.15-0+deb11u1) ...
Setting up libtimedate-perl (2.3300-2) ...
Setting up libfcgi-perl:amd64 (0.79+ds-2) ...
Setting up libterm-readkey-perl (2.38-1+b2) ...
Setting up libaio1:amd64 (0.3.112-9) ...
Setting up libelf1:amd64 (0.183-1) ...
Setting up liburi-perl (5.08-1) ...
Setting up libdbi-perl:amd64 (1.643-3+b1) ...
Setting up mariadb-server-core-10.5 (1:10.5.15-0+deb11u1) ...
Setting up libhttp-date-perl (6.05-1) ...
Setting up libmariadbd19:amd64 (1:10.5.15-0+deb11u1) ...
Setting up libdbd-mariadb-perl (1.21-3) ...
Setting up mariadb-client-core-10.5 (1:10.5.15-0+deb11u1) ...
Setting up mariadb-client-10.5 (1:10.5.15-0+deb11u1) ...
Setting up libhtml-parser-perl (3.75-1+b1) ...
Setting up libbpf0:amd64 (1:0.3-2) ...
Setting up libhttp-message-perl (6.28-1) ...
Setting up libmariadbd-dev (1:10.5.15-0+deb11u1) ...
Setting up mariadb-client (1:10.5.15-0+deb11u1) ...
Setting up iproute2 (5.10.0-4) ...
Setting up libcgi-pm-perl (4.51-1) ...
Setting up libhtml-template-perl (2.97-1.1) ...
Setting up mariadb-server-10.5 (1:10.5.15-0+deb11u1) ...
invoke-rc.d: could not determine current runlevel
Stopping MariaDB database server: mariadbd.
invoke-rc.d: could not determine current runlevel
Starting MariaDB database server: mariadbd.
Setting up mariadb-server (1:10.5.15-0+deb11u1) ...
Setting up libcgi-fast-perl (1:2.15-1) ...
Processing triggers for libc-bin (2.31-13+deb11u3) ...
root@discourse-one-app:/# service mysql start
mysql: unrecognized service
1개의 좋아요

음.. 그래서 가져오기(import) 스크립트는 실행되게 만들었는데, 사용자를 가져오는 과정에서 오류가 발생하고 있습니다.

이 문제를 해결하는 방법에 대해 혹시 아이디어가 있으신가요?

root@discourse-one-app:/var/www/discourse# su discourse -c 'bundle exec ruby script/import_scripts/vbulletin.rb'
root:password@localhost wants vbulletin
Loading existing groups...
Loading existing users...
Loading existing categories...
Loading existing posts...
Loading existing topics...

importing groups...
       16 / 16 (100.0%)  [126440 items/min]   
importing users
Traceback (most recent call last):
        14: from script/import_scripts/vbulletin.rb:999:in `<main>'
        13: from /var/www/discourse/script/import_scripts/base.rb:47:in `perform'
        12: from script/import_scripts/vbulletin.rb:82:in `execute'
        11: from script/import_scripts/vbulletin.rb:129:in `import_users'
        10: from /var/www/discourse/script/import_scripts/base.rb:907:in `batches'
         9: from /var/www/discourse/script/import_scripts/base.rb:907:in `loop'
         8: from /var/www/discourse/script/import_scripts/base.rb:908:in `block in batches'
         7: from script/import_scripts/vbulletin.rb:152:in `block in import_users'
         6: from /var/www/discourse/script/import_scripts/base.rb:264:in `create_users'
         5: from /var/www/discourse/script/import_scripts/base.rb:264:in `each'
         4: from /var/www/discourse/script/import_scripts/base.rb:265:in `block in create_users'
         3: from script/import_scripts/vbulletin.rb:170:in `block (2 levels) in import_users'
         2: from script/import_scripts/vbulletin.rb:990:in `parse_timestamp'
         1: from /var/www/discourse/vendor/bundle/ruby/2.7.0/gems/tzinfo-2.0.4/lib/tzinfo/timezone.rb:575:in `utc_to_local'
/var/www/discourse/vendor/bundle/ruby/2.7.0/gems/tzinfo-2.0.4/lib/tzinfo/timestamp.rb:136:in `for': Integer values are not supported (ArgumentError)

업데이트: 문제가 발생했던 이유를 파악했습니다.

Discourse가 이제 TZInfo 2.x를 요구하기 때문에, 마이그레이션 스크립트는 현재 TZInfo 1.2.x와 2.x 사이에서 변경된 함수를 사용하고 있어 깨져 있는 상태입니다.

수정
작동하도록 하는 임시 해결책:

TZInfo 2.x로 인한 시간대 가져오기 오류 수정
참고: 모든 상황에서 이 해결책이 최선은 아닐 수 있지만, 날짜에 잘 형성된 에포크 타임스탬프가 있는 제 데이터베이스에서는 잘 작동하는 것 같습니다.

990번째 줄
변경 전

    Time.zone.at(@tz.utc_to_local(timestamp))

변경 후

    Time.zone.at(timestamp)

마지막 방문 시각이 nil 값이어서 스크립트가 충돌하는 문제
마지막 방문 시각은 실제로 데이터베이스에서 가져와지지 않습니다. 따라서 가져오는 항목에 이 값을 추가합니다.

131번째 줄
변경 전

          SELECT userid
               , username
               , homepage
               , usertitle
               , usergroupid
               , joindate
               , email
               , password
               , salt
            FROM #{TABLE_PREFIX}user
           WHERE userid > #{last_user_id}
        ORDER BY userid
           LIMIT #{BATCH_SIZE}

변경 후

          SELECT userid
               , username
               , homepage
               , usertitle
               , usergroupid
               , joindate
               , lastvisit
               , email
               , password
               , salt
            FROM #{TABLE_PREFIX}user
           WHERE userid > #{last_user_id}
        ORDER BY userid
           LIMIT #{BATCH_SIZE}
6개의 좋아요

저도 같은 문제를 겪었는데, Haddoq이 990번째 줄을 수정하라고 했을 때 어떤 파일을 말하는지 도무지 알 수 없었습니다.

다른 분들을 위해 말씀드리자면, 해당 파일은 vbulletin5.rb입니다.

1개의 좋아요

vbulletin5.rb에 일부 오류 처리를 추가하여 게시물을 가져오는过程中的 “invalid byte sequence in UTF-8” 문제를 해결할 수 있었습니다.

450번째 줄을 다음 코드로 대체했습니다. 저는 Ruby를 잘 알지 못하므로 이 코드는 다소 임시방편적인 해결책입니다.

    begin
      raw = raw.gsub(/(\\r)?\\n/, "\n")
        .gsub("\\t", "\t")
    rescue => error
        p error.message
        p raw
    end

스크립트를 다시 실행했을 때, 문제가 되는 게시물이 콘솔에 출력되었습니다.

이후 콘솔에서 출력된 고유한 텍스트를 검색하고, mysql에서 다음 명령을 실행했습니다:

select * from vb_text where rawtext LIKE '%and then my fish ate my car keys%'  limit 10;

이로 인해 문제가 되는 행의 nodeid를 얻을 수 있었고, 이 값을 사용하여 해당 행을 업데이트했습니다. 이렇게 하면 잘못된 텍스트를 수정할 수 있는 쿼리에 입력할 수 있습니다.

update vb_text set rawtext='POST FAILED TO MIGRATE (or a corrected version of the post)' where nodeid IN (159079);
2개의 좋아요

안녕하세요! 코드를 공유해 주실 수 있을까요?

sha1 속성이 nil인지 확인하는 방법

?

저도 같은 문제를 겪고 있습니다:
/discourse/app/models/upload.rb:246:in `base62_sha1': undefined method `hex' for nil:NilClass (NoMethodError)
감사합니다!


PS //
같은 문제를 겪고 있을 수 있는 분들을 위해.
discourse\app\models\upload.rb 파일에서 다음을 찾아보세요:
"#{Upload.base62_sha1(sha1)}#{extension.present? ? ".#{extension}" : ""}"
다음으로 교체하세요:

    unless sha1.nil?
      "#{Upload.base62_sha1(sha1)}#{extension.present? ? ".#{extension}" : ""}"
    end

또한, 저는 다음과 같은
discourse/vendor/bundle/ruby/2.7.0/gems/activesupport-6.1.6.1/lib/active_support/core_ext/time/calculations.rb:56:in `at': can't convert nil into an exact number (TypeError)
에러를 겪었습니다.
이를 수정하려면:
discourse\script\import_scripts\vbulletin.rb 파일에서 다음을 찾아보세요:

        user.suspended_at = parse_timestamp(user["bandate"])
        user.suspended_till = 200.years.from_now

그리고 다음으로 교체하세요:

        user.suspended_at = parse_timestamp(user["bandate"].to_i)
        user.suspended_till = 200.years.from_now.to_i
1개의 좋아요

안녕하세요,
저는 Ubuntu 22.04 LTS를 사용 중이며 vBulletin을 Discourse로 변환하려고 합니다.

DB_HOST = "172.17.0.5"
DB_USER = "root"
DB_PASSWORD = "*******"

RAILS_ENV=production bundle exec ruby script/import_scripts/vbulletin.rb 명령을 입력했을 때
다음과 같은 오류가 발생합니다.

1: from /var/www/discourse/vendor/bundle/ruby/2.7.0/gems/rack-mini-profiler-3.0.0/lib/mini_profiler/profiling_methods.rb:83:in `profile_method'
/var/www/discourse/vendor/bundle/ruby/2.7.0/gems/rack-mini-profiler-3.0.0/lib/mini_profiler/profiling_methods.rb:83:in `alias_method': undefined method `call' for class `Redis::Client' (NameError)
Did you mean?  caller

이 문제를 어떻게 해결할 수 있을까요?

개발용 설치인지 표준 설치인지요? 프로덕션 데이터베이스가 없으므로 RAILS_ENV=production을 추가할 필요가 없다고 생각합니다.

표준 설치 방식을 사용하고 있습니다.
https://www.vultr.com/docs/how-to-install-discourse-on-ubuntu-20-04/ 문서를 참고했습니다.
Docker 설치 환경에서는 Mysql을 사용할 수 없습니다. Discourse Docker 이미지 안에 MariaDB를 설치했습니다.

root@localhost-app:/var/www/discourse# service mysql start
mysql: unrecognized service
root@localhost-app:/var/www/discourse#

그래서 mysql Docker 이미지를 생성하고 vBulletin 데이터베이스를 해당 이미지로 업로드했습니다. mysql Docker 이미지의 IP 주소는 172.17.0.5입니다.

감사합니다.

아래와 같이 진행했습니다:
Docker 컨테이너 사용 지침을 따랐습니다.

  1. 표준 방법으로 Discourse를 설치했습니다. (discourse/docs/INSTALL-cloud.md at main · discourse/discourse · GitHub)
  2. MySQL Docker를 다운로드하여 vBulletin 데이터베이스를 туда 업로드했습니다.
    <root@localhost:/opt/discourse# mysql -h 172.17.0.5 -P 3306 --protocol=tcp -u root -p> 명령어로 확인했습니다.
  3. root@localhost:/opt/discourse#./launcher enter app 실행
  4. apt-get update && apt-get install libmysqlclient-dev mysql-server-5.7 실행 시 실패했습니다.
    그래서 apt-get update && apt-get install libmariadb-dev mariadb-server를 설치했습니다.
  5. Docker에서 MySQL을 실행할 수 없습니다.
root@localhost-app:/var/www/discourse# mysql
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/run/mysqld  /mysqld.sock' (2)

Docker 디렉터리 전체에 mysqld.sock 파일이 없습니다. 명령어로도 찾을 수 없었습니다.

root@localhost-app:/var/www/discourse# sudo service mysql start
mysql: unrecognized service  
  1. https://www.baeldung.com/docker-cant-connect-local-mysql 문서를 참고하여 "172.17.0.5"에서 MySQL Docker 이미지를 사용했습니다.
gem install mysql2
gem install php_serialize
<gem install mysql2>는 libmariadb-dev를 설치하기 전까지는 작동하지 않았습니다.
  1. 실행
su discourse -c 'bundle install --no-deployment --without test --without development --path vendor/bundle'

오류가 발생하여 gemfile.lock 파일과 .bundle 파일을 삭제한 후 다시 시도했습니다.
9. 그 후 다음을 시도했습니다.

export DB_NAME="vb3" # 이 값을 VB3 데이터베이스 이름으로 변경하세요.
export DB_USER="root"
export DB_PASSWORD="mypassword"
export DB_HOST="172.17.0.5"
cd /var/www/discourse
su discourse -c 'bundle exec ruby script/import_scripts/vbulletin.rb'

하지만 스크립트에서 오류가 발생했습니다.

1: from /var/www/discourse/vendor/bundle/ruby/2.7.0/gems/rack-mini-profiler-3.0.0/lib/mini_profiler/profiling_methods.rb:83:in `profile_method'
/var/www/discourse/vendor/bundle/ruby/2.7.0/gems/rack-mini-profiler-3.0.0/lib/mini_profiler/profiling_methods.rb:83:in `alias_method': undefined method `call' for class `Redis::Client' (NameError)
Did you mean?  caller

어떻게 수정할 수 있을까요?
감사합니다.

저도 같은 문제입니다. 이미 해결하셨나요? 감사합니다!

저도 이 오류가 발생했어요. 혹시 넘어가셨나요?

다음과 같은 매칭에 사용되는 정규식(regexp)을 찾았습니다:
# [QUOTE=<username>;<post_id>]...[/QUOTE]
하지만 사용자 이름과 게시물 ID가 이중 따옴표로 감겨 있을 수 있는 가능성에 대한 조항이 없습니다:


그 결과, Discourse로 마이그레이션된 인용문의 상당 부분이 출처에 대한 링크를 “잃어버립니다”:

여기서는 성공적으로 마이그레이션되었습니다:


여기서는 출처에 대한 링크가 손실되었습니다:

제 이해로는, 이것이 여기서 발생했습니다:

그리고 이것은 다음과 같은 것으로 쉽게 수정할 수 있습니다:
raw.gsub!(%r{\[quote="?([^;]+);(\d+)"?\](.+?)\[/quote\]}im) do

하지만 중첩된 인용문이 있는 경우에도 작동하지 않는 것 같습니다:

모든 인용문을 성공적으로 이전할 수 있는 해결책이 있는 분 계신가요?