Cloudflare Tunnels - Discourse 설정에서 호스트명이 인식되지 않음 (포트 접근 불가)

cloudflared 데몬이 정상적으로 실행 중이며, 터널이 서버에 올바르게 설치되어 있음을 확인했습니다. 하지만 Discourse 설치 과정(./discourse-setup)에서 내 Discourse 인스턴스의 호스트명을 인식하지 못해 문제가 발생하고 있습니다.

  • 인스턴스의 호스트명으로 biohacking.forum을 사용하고 있습니다.
  • biohacking.forum에 대한 Cloudflare 터널 설정은 다음과 같습니다:
  • 서비스 유형을 HTTPS로 설정해 보기도 했습니다.
  • Discourse를 Ubuntu LTS 서버에 설치하고 있습니다.
  • 다음 명령어를 순서대로 실행했습니다:
  1. sudo mkdir /var/discourse
  2. sudo git clone GitHub - discourse/discourse_docker: A Docker image for Discourse · GitHub /var/discourse
  3. cd /var/discourse
  4. sudo ./discourse-setup
  5. 호스트명 입력을 요청받으면 biohacking.forum을 입력합니다.
  6. 다음과 같은 메시지가 표시됩니다:
Hostname for your Discourse? [discourse.example.com]: biohacking.forum

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

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

The first thing to do is confirm that biohacking.forum 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.

This tool is designed only for the most standard installations. If you cannot resolve
the issue above, you will need to edit containers/app.yml yourself and then type

./launcher rebuild app

이 단계를 정상적으로 동작하게 하려면 어떻게 해야 하나요? 추가 정보가 필요하면 알려주세요. 감사합니다!

안녕하세요, ./discourse-setup 실행 전에 “A” 레코드에 회색 구름 (DNS 전용) 설정이 있나요?

표준 A 레코드를 사용하지 않고 Cloudflare 터널을 사용하고 있습니다. 제 서버(Cloudflare 터널 사용)에서 완벽하게 작동하는 서비스와 해당 구성의 예시는 다음과 같습니다:

Ghost CMS가 해당 서비스입니다:
PORT: 8085:2368 (8085는 호스트 포트, 2368은 서비스 포트)
HOSTNAME: joshuahabka.com
Cloudflare 터널 설정:

Cloudflare 터널을 사용하기 때문에 주황색 Cloudflare 아이콘이 표시되지만, Discourse에는 정상적인 접근 포트처럼 보고되어야 합니다. 웹 접근이 가능한 40개 이상의 서비스를 배포해 두었는데, Discourse에서 오류가 발생한 것은 처음입니다.

추가 정보가 필요하시면 알려주세요!

따라서 Discourse의 경우 포트는 다음과 같을 것으로 추정됩니다:
443:443 (호스트:서비스) 그래서 제가 위에 보여드린 원래의 Cloudflare 터널 설정을 그렇게 한 것입니다.

안녕하세요 @joshhabka :wave:
아직 보지 않으셨다면 이 주제가 도움이 될 수 있을 것 같습니다

Lilly님, 앞서 언급된 가이드를 따라 보았지만 저에게는 작동하지 않았습니다. Cloudflare 터널 설정이 문서에 나와 있듯이 http://localhost:80으로 되어 있음에도 불구하고 여전히 동일한 오류가 발생하여 막혀 있습니다.

starserver@Starserver:/var/discourse$ sudo ./discourse-setup 
Ports 80 and 443 are free for use
'samples/standalone.yml' -> 'containers/app.yml'
./discourse-setup: line 261: 4
scaling*                 2: syntax error in expression (error token is "scaling*                 2")

Hostname for your Discourse? [discourse.example.com]: biohacking.forum

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

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

The first thing to do is confirm that biohacking.forum 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.

This tool is designed only for the most standard installations. If you cannot resolve
the issue above, you will need to edit containers/app.yml yourself and then type

./launcher rebuild app

"항상 HTTPS 사용"을 끄면 포트 80은 성공하지만 포트 443은 실패합니다. 이 옵션은 "스키마가 'http’인 모든 요청을 'https’로 리디렉션합니다. 이는 해당 영역에 대한 모든 http 요청에 적용됩니다."라고 설명되어 있습니다.

HTTPS로 리디렉션하는 페이지 규칙을 활성화하면 80포트와 443포트 모두 실패합니다. 하지만 이 규칙을 사용하지 않으면 443포트는 실패하고 80포트는 성공합니다.

지시를 따르지 않고 계십니다.

discourse-setup은 yml 파일을 생성하는 용도로만 사용할 수 있습니다.

감사합니다. 현재 여기에서 막혀 있습니다:

FAILED
--------------------
Pups::ExecError: /usr/local/bin/ruby -e 'if ENV["DISCOURSE_SMTP_ADDRESS"] == "smtp.example.com"; puts "Aborting! Mail is not configured!"; exit 1; end' failed with return #<Process::Status: pid 134 exit 1>
Location of failure: /usr/local/lib/ruby/gems/3.3.0/gems/pups-1.2.1/lib/pups/exec_command.rb:132:in `spawn'
exec failed with the params {"tag"=>"precompile", "cmd"=>["/usr/local/bin/ruby -e 'if ENV[\"DISCOURSE_SMTP_ADDRESS\"] == \"smtp.example.com\"; puts \"Aborting! Mail is not configured!\"; exit 1; end'", "/usr/local/bin/ruby -e 'if ENV[\"DISCOURSE_HOSTNAME\"] == \"discourse.example.com\"; puts \"Aborting! Domain is not configured!\"; exit 1; end'", "/usr/local/bin/ruby -e 'if (ENV[\"DISCOURSE_CDN_URL\"] || \"\")[0..1] == \"//\"; puts \"Aborting! CDN must have a protocol specified. Once fixed you should rebake your posts now to correct all posts.\"; exit 1; end'"]}
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.

yml 파일을 편집하고 SMTP 인증 정보를 입력해야 합니다

완료했고, 이제 모든 것이 정상입니다. 클라우드플레어 터널에 대한 셀프 설치 게시물에 메모를 하나 남기면 좋겠습니다. 사용자들이 yaml 문서를 편집하여 smtp, 호스트명, 이메일 등을 추가해야 한다는 내용입니다.

감사합니다!