macOS에서 개발용 Discourse 설치하기

:warning: 이 가이드는 macOS 개발 환경의 설치 방법을 다룹니다. 프로덕션 환경 설치 가이드는 다음을 참고하세요: Install Discourse in production with the official supported instructions

macOS에서 Discourse를 설정하여 개발과 해킹(수정/실험)을 해보고 싶으신가요?

여러분의 Mac에 Ruby/Rails/Postgres/Redis가 설치되어 있지 않다고 가정합니다. 시작해 보겠습니다 :rocket: !

Discourse 의존성 설치

시스템에 다음 패키지가 필요합니다:

** 선택 사항

터미널을 재시작하세요

이제 Discourse 의존성이 설치되었으므로, Discourse 자체를 설치하는 단계로 넘어가겠습니다.

터미널 재시작

셸을 종료하고 다시 시작하면 설치된 패키지의 경로가 터미널에 의해 올바르게 인식됩니다.

Discourse 클론

Discourse 저장소를 ~/discourse 폴더에 클론하세요:

git clone https://github.com/discourse/discourse.git ~/discourse

~는 홈 폴더를 나타내므로, Discourse 소스 코드는 홈 폴더에서 사용할 수 있게 됩니다.

Discourse 부트스트랩

Discourse 폴더로 이동하세요:

cd ~/discourse

필요한 gems를 설치합니다

bundle install

JS 의존성을 설치합니다

pnpm install

다음으로, 로컬 Discourse 인스턴스를 설정하려면 다음 명령을 실행하세요:

bundle exec rake db:create
bundle exec rake db:migrate
RAILS_ENV=test bundle exec rake db:create db:migrate

Rails + Ember 서버를 시작합니다. 여기에는 두 가지 옵션이 있습니다.

옵션 1: 두 개의 별도 터미널 탭/창을 사용하여 Rails와 프론트엔드 번들러를 각각 실행합니다

bundle exec rails server

그리고

bin/dev --only ember

옵션 2: 터미널 탭/창 하나만 사용:

bin/dev # Pitchfork와 프론트엔드 번들러를 함께 실행

:tada: 이제 http://localhost:3000으로 이동하여 로컬 Discourse 설치를 볼 수 있어야 합니다. (서버 워밍업으로 인해 첫 번째 로딩에 최대 1분이 걸릴 수 있다는 점을 참고하세요.)

스펙(테스트)을 실행해 볼 수도 있습니다:

bundle exec rake autospec

모든(또는 거의 모든) 테스트가 통과해야 합니다.

새 관리자 생성

새 관리자를 생성하려면 다음 명령을 실행하세요:

RAILS_ENV=development bundle exec rake admin:create

프롬프트에 따라 관리자 계정을 생성하세요.

메일 구성

MailHog를 실행하세요:

mailhog

축하합니다! 이제 여러분은 자신의 Discourse 설치의 관리자가 되었습니다!

즐거운 개발 하세요! 그리고 시작하기 위해, Discourse 플러그인 생성 입문 가이드를 참고하세요.


이 문서는 버전 관리됩니다 - 변경 사항을 제안하려면 github에서 제안해 주세요.

78개의 좋아요
Setup discourse on Mac OS
Running Discourse on Docker for Mac
Localhost:3000/users gives no-results
How to install Discourse on windows
How to install Discourse locally?
Best dev installation method for running on macOS?
MacOS Installation Gem::FilePermissionError
Discourse standalone
Migrate a NodeBB forum with Redis to Discourse
UndefinedTable: ERROR: relation "web_hook_event_types" when trying to run rspec test
Error after cleaning tmp folder
Local installation internal use only
Starting discourse fails with bootstrap error
Help me setup my Discourse development environment
Please help, how do I install Discourse on macOS?
Migrate a phpBB3 forum to Discourse
Migrate a FluxBB forum to Discourse
Migrate a vBulletin 3 forum to Discourse via XenForo
Migrate a MyBB forum to Discourse
Migrate a NodeBB forum with MongoDB to Discourse
Migrate a Ning forum to Discourse
Migrate a Phorum forum to Discourse
Migrate from another forum to Discourse
Migrate a Kunena 3 forum to Discourse
Migrate a bbPress WordPress plugin forum to Discourse
Install Discourse for development using Docker
Use the Discourse API ruby gem
Regarding the installation - docker
Set Environmental Variables
Need help integrating code wrote on Edittext to the Discourse
Keyboard navigation messes up the search menu
WP-Discourse not connected and admin email not recognized
Contributing to Discourse development
How to install discussions on localhost in my mac?
How to install Discourse for Wordpress locally running on MAMP
Error when building: "Runtime Error: discourse does not support compiling scss/sass files via sprockets"
Migrate from GetSatisfaction to Discourse
Case study of an amateur plugin author
Upgrading Mathjax to version 4
Windows server publish method
Discourse as Your First Rails App
Topic List Previews (TLP)
Enable CORS on localhost for DiscourseConnect
Category option: max topics per user (2 use-case examples)
Can't deploy to heroku
[PAID] Import from Legacy Postgres DB
Vagrant based server failing on db:migrate
Change unicorn port from 3000 in development
I want to build a debug version of discourse
Moderation Tools
Rails server --daemon and plugins
Installing problem - bundle install
Nginx Performance Report plugin incompatible with development environment setup script
Rake aborted message is showing when installing vagrant development
Update PhantomJS to latest for Ubuntu dev guide?
Cannot Backup my Development Instance (Fails)
Install error : Protocol violation
Can't set up dev environment due to cppjieba_rb failing to install
How to edit the discourse files? A development box?
How to add a new language
How to relax Content Security Policy
Installing Discourse for macOS Development Using asdf and docker-compose
Override profile background via SSO
Can't set up dev environment due to cppjieba_rb failing to install
Stuck in infinite loop in Mac terminal after source ~/.bashrc
Install on macOS – Failure: Scheduler::Defer can pause and resume
Disabling SSO in development environment
Local development and deploying from same repo
Discourse Connect on Local instance is not working
Can't start localhost server -- file was built for x86_64 which is not the architecture being linked (i386)
Please help, how do I install Discourse on macOS?
How to connect to an external database running on localhost
How can I include discourse in my local dev stack?
Global messages on 94632 timed out, restarting process, 95535 successfully terminated by `TERM` signal
Cannot get embedding to work
/admin/config/emoji non responsive/locks up
App.yml file does not exist when installing Discourse locally
Ember-cli error on local MacOS development
Importing / migrating from Zendesk Community to Discourse
Redis version error when I run bundle exec db:create
Dev environment setup failed on bundle install
Set up a local Discourse Development Environment?
[Need help][MacOS M1 dev installation] ArgumentError unknown keywords
Migrate a PunBB forum to Discourse

If anyone is getting failing specs with most of them being .count errors, then try the following:

RAILS_ENV=test bundle exec rake db:reset

I had a problem where development data somehow got into my test database and was causing lots of failures.

7개의 좋아요

Is it possible to reset a discourse completely?

2개의 좋아요

Yes, do:

rake db:drop db:create db:migrate

Note that this will wipe everything and you will have to create your Admin user account again.

11개의 좋아요

Can someone assist me in how I can update my discourse?

/launcher rebuild app

returns an error.

1개의 좋아요

./launcher rebuild app is for discourse_docker based production setup. To update local/development Discourse instance you need:

cd ~/discourse
git pull origin master
8개의 좋아요

I get this error @techAPJ,

error: Your local changes to the following files would be overwritten by merge:
	.gitignore
Please commit your changes or stash them before you merge.
Aborting

The error message is pretty clear:

Please commit your changes or stash them before you merge.

If you want to ignore your local changes, do:

git fetch origin
git reset --hard origin/master
7개의 좋아요

Ruby on Rails 포럼의 가이드를 참고하고 있는데, 현재 7단계에서 막혀 있습니다.

아마도 초보자에게는 아주 기본적인 질문일 수 있지만, 해당 주제에서 링크된 실험적 브랜치를 어떻게 ‘가리켜야’ 하는지 궁금합니다. 여러 가지를 시도해 봤지만, 매번 Unknown command mini_racer,라는 메시지만 나타났습니다.

1개의 좋아요

여기서 물어봐도 괜찮습니다.

이 가이드에서 레일즈 포럼에 참고로 언급한 특정 M1 지침이 몇 가지 있습니다.

나중에 제 M1 Air에서 확인해 봐야겠지만, 최근에 새 맥을 설정한 동료들이 이것이 여전히 필요한지 더 잘 알 수 있을지도 모르겠습니다. 하지만 7단계에 브랜치를 가리키는 예시가 있습니다:

gem 'mini_racer', github: 'rubyjs/mini_racer', branch: 'refs/pull/186/head'

따라서 로컬의 discourse/Gemfile에서 이 줄을 수정해야 합니다:

그 다음 bundle install을 실행하면 됩니다.

4개의 좋아요

원본 게시물 맨 위에 바로 링크되어 있습니다.

Ruby on Rails 포럼의 해당 토픽은 이미 몇 달째 활동이 없습니다. 질문자(OP)는 2월 이후로 활동하지 않았으며, 도움을 요청하는 댓글에도 답을 하지 않았습니다.

여기에는 제게 도움을 줄 사람이 더 많습니다. 그냥 말씀드리는 겁니다. :wink:

그 내용을 터미널에 복사해서 실행해 보았는데, 이전과 동일한 Unknown command mini_racer, 오류가 발생했습니다.

솔직히 말하면, Ruby on Rails 포럼의 가이드는 그 부분에 대해 제가 바라는 만큼 명확하지 않습니다.

미리 사과드립니다… :pray:

2개의 좋아요

실행할 명령어가 아닙니다. discourse 디렉터리 안에 있는 "Gemfile"이라는 실제 텍스트 파일을 직접 편집해야 합니다.

1개의 좋아요

아니… :facepalm:

감사합니다! 지금 바로 시도해 볼게요.

개인적으로 생각하기에, Ruby on Rails 포럼의 가이드를 누군가가 수정해서 7단계에 대해 더 명확하게 설명해 주면 좋겠습니다. 제 의견일 뿐이지만요.

잠깐만요. 바로 돌아올게요…

1개의 좋아요

미안하지만 급한 일이 있어 가야 해요. m1 맥을 위한 mini_racer 수정이 이미 병합된 것 같아요. 방금 m1 맥에서 제 Gemfile을 확인했는데 수정된 흔적이 없거든요. 그래서 7번 단계를 건너뛰셔도 될 것 같아요.

3개의 좋아요

8단계를 실행했는데 Could not locate Gemfile 오류가 발생했습니다.

7단계는 (아마) 해결한 것 같은데, 8단계는 여전히 문제가 있어 위에서 언급한 오류가 계속 나옵니다.

bundle install을 실행할 때는 discourse 디렉터리 안에 있어야 합니다.

@merefield 님: 원격 개발 환경을 조금 더 자세히 설명해 주실 수 있을까요?

테마를 개발할 때는 라이브 사이트에서 변경 사항을 추가할 수 있지만, 플러그인을 개발할 때는 로컬 머신에서 수행하는 것을 피할 방법이 보이지 않습니다. 여기에는 플러그인이 위에 올라간 전체 discourse 코드베이스가 있어야 합니다.

그 결과, 플러그인을 코딩할 때 (CSS가 아닌) 변경 사항이 있을 때마다 새로고침하면 1) 컴퓨터의 팬이 돌아가고 2) 새로고침에 30초가 넘게 걸립니다. 그리고 서버를 재시작해야 하는 경우 몇 분이나 걸립니다.

이러한 지연은 실제로 누적되어, 결과적으로 제 일반적인 코딩 흐름(핫 리로드가 있거나 변경 사항당 최대 2~3초)이라면 15분이면 될 일을 1시간이나 걸리게 만듭니다.

따라서 속도를 높이는 방법에 대한 조언을 주시면 감사하겠습니다.

1개의 좋아요

이 글은 사실 Ubuntu 관련 주제에 올리는 것이 더 적합했을 수도 있습니다. 저는 클라우드 서버에서 해당 설치를 실행하고 있으며, nginx와 완전한 DNS(도커 미사용)를 프론트엔드로 사용하므로 실제로 도메인을 직접 지정하고 있습니다. 모든 작업을 터미널에서 수행합니다. 이제 그 환경에서 Ember CLI도 잘 작동하게 되었습니다.

속도가 매우 빠르다고 할 수는 없지만, 충분히 빠릅니다. 전체 https 콜백 서비스를 실행하고 테스트할 수 있다는 장점이 있습니다.

제가 알고 있는 가장 빠른 플러그인 개발 환경은 단연 WSL2에서 실행하는 로컬 Docker Dev입니다. 속도가 엄청나게 빠릅니다. 유지보수도 매우 간단합니다. 불행히도 discourse_theme는 아직 그 환경에서 작동하지 않는 것 같아(afaik) 해당 작업은 다시 클라우드 서버로 돌아왔습니다.

왜 Apple이 이 부분에서 뒤처져 있는지 조금 의아합니다. Microsoft 엔지니어들은 매우 영리하게 대응해 왔습니다.

3개의 좋아요

ruby 2.7.3 설치 시 오류가 발생하는 경우가 있을 수 있습니다. Xcode 12 이후로 변경된 사항으로 인해 rbenv를 통한 설치 과정이 깨지는 것으로 보입니다:

최신 버전의 psych와 libyaml이 설치되어 있음에도 불구하고 계속 아래 오류가 발생했습니다:

It seems your ruby installation is missing psych (for YAML output).
To eliminate this warning, please install libyaml and reinstall your ruby.

가이드에서 제안하는 우회 방법을 시도해 보았지만, 동일한 오류가 계속 발생하여 결국 rvm을 사용해야 했습니다:

rvm install 2.7.3
1개의 좋아요

플러그인 개발 시 프로그래밍 속도를 높이는 방법에 대해 말씀드리자면, 최근 제 접근 방식을 변경했습니다. 그리고 그 효과는 매우 좋습니다. 기본적으로, 프론트엔드 관련 코드는 테마 컴포넌트로 옮기고, 플러그인 자체에는 백엔드 코드만 작성합니다. 다른 분들도 이미 이 방법을 알고 계셨을 것입니다. 하지만 제가 실제로 이렇게 해보니 프로그래밍이 훨씬 빠르고 편해졌습니다. 자세한 내용은 여기에서 확인하실 수 있습니다.

3개의 좋아요