joyhuang-web / Conflux

a conflux working way for project development

Home Page:http://about.conflux.me

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Code Climate Test Coverage Build Status

Conflux 專案管理系統

conflux

主要功能

  • 投票系統
  • 搜尋系統
  • 檔案系統
  • 看板系統
  • 溝通系統
  • 統計系統
  • 事件系統
  • 通知系統
  • 收藏系統
  • 倉庫系統

系統需求

  • postgresql > 9.4 for jsonb support
  • elasticsearch 1.7
  • elasticsearch plugin - Smart Chinese Analysis

如何啟動

為了啟動,我們需要設定 postgresql, elasticsearch, private_pub, redis 這四個服務。

設定 Postgresql

首先先將 .env.example 複製成 .env,再設定 DATABASE_USERNAME 與 DATABASE_PASSWORD,例如:

DATABASE_USERNAME=postgres
DATABASE_PASSWORD=postgres

如果你設定都正確的話,你應該可以使用這個 rake task 來創建資料庫:

$ rake db:create

如果這個指令失敗的話,那你也可以手動創建資料庫。

再來用請先跑過 migration,讓它創建資料表

$ rake db:migrate

設定 elasticsearch

首先先到 elasticsearch 官網下載 zip 並解壓縮出 elasticsearch 資料夾。並安裝對應版本的 smartcn plugin。

smartcn plugin 對應的版本請閱 https://github.com/elastic/elasticsearch-analysis-smartcn

$ cd elasticsearch-1.7.0
$ ./bin/plugin install elasticsearch/elasticsearch-analysis-smartcn/2.7.0 # this version is only for elasticsearch 1.7 !

為了 Debug 與監控 elasticsearch 狀態,可以再安裝 Marvel plugin。

$ ./bin/plugin -i elasticsearch/marvel/latest

接下來使用以下指令即可運行 elasticsearch:

$ ./bin/elasticsearch

若有安裝 Marvel Plugin,我們可以造訪 http://localhost:9200/_plugin/marvel/ 來觀看狀態。另外 http://localhost:9200/_plugin/marvel/sense/ 提供了一個 developer console 可以方便的對 elasticsearch 發送 request。

我們使用 chewy gem 作為 elasticsearch wrapper,設定檔在於 config/chewy.yml。

development:
  host: 'localhost:9200'

確定設定無誤後,使用 chewy rake task 來建立 Conflux 使用的 elasticsearch index。

$ cd conflux
$ rake chewy:reset:all

日後若有需要 reindex,也使用 chewy 提供的 rake task,這樣才有 zero downtime。 其他 rake task 請見 https://github.com/toptal/chewy/blob/master/lib/tasks/chewy.rake

設定 Private_Pub

我們使用了 private_pub gem 使用 Faye 提供 websocket 功能。其設定檔在於 config/private_pub.yml (請複製config/private_pub.yml.example)。

development:
  server: "http://localhost:9292/faye"
  secret_token: "secret"
test:
  server: "http://localhost:9292/faye"
  secret_token: "secret"
production:
  server: "http://example.com/faye"
  secret_token: "6724b127a8454d9e3dd32645d921201c0a04940fd6e4fbf1889fb2c335429dbb"
  signature_expiration: 3600 # one hour

啟動 private_pub

$ rackup private_pub.ru -s thin -E production

請確保 redis 正在運行,並啟動 sidkiq ( redis 與 sidekiq 在開發環境下並非必需)

$ bundle exec sidekiq

啟動 rails server

postgresql, elasticsearch, sync 都設定好了之後就可以使用以下指令開啟 rails server:

$ rails s

然後訪問 http://localhost:3000 即可。

About

a conflux working way for project development

http://about.conflux.me


Languages

Language:Ruby 49.4%Language:CoffeeScript 22.5%Language:HTML 15.9%Language:CSS 8.8%Language:JavaScript 3.4%