Discourse介绍
Discourse程序基于Ruby on Rails, Ember.js, 以及PostgreSQL, 完全免费开源。它拥有丰富的功能,强劲的性能,高稳定性与安全性,以及可以高度自定义的界面。
准备工作
硬件需求:最低双核VPS 最低1GBRAM(带有SWAP) 兼容Docker的64为Linux系统 最低10GB磁盘空间
其它准备:宝塔面板 域名
官方推荐使用docker安装,借助Docker,我们可以在一个简单的容器中为您提供经过完全优化的Discourse配置,以及基于Web的GUI,使您只需单击一个按钮即可轻松升级到Discourse的新版本。这篇文章还是基于宝塔面板来安装。
宝塔服务器面板,一键全能部署及管理,送你10850元礼包,点我领取 https://ttt.name/r9o9n
开始安装1
注意,本教程的系统环境为Centos7
安装需要80和443端口,所以最好是在一个全新的宝塔环境里安装该该程序。宝塔面板默认占用了80端口,我们需要稍微修改一下。
路径:/www/server/panel/vhost/nginx,把里面的文件端口改为其他,比如808。看图:
注意,这里面的2个默认文件都需要编辑默认的80端口。
部署项目
1.下载程序
git clone https://github.com/discourse/discourse_docker.git /var/discourse
cd /var/discourse
2.编辑app.yml
执行命令 cp samples/standalone.yml containers/app.yml复制配置文件到containers目录
并且根据自己环境配置app.yml配置文件,修改以下内内容
具体编辑如下:
expose:
- "80:80" # http 默认80端口,如果需要修改可以改为类似8080:80的形式
- "443:443" # https
params:
db_default_text_search_config: "pg_catalog.english"
## Set db_shared_buffers to a max of 25% of the total memory.
## will be set automatically by bootstrap based on detected RAM, or you can override
db_shared_buffers: "2048MB"
## can improve sorting performance, but adds memory usage per-connection
#db_work_mem: "40MB"
## Which Git revision should this container use? (default: tests-passed)
#version: tests-passed
env:
LC_ALL: zh_CN.UTF-8
LANG: zh_CN.UTF-8
LANGUAGE: zh_CN.UTF-8
# DISCOURSE_DEFAULT_LOCALE: en
## How many concurrent web requests are supported? Depends on memory and CPU cores.
## will be set automatically by bootstrap based on detected CPUs, or you can override
UNICORN_WORKERS: 8
## TODO: The domain name this Discourse instance will respond to
## Required. Discourse will not work with a bare IP number.
DISCOURSE_HOSTNAME: dd.qixi.ng #这里是域名,不要忘记填写。
## Uncomment if you want the container to be started with the same
## hostname (-h option) as specified above (default "$hostname-$config")
#DOCKER_USE_HOSTNAME: true
## TODO: List of comma delimited emails that will be made admin and developer
## on initial signup example 'user1@example.com,user2@example.com'
DISCOURSE_DEVELOPER_EMAILS: 'daniao@163.com' #这里修改为自己的
## TODO: The SMTP mail server used to validate new accounts and send notifications
# SMTP ADDRESS, username, and password are required
# WARNING the char '#' in SMTP password can cause problems!
#这下面都是邮箱配置,根据需要来。
DISCOURSE_SMTP_ADDRESS: smtp.163.com
DISCOURSE_SMTP_PORT: 587
DISCOURSE_SMTP_USER_NAME: daniao
DISCOURSE_SMTP_PASSWORD: "123456"
#DISCOURSE_SMTP_ENABLE_START_TLS: true # (optional, default true)
DISCOURSE_SMTP_DOMAIN: daniao.org
DISCOURSE_NOTIFICATION_EMAIL: admin@daniao.org
## If you added the Lets Encrypt template, uncomment below to get a free SSL certificate
LETSENCRYPT_ACCOUNT_EMAIL: me@example.com
expose:
- "80:80" # http 默认80端口,如果需要修改可以改为类似8080:80的形式
- "443:443" # https
params:
db_default_text_search_config: "pg_catalog.english"
## Set db_shared_buffers to a max of 25% of the total memory.
## will be set automatically by bootstrap based on detected RAM, or you can override
db_shared_buffers: "2048MB"
## can improve sorting performance, but adds memory usage per-connection
#db_work_mem: "40MB"
## Which Git revision should this container use? (default: tests-passed)
#version: tests-passed
env:
LC_ALL: zh_CN.UTF-8
LANG: zh_CN.UTF-8
LANGUAGE: zh_CN.UTF-8
# DISCOURSE_DEFAULT_LOCALE: en
## How many concurrent web requests are supported? Depends on memory and CPU cores.
## will be set automatically by bootstrap based on detected CPUs, or you can override
UNICORN_WORKERS: 8
## TODO: The domain name this Discourse instance will respond to
## Required. Discourse will not work with a bare IP number.
DISCOURSE_HOSTNAME: dd.qixi.ng #这里是域名,不要忘记填写。
## Uncomment if you want the container to be started with the same
## hostname (-h option) as specified above (default "$hostname-$config")
#DOCKER_USE_HOSTNAME: true
## TODO: List of comma delimited emails that will be made admin and developer
## on initial signup example 'user1@example.com,user2@example.com'
DISCOURSE_DEVELOPER_EMAILS: 'daniao@163.com' #这里修改为自己的
## TODO: The SMTP mail server used to validate new accounts and send notifications
# SMTP ADDRESS, username, and password are required
# WARNING the char '#' in SMTP password can cause problems!
#这下面都是邮箱配置,根据需要来。
DISCOURSE_SMTP_ADDRESS: smtp.163.com
DISCOURSE_SMTP_PORT: 587
DISCOURSE_SMTP_USER_NAME: daniao
DISCOURSE_SMTP_PASSWORD: "123456"
#DISCOURSE_SMTP_ENABLE_START_TLS: true # (optional, default true)
DISCOURSE_SMTP_DOMAIN: daniao.org
DISCOURSE_NOTIFICATION_EMAIL: admin@daniao.org
## If you added the Lets Encrypt template, uncomment below to get a free SSL certificate
LETSENCRYPT_ACCOUNT_EMAIL: me@example.com
3.启动安装
在程序根目录,输入以下命令开始安装。
./discourse-setup
4.在提示时回答以下问题例如:
Hostname for your Discourse? [discourse.example.com]:
Email address for admin account(s)? [me@example.com,you@example.com]:
SMTP server address? [smtp.example.com]:
SMTP port? [587]:
SMTP user name? [user@example.com]:
SMTP password? [pa$$word]:
Let's Encrypt account email? (ENTER to skip) [me@example.com]:
之后,我们需要等2到8分钟的时间安装程序!!
5.如果需要更换域名,或者其他,你需要编辑app.yml文件。编辑好后,输入以下命令让修改生效。
./launcher rebuild app
安装向导
上面的程序安装完成后,打开你的域名便可以访问了。
注册新帐户并成为管理员,使用引导前输入的电子邮件地址之一注册一个新的管理员帐户。
注册成功,要验证邮箱,所以前面的smtp一定要配置正确。
注册管理员帐户后,安装向导将启动并指导您完成Discourse的基本配置。
完成设置向导后,您应该看到Staff主题和README FIRST:Admin快速入门指南。
升级版本
随着新版本的Discourse的发布,您将收到电子邮件提醒。请保持最新状态以获取最新功能和安全修复程序。要将Discourse升级到最新版本,请/admin/upgrade
在浏览器中访问,然后单击“升级”按钮。
launcher
命令/var/discourse
可用于各种维护,如下:
Usage: launcher COMMAND CONFIG [--skip-prereqs] [--docker-args STRING]
Commands:
start: Start/initialize a container
stop: Stop a running container
restart: Restart a container
destroy: Stop and remove a container
enter: Use nsenter to get a shell into a container
logs: View the Docker logs for a container
bootstrap: Bootstrap a container for the config based on a template
rebuild: Rebuild a container (destroy old, bootstrap, start new)
cleanup: Remove all containers that have stopped for > 24 hours
Options:
--skip-prereqs Don't check launcher prerequisites
--docker-args Extra arguments to pass when running docker
举个栗子:
./launcher rebuild app
最后
上面的app就是容器的名称,看图:
用宝塔来安装还是有点繁琐的,你如果用80端口,还需要修改宝塔默认占用的80端口。
参考:
https://github.com/discourse/discourse/blob/master/docs/INSTALL-cloud.md
https://meta.discourse.org/t/running-other-websites-on-the-same-machine-as-discourse/17247
!!!本站内所有注册会员发布文章所产生的任何责任均与我们(源码桌面)无关!!!
暂无评论内容