DigitalOcean 드롭렛 간 Discourse 마이그레이션: 다운타임 없이 이전하기

새로운 DigitalOcean 드롭렛으로 이전하는 중이며 마켓플레이스 이미지를 사용해 보았습니다. 설정 스크립트를 실행하면 도메인 이름이 여전히 프로덕션의 현재 인스턴스를 가리키고 있기 때문에 초기 단계에서 실패합니다.

이 새 설치 환경을 실행 상태로 만들어 백업을 복원한 후 DNS 레코드를 업데이트해야 합니다.

에러 메시지는 다음과 같습니다:

Checking your domain name . . .
WARNING: Port 443 of computer does not appear to be accessible using hostname:  x
WARNING: Connection to x (port 80) also fails.

This suggests that x resolves to some IP address that does not reach this 
machine where you are installing discourse.

The first thing to do is confirm that x resolves to the IP address of this server.
You usually do this at the same place you purchased the domain.

If you are sure that the IP address resolves correctly, it could be a firewall issue.
A web search for "open ports YOUR CLOUD SERVICE" might help.

실제로 도메인 이름은 80번 포트와 443번 포트에서 응답하고 있으므로, 이 에러 메시지도 잘못된 것으로 보입니다.

매트, 안녕하세요.

우리는 (Discourse 팀은) DO 마켓플레이스 이미지를 관리하지 않기 때문에, 해당 특정 문제를 해결하는 데 도움을 드리기 어려울 것 같습니다.

하지만 이 부분은 관리하고 있죠?

수동 설치 지침에도 이 단계가 있습니다.

내가 이걸 하는 첫 번째 사람은 아니겠죠. 다른 사람들은 어떻게 하고 있나요?

네, 저희가 그 부분을 관리하고 있습니다. 코드를 직접 확인한 것은 아니고, 해당 체크가 마켓플레이스 이미지에서 온다고 가정했습니다.

./discourse-setup은 Discourse를 설정하는 간단한 방법입니다. 새로운 Discourse 사이트를 시작할 때 텍스트 파일을 수동으로 편집할 필요가 없도록 하기 위한 것입니다. 귀하의 사용 사례는 설정 스크립트가 처리하는 “전형적인” 경우가 아닙니다.

귀하의 경우, 현재 서버의 containers/app.yml 파일을 새 서버로 복사하는 것이 가장 좋은 방법이 될 것입니다. 또는 75/76번 줄에서 제안된 대로 파일을 직접 수동으로 편집할 수도 있습니다:

기본 app.yml 파일을 어디서 찾을 수 있나요? 새로 설치된 기본 상태로 시작하고 싶습니다.

또한, 설치 스크립트 없이 서버를 실행하는 방법은 무엇인가요? 설치 스크립트를 실행할 수 없어서 IP 주소에 접속해도 여전히 응답이 없습니다.

기본 설정은 samples/standalone.yml에서 찾을 수 있습니다. GitHub에서도 확인 가능.

공식 설치 가이드를 따르고 있다면, “Install Discourse” 섹션의 명령을 실행한 다음 다음을 수행해야 합니다:

samples에서 기본 yaml 파일을 containers로 복사합니다:

cp samples/standalone.yml containers/app.yml

파일을 수동으로 편집합니다:

nano containers/app.yml

Discourse를 부트스트랩하고 시작합니다:

./launcher rebuild app

감사합니다. 이제 좀 더 가까워졌습니다.

하지만 이제 임시 관리자 계정을 활성화할 수 없어서 백업을 가져올 수 없습니다:

(6) 다음 Content Security Policy 지시문을 위반했기 때문에 스크립트 ‘’ 로딩이 거부되었습니다: “script-src ”. 'script-src-elem’이 명시적으로 설정되지 않았으므로 'script-src’가 폴백으로 사용됩니다.

백업에서 직접 복원하거나 그때까지 CSP를 비활성화하는 방법이 있을까요?

서버에 SSH로 로그인한 후 다음을 실행하세요:

cd /var/discourse
sudo ./launcher enter app
rails c
SiteSetting.content_security_policy = false
exit
exit

참고로 먼저 CLI를 통해 백업 복원을 시도해 보시길 권합니다. 이는 현재 장애 요인(CSP)이 아닌, 실제로 겪고 있는 문제(백업 복원)를 해결하는 방법이기 때문입니다.

힌트 주셔서 감사합니다.

restore를 실행하면 다음과 같은 오류가 발생합니다:

ERROR:  could not create unique index "index_incoming_referers_on_path_and_incoming_domain_id"
DETAIL:  Key (path, incoming_domain_id)=(/s/free+proxy+hideip.me, 1009) is duplicated.
EXCEPTION: psql failed: DETAIL:  Key (path, incoming_domain_id)=(/s/free+proxy+hideip.me, 1009) is duplicated.
/var/www/discourse/lib/backup_restore/database_restorer.rb:87:in `restore_dump'
/var/www/discourse/lib/backup_restore/database_restorer.rb:26:in `restore'
/var/www/discourse/lib/backup_restore/restorer.rb:51:in `run'
script/discourse:143:in `restore'
/var/www/discourse/vendor/bundle/ruby/2.7.0/gems/thor-1.0.1/lib/thor/command.rb:27:in `run'
/var/www/discourse/vendor/bundle/ruby/2.7.0/gems/thor-1.0.1/lib/thor/invocation.rb:127:in `invoke_command'
/var/www/discourse/vendor/bundle/ruby/2.7.0/gems/thor-1.0.1/lib/thor.rb:392:in `dispatch'
/var/www/discourse/vendor/bundle/ruby/2.7.0/gems/thor-1.0.1/lib/thor/base.rb:485:in `start'
script/discourse:284:in `<top (required)>'
/usr/local/lib/ruby/gems/2.7.0/gems/bundler-2.2.3/lib/bundler/cli/exec.rb:63:in `load'
/usr/local/lib/ruby/gems/2.7.0/gems/bundler-2.2.3/lib/bundler/cli/exec.rb:63:in `kernel_load'
/usr/local/lib/ruby/gems/2.7.0/gems/bundler-2.2.3/lib/bundler/cli/exec.rb:28:in `run'
/usr/local/lib/ruby/gems/2.7.0/gems/bundler-2.2.3/lib/bundler/cli.rb:497:in `exec'
/usr/local/lib/ruby/gems/2.7.0/gems/bundler-2.2.3/lib/bundler/vendor/thor/lib/thor/command.rb:27:in `run'
/usr/local/lib/ruby/gems/2.7.0/gems/bundler-2.2.3/lib/bundler/vendor/thor/lib/thor/invocation.rb:127:in `invoke_command'
/usr/local/lib/ruby/gems/2.7.0/gems/bundler-2.2.3/lib/bundler/vendor/thor/lib/thor.rb:392:in `dispatch'
/usr/local/lib/ruby/gems/2.7.0/gems/bundler-2.2.3/lib/bundler/cli.rb:30:in `dispatch'
/usr/local/lib/ruby/gems/2.7.0/gems/bundler-2.2.3/lib/bundler/vendor/thor/lib/thor/base.rb:485:in `start'
/usr/local/lib/ruby/gems/2.7.0/gems/bundler-2.2.3/lib/bundler/cli.rb:24:in `start'
/usr/local/lib/ruby/gems/2.7.0/gems/bundler-2.2.3/exe/bundle:49:in `block in <top (required)>'
/usr/local/lib/ruby/gems/2.7.0/gems/bundler-2.2.3/lib/bundler/friendly_errors.rb:130:in `with_friendly_errors'
/usr/local/lib/ruby/gems/2.7.0/gems/bundler-2.2.3/exe/bundle:37:in `<top (required)>'
/usr/local/bin/bundle:23:in `load'
/usr/local/bin/bundle:23:in `<main>'
Trying to rollback...
Rolling back...
Cleaning stuff up...
Dropping functions from the discourse_functions schema...
Removing tmp '/var/www/discourse/tmp/restores/default/2020-12-29-214249' directory...
Unpausing sidekiq...
Marking restore as finished...
Notifying 'system' of the end of the restore...
Finished!
[FAILED]
Restore done.

인덱스가 손상된 것 같습니다. 기존 인스턴스에 업그레이드를 실행해 보셨나요? 도움이 될 수 있습니다.

기존 인스턴스에서 원본 데이터베이스(및 Let’s Encrypt) 파일을 복사하는 방법에 대한 안내가 있는 주제가 어딘가에 있습니다. 저는 아마도 그렇게 할 것 같습니다.

rub run이 뭐죠?

기존 인스턴스에서 업그레이드를 시도할 때마다 계속 오류가 발생해서(이 오류와는 다른 오류들이에요) 새 인스턴스로 옮기게 되었습니다.

이것에 대한 링크가 있나요?

rsync와 cron을 통한 백업 전송일지도 모릅니다