美文网首页
手动安装Discourse

手动安装Discourse

作者: 已不再更新_转移到qiita | 来源:发表于2019-08-12 08:41 被阅读0次

    Discourse是什么

    Discourse 是一个比较新的论坛软件,比起上古时期的Discuz,样式、体验都很好,二次定制开发也更为友好,只是比Discuz更友好而已。 亲自定制过Discourse后,吐槽无数。

    好吧,Flarum 感觉比 Discourse更清爽。

    Discourse 完全开源,技术栈基于 Ruby on Rails + Ember.js + PostgreSQL。

    官方例子:https://try.discourse.org/
    官方论坛:https://meta.discourse.org/
    中文论坛:https://meta.discoursecn.org/

    使用Discourse的用户

    http://talk.nervos.org/
    https://imtoken.fans/
    https://forum.cyberrepublic.org/

    使用flarum的用户

    https://nuls.community/
    https://zijieke.com/
    https://www.sescse.com/
    https://paybase.cn/
    https://community.nebulas.io/

    安装 Ruby

    Discourse v2.3.2版本 需要的 ruby 最低版本是 2.5.2,咱来安装 2.5.5

    sudo apt-get -qq update
    sudo apt-get install -qqy libreadline-dev zlib1g-dev
    
    cd
    git clone git://github.com/sstephenson/rbenv.git .rbenv
    git clone git://github.com/sstephenson/ruby-build.git ~/.rbenv/plugins/ruby-build
    
    echo 'export PATH="$HOME/.rbenv/bin:$PATH"' >> ~/.bashrc
    echo 'eval "$(rbenv init -)"' >> ~/.bashrc
    echo 'export PATH="$HOME/.rbenv/plugins/ruby-build/bin:$PATH"' >> ~/.bashrc
    exec $SHELL
    
    rbenv install 2.5.5
    rbenv global 2.5.5
    ruby -v
    
    gem install bundler -v 1.17.3 -V # 安装 bundler gem
    

    安装postgresql数据库

    sudo apt -qq update && sudo apt install -qqy libpq-dev postgresql postgresql-client
    

    设定 postgres 登录方式
    https://stackoverflow.com/a/26735105

    安装redis

    sudo apt update
    sudo apt install -y redis-server
    

    安装 node

    curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.34.0/install.sh | bash
    
    nvm install node
    nvm alias default node
    npm install -g svgo # 优化SVG文件
    

    安装imagemagick

    https://imagemagick.org 用于裁剪照片

    sudo apt install imagemagick
    

    安装 Discourse

    git clone https://github.com/discourse/discourse.git # 下载源码
    cd discourse
    bundle install -V # 安装 package
    
    RAILS_ENV=development bundle exec rake db:create --trace # 创建数据库
    
    RAILS_ENV=development bundle exec rake db:migrate --trace # 创建数据库结构
    RAILS_ENV=development bundle exec rake autospec # 运行测试
    RAILS_ENV=development bundle exec rails s -b 0.0.0.0 # 运行服务 http://localhost:3000 
    

    定制教程

    https://1c7.me/customize-discourse-part-1/
    https://1c7.me/customize-discourse-part-2/
    https://1c7.me/customize-discourse-part-3/
    https://1c7.me/customize-discourse-part-4/
    https://1c7.me/customize-discourse-part-5/

    吐槽点

    感觉 Discourse的科技树点歪了:

    • 没有做前后端分离
      现在还在玩 rails + render js ,还是 React/Vue 没兴起时用的模式,
      它使用的 js template是hbs,爆难用
    • 不知道在哪找的一套 icon 图标
    • 对了,你还要了解Ember.js

    Discourse的作者是 https://stackoverflow.com的 CEO,C# 风格比较浓厚,再说你也不能苛责一个已经在 2010 年已经启动的项目了。


    参考:

    https://github.com/discourse/discourse/blob/master/docs/DEVELOPER-ADVANCED.md
    http://www.ruanyifeng.com/blog/2013/12/getting_started_with_postgresql.html
    https://github.com/rbenv/rbenv/issues/1138

    https://meta.discoursecn.org
    https://meta.discoursecn.org/t/topic/1012
    https://github.com/fantasticfears/discourse-chinese-localization-pack

    https://gems.ruby-china.com

    相关文章

      网友评论

          本文标题:手动安装Discourse

          本文链接:https://www.haomeiwen.com/subject/ggxyjctx.html