jsdev.kr에서 사용하는 포럼 오픈소스인 discourse를 digitalocean에 설치하기

오랜만에 새롭게 포럼 사이트가 필요한 일이 있어서 digitalocean에 새롭게 설치했습니다. 다른 분들은 삽질하지 마시라고 부딪혔던 문제에 해대서 간단히 적어봅니다.

  • digitalocean에 30분만에 설치하기 공식 가이드 : https://github.com/discourse/discourse/blob/master/docs/INSTALL-cloud.md
  • 이메일은 aws ses를 썼습니다. 여기서 주의할 점은 aws ses는 인증된 도메인으로만 이메일 발송 주소를 할 수 있습니다. ses의 기본 도메인 인증 절차를 다 밟는 것 이외에 discourse의 app.yml에서 메일 발송 주소를 수정해야합니다. 수정하지 않으면 [email protected]주소로 발송시도하기에 aws ses가 이를 거절하게되어 이메일을 받을 수 없어 설정을 할 수 없습니다. 아래에서 가운데줄 주석을 제거하고 발송이메일을 원하는 이메일로 적습니다.
## If you want to set the 'From' email address for your first registration, uncomment and change:
#- exec: rails r "SiteSetting.notification_email='[email protected]'"
## After getting the first signup email, re-comment the line. It only needs to run once.
location / {
                proxy_pass      http://discourse.example.com:25654/;
                proxy_read_timeout      90;
                proxy_redirect  http://discourse.example.com:25654/ https://discourse.example.com;
        }

위와 같이 설정했을 때 글쓰기 창의 preview가 동작하지 않습니다.
이유는 preivew를 위한 markdown 관련 js파일 요청을 http로 하기 때문입니다. 위 proxy setting에서 다음과 같이 두가지 헤더를 추가하면 문제가 해결됩니다.

location / {
                proxy_set_header X-Forwarded-Proto https;
                proxy_set_header Host $http_host;
                proxy_pass      http://discourse.example.com:25654/;
                proxy_read_timeout      90;
                proxy_redirect  http://discourse.example.com:25654/ https://discourse.example.com;
        }

참고 문서

2개의 좋아요