快2个月没写博客,最近一个是忙着开发docker平台,另外一个是接手了公司私有云,所以比较忙。
公司最近有个新项目,想弄个技术的问答论坛,挑选了半天,选择ruby语言的discourse,这个是完全开源的,界面简洁,支持中文,有管理后台,满足需求。
discourse的地址是https://www.discourse.org
界面如下
下面是安装过程
系统环境
官方推荐使用ubuntu,并且安装的程序也是支持ubuntu系统,docker安装模式,所以我选择了云主机ubuntu 14.04系统,discourse是最新的1.5.0版本。
apt-get update
apt-get install ruby git
wget -qO- https://get.docker.com/ | sh
root@i-chxjfvpy:/tmp# docker version
Client:
Version: 1.9.1
API version: 1.21
Go version: go1.4.2
Git commit: a34a1d5
Built: Fri Nov 20 13:12:04 UTC 2015
OS/Arch: linux/amd64
Server:
Version: 1.9.1
API version: 1.21
Go version: go1.4.2
Git commit: a34a1d5
Built: Fri Nov 20 13:12:04 UTC 2015
OS/Arch: linux/amd64
mkdir /data/discourse
git clone https://github.com/discourse/discourse_docker.git /data/discourse
cd /data/discourse
cp samples/standalone.yml containers/app.yml
root@i-chxjfvpy:~# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/vda1 18G 1.8G 15G 11% /
none 4.0K 0 4.0K 0% /sys/fs/cgroup
udev 3.9G 8.0K 3.9G 1% /dev
tmpfs 799M 412K 799M 1% /run
none 5.0M 0 5.0M 0% /run/lock
none 3.9G 0 3.9G 0% /run/shm
none 100M 0 100M 0% /run/user
/dev/vdb1 193G 60M 183G 1% /data
root@i-chxjfvpy:/data/discourse# grep -v "^ #" containers/app.yml |grep -v "^#"|sed '/^$/d'
templates:
- "templates/postgres.template.yml"
- "templates/redis.template.yml"
- "templates/web.template.yml"
- "templates/sshd.template.yml"
- "templates/web.ratelimited.template.yml"
- "templates/web.china.template.yml"
expose:
- "80:80" # fwd host port 80 to container port 80 (http)
- "2222:22" # fwd host port 2222 to container port 22 (ssh)
params:
db_default_text_search_config: "pg_catalog.english"
db_shared_buffers: "2GB"
db_work_mem: "40MB"
env:
LANG: en_US.UTF-8
UNICORN_WORKERS: 6
DISCOURSE_DEVELOPER_EMAILS: 'xxx@163.com'
DISCOURSE_HOSTNAME: 'discuss.xxx.net'
DISCOURSE_SMTP_ADDRESS: smtp.163.com # (mandatory)
DISCOURSE_SMTP_PORT: 25 # (optional)
DISCOURSE_SMTP_USER_NAME: xxx # (optional)
DISCOURSE_SMTP_PASSWORD: 123123 # (optional, WARNING the char '#' in pw can cause problems!)
DISCOURSE_SMTP_AUTHENTICATION: login
DISCOURSE_SMTP_OPENSSL_VERIFY_MODE: none
DISCOURSE_SMTP_ENABLE_START_TLS: false # (optional, default true)
volumes:
- volume:
host: /data/discourse/shared/standalone
guest: /shared
- volume:
host: /data/discourse/shared/standalone/log/var-log
guest: /var/log
hooks:
after_code:
- exec:
cd: $home/plugins
cmd:
- git clone https://github.com/discourse/docker_manager.git
run:
- exec: echo "Beginning of custom commands"
- exec: echo "End of custom commands"
- exec: awk -F\# '{print $1;}' ~/.ssh/authorized_keys | awk 'BEGIN { print "Authorized SSH keys for this container:"; } NF>=2 {print $NF;}'
DISCOURSE_DEVELOPER_EMAILS是你邮件地址;
DISCOURSE_HOSTNAME是你web端打开的地址,可以是公网IP,也可以是dns域名;
DISCOURSE_SMTP_ADDRESS、DISCOURSE_SMTP_PORT、DISCOURSE_SMTP_USER_NAME、DISCOURSE_SMTP_PASSWORD是你邮箱信息,这个邮箱是用户注册或其他行为时,发送给用户进行验证的邮箱,其中密码DISCOURSE_SMTP_PASSWORD里不能包含#,否则会被识别有问题;
默认authentication是plain,但我测试使用163邮箱的话,无法登陆,所以改为login;
默认enable_starttls_auto是开启tls验证,我这里也给改为false;
另外在template里加入一行
- "templates/web.china.template.yml"
不加入的话,默认使用ruby的库是国外的ruby.org镜像源,加上这个后是使用国内taobao的ruby镜像源
具体配置参考注释,比如db_shared_buffers、db_work_mem、UNICORN_WORKERS根据你内存来配置。
root@i-su8g5dng:/tmp# docker p_w_picpaths
REPOSITORY TAG IMAGE ID CREATED VIRTUAL SIZE
local_discourse/app latest 4272aa220d69 2 hours ago 1.877 GB
discourse/discourse 1.0.15 cb7b58c22b11 2 weeks ago 1.265 GB
./launcher bootstrap app
86c397191c205624ded7181c06b1d73ea1856abe126a717354dc308d2964282a
cfbab5cb2ff9745616cb0e604c47644d2a7041445fda6b0da0aa697714bf466b
Successfully bootstrapped, to startup use ./launcher start app
root@i-chxjfvpy:/data/discourse# ./launcher start app
然后使用./launcher start app启动
root@i-chxjfvpy:/data/discourse# docker ps -a
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
d0b519f15db7 local_discourse/app "/sbin/boot" 35 seconds ago Up 33 seconds 0.0.0.0:80->80/tcp, 0.0.0.0:2222->22/tcp app
7、配置管理员用户
或者直接按照下面操作
./launcher enter app
rake admin:create
You will be asked for Email, Password and Confirm Password.
After providing required information a new account will be created with random username.
Now you will be asked: Do you want to grant Admin privileges to this account? (Y/n). Press enter to continue.
You will see success message: Your account now has Admin privileges!.
That's it, you have created a new account with Admin privileges.
登陆后的界面为
9、修改为中文界面
修改后刷新,然后显示为
10、FAQ
如果遇到无法发送验证邮件,检测问题为
553 Mail from must equal authorized user
需要你修改
亿速云「云服务器」,即开即用、新一代英特尔至强铂金CPU、三副本存储NVMe SSD云盘,价格低至29元/月。点击查看>>
免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。