Discourse

Discourse 安装和部署

安装 docker

sudo apt-get update
sudo apt-get install -y docker.io

安装 discourse docker 镜像

sudo -s
git clone https://github.com/discourse/discourse_docker.git /var/discourse
cd /var/discourse
cp samples/standalone.yml containers/app.yml
vi containers/app.yml

要修改的几项:

templates:
  - "templates/postgres.template.yml"
  - "templates/redis.template.yml"
  - "templates/web.template.yml"
  - "templates/web.ratelimited.template.yml"
## Uncomment these two lines if you wish to add Lets Encrypt (https)
  - "templates/web.ssl.template.yml"
  - "templates/web.letsencrypt.ssl.template.yml"

  ## Which Git revision should this container use? (default: tests-passed)
  #version: tests-passed
  version: stable

env:
  #LC_ALL: en_US.UTF-8
  #LANG: en_US.UTF-8
  #LANGUAGE: en_US.UTF-8
  # DISCOURSE_DEFAULT_LOCALE: en
  LC_ALL: zh_CN.UTF-8
  LANG: zh_CN.UTF-8
  LANGUAGE: zh_CN.UTF-8
  DISCOURSE_DEFAULT_LOCALE: zh_CN

# 域名
DISCOURSE_HOSTNAME: 'xxx.com'
# 管理员 email
DISCOURSE_DEVELOPER_EMAILS: 'xxx@hotmail.com'

# smtp, hotmail 参考:https://meta.discourse.org/t/troubleshoot-email-on-a-new-discourse-install/16326
  DISCOURSE_SMTP_AUTHENTICATION: login
  DISCOURSE_SMTP_ADDRESS: smtp.office365.com
  DISCOURSE_SMTP_PORT: 587
  DISCOURSE_SMTP_USER_NAME: xxx@hotmail.com
  DISCOURSE_SMTP_PASSWORD: password
  DISCOURSE_SMTP_ENABLE_START_TLS: true           # (optional, default true)
  ## If you added the Lets Encrypt template, uncomment below to get a free SSL certificate
  LETSENCRYPT_ACCOUNT_EMAIL: me@example.com

  # 管理员注册 email
  - exec: rails r "SiteSetting.notification_email='info@unconfigured.discourse.org'"

构建 docker app 应用,这个步骤会比较久:

./launcher bootstrap app

启动应用:

# ./launcher start app
x86_64 arch detected.
WARNING: containers/app.yml file is world-readable. You can secure this file by running: chmod o-rwx containers/app.yml
chmod o-rwx containers/app.yml

设置 DNS,访问域名注册。

注释掉如下的行

  # 管理员注册 email
  #- exec: rails r "SiteSetting.notification_email='info@unconfigured.discourse.org'"

重新构建:

./launcher rebuild app

launcher 用法:

launcher 
Usage: launcher COMMAND CONFIG [--skip-prereqs]
Commands:
    start:      启动 / 初始化容器
    stop:       关闭运行中的容器
    restart:    重启容器
    destroy:    关闭并删除容器
    enter:      使用 nsenter 进入容器
    ssh:        在运行中的容器中启动 bash shell
    logs:       容器的 Docker 日志
    mailtest:   测试容器中的邮件配置
    bootstrap:  基于配置文件预设模板初始化容器
    rebuild:    重建一个容器(删除老容器,初始化,启动新容器)

参考:https://juejin.cn/post/6933956151679647752

评论(没有评论)