无法再次使 Discourse 正常运行

你好:
过去几个月我一直运行 Discourse,没有遇到任何问题。
我不得不重置主机,但现在无法让 Discourse 再次正常运行。

/var/discourse# ./launcher rebuild app

确保启动器为最新版本

获取远程仓库

启动器已是最新版本

cat: 80:80: 没有那个文件或目录

cat: 443:443: 没有那个文件或目录

cd /pups && git pull && /pups/bin/pups --stdin

/usr/bin/docker: 无效的引用格式:仓库名称必须为小写。

请参见 '/usr/bin/docker run --help'。

cat: cids/app_bootstrap.cid: 没有那个文件或目录

"docker rm" 至少需要一个参数。

请参见 'docker rm --help'。

用法:docker rm [OPTIONS] CONTAINER [CONTAINER...]

删除一个或多个容器

rm: 无法删除 'cids/app_bootstrap.cid':没有那个文件或目录

** 启动失败 ** 请向上滚动查看之前的错误消息,可能不止一条。

./discourse-doctor 可能有助于诊断问题。

“run” 和 “bootstrap” 命令执行的操作相同 :frowning:

Doctor 输出如下:

./discourse-doctor 
DISCOURSE DOCTOR 2020年2月16日 11:59:15 CET
操作系统:Linux XXXXXXXXXXXX 3.16.0-7-amd64 #1 SMP Debian 3.16.59-1 (2018-10-03) x86_64 GNU/Linux


找到 containers/app.yml

==================== YML 设置 ====================
awk: 无效选项:--field-separator=:
DISCOURSE_HOSTNAME=
awk: 无效选项:--field-separator=:
SMTP_ADDRESS=
awk: 无效选项:--field-separator=:
DEVELOPER_EMAILS=
awk: 无效选项:--field-separator=:
SMTP_PASSWORD=
awk: 无效选项:--field-separator=:
SMTP_PORT=
awk: 无效选项:--field-separator=:
SMTP_USER_NAME=
awk: 无效选项:--field-separator=:
LETSENCRYPT_ACCOUNT_EMAIL=

==================== DOCKER 信息 ====================
DOCKER 版本:Docker version 18.06.3-ce, build d7080c1

DOCKER 进程 (docker ps -a)

CONTAINER ID        IMAGE               COMMAND             CREATED             STATUS              PORTS               NAMES

==================== 严重问题!!!! ====================
app 未运行!
尝试重新构建
==================== 重新构建日志 ====================
确保启动器为最新版本
获取远程仓库
启动器已是最新版本
cat: 80:80: 没有那个文件或目录
cat: 443:443: 没有那个文件或目录
cd /pups && git pull && /pups/bin/pups --stdin
/usr/bin/docker: 无效的引用格式:仓库名称必须为小写。
请参见 '/usr/bin/docker run --help'。
cat: cids/app_bootstrap.cid: 没有那个文件或目录
"docker rm" 至少需要一个参数。
请参见 'docker rm --help'。

用法:docker rm [OPTIONS] CONTAINER [CONTAINER...]

删除一个或多个容器
rm: 无法删除 'cids/app_bootstrap.cid':没有那个文件或目录
** 启动失败 ** 请向上滚动查看之前的错误消息,可能不止一条。
./discourse-doctor 可能有助于诊断问题。
==================== 重新构建日志结束 ====================
重新构建 app 失败。

检查您的域名 . . .

连接到 443 成功。
您可能应该移除所有非官方插件并重新构建。
尝试重启现有容器 . . . 

cat: 80:80: 没有那个文件或目录
cat: 443:443: 没有那个文件或目录
+ /usr/bin/docker run --shm-size=512m -d --restart=always '#<NoMethodError: undefined method `[]'\'' for false:FalseClass>' '#<NoMethodError: undefined method `[]'\'' for false:FalseClass>' -e LANG=en_US.UTF-8 -e RAILS_ENV=production -e UNICORN_WORKERS=4 -e UNICORN_SIDEKIQS=1 -e RUBY_GLOBAL_METHOD_CACHE_SIZE=131072 -e RUBY_GC_HEAP_GROWTH_MAX_SLOTS=40000 -e RUBY_GC_HEAP_INIT_SLOTS=400000 -e RUBY_GC_HEAP_OLDOBJECT_LIMIT_FACTOR=1.5 -e DISCOURSE_DB_SOCKET=/var/run/postgresql -e DISCOURSE_DB_HOST= -e DISCOURSE_DB_PORT= -e LETSENCRYPT_DIR=/shared/letsencrypt -e DISCOURSE_HOSTNAME=XXXXXXXXXXXX -e DISCOURSE_DEVELOPER_EMAILS=XXXXXXXXXXXX -e DISCOURSE_SMTP_ADDRESS=XXXXXXXXXXXX -e DISCOURSE_SMTP_PORT=587 -e DISCOURSE_SMTP_USER_NAME=XXXXXXXXXXXX -e DISCOURSE_SMTP_PASSWORD=XXXXXXXXXXXX -e DISCOURSE_SMTP_ENABLE_START_TLS=false -e LETSENCRYPT_ACCOUNT_EMAIL=XXXXXXXXXXXX '#<NoMethodError: undefined method `[]'\'' for false:FalseClass>' '#<NoMethodError: undefined method `[]'\'' for false:FalseClass>' -h vps659319-app -e DOCKER_HOST_IP=172.17.0.1 --name app -t '#<NoMethodError: undefined method `[]'\'' for false:FalseClass>' '#<NoMethodError: undefined method `[]'\'' for false:FalseClass>' -v /var/discourse/shared/standalone:/shared -v /var/discourse/shared/standalone/log/var-log:/var/log --mac-address 02:62:5b:d4:b7:80 local_discourse/app /sbin/boot
/usr/bin/docker: 无效的引用格式:仓库名称必须为小写。
请参见 '/usr/bin/docker run --help'。
重启容器失败。


==================== 插件 ====================
          - git clone https://github.com/discourse/docker_manager.git
          - git clone https://github.com/discourse/discourse-plugin-linkedin-auth.git
          - git clone https://github.com/discourse/discourse-oauth2-basic.git
          - git clone https://github.com/discourse/discourse-solved.git
          - git clone https://github.com/discourse/discourse-voting.git
          - git clone https://github.com/discourse/discourse-assign.git
          - git clone https://github.com/discourse/discourse-staff-notes.git
          - git clone https://github.com/discourse/discourse-checklist.git
          - git clone https://github.com/discourse/discourse-social-share.git
          - git clone https://github.com/rcfox/Discourse-LinkedIn-Sharing-Button.git
          - git clone https://github.com/BeXcellent/discourse-allowiframe.git

警告:
您似乎安装了非官方插件。
如果您遇到问题,请禁用这些插件并尝试重新构建。

请参见 https://github.com/discourse/discourse/blob/master/lib/plugin/metadata.rb 获取官方列表。

========================================
Discourse 版本:未找到
localhost 上的 Discourse 版本:未找到


==================== 内存信息 ====================
RAM (MB): 2009

             total       used       free     shared    buffers     cached
Mem:          1962       1819        142         45         86        586
-/+ buffers/cache:       1146        815
Swap:         2047        190       1857

==================== 磁盘空间检查 ====================
---------- 操作系统磁盘空间 ----------
Filesystem      Size  Used Avail Use% Mounted on
/dev/sda1        20G  9.1G  9.7G  49% /

==================== 磁盘信息 ====================

Disk /dev/sdb: 50 GiB, 53687091200 bytes, 104857600 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk /dev/sda: 20 GiB, 21474836480 bytes, 41943040 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0x7f0953e7

Device     Boot Start      End  Sectors Size Id Type
/dev/sda1  *     2048 41941883 41939836  20G 83 Linux

==================== 磁盘信息结束 ====================

==================== 邮件测试 ====================
要进行可靠的测试,请从 http://www.mail-tester.com/ 获取一个地址
或者直接发送一封测试邮件给自己。
用于邮件测试的电子邮件地址?(输入 'n' 跳过)[]: XXXXXXXXXXXX
正在向 XXXXXXXXXXXX 发送邮件 . . . 
错误:没有名为 app 的容器

替换:SMTP_PASSWORD
替换:LETSENCRYPT_ACCOUNT_EMAIL
替换:DEVELOPER_EMAILS
替换:DISCOURSE_DB_PASSWORD
替换:Sending mail to

==================== 完成!====================

您可以使用以下命令查看此脚本的输出:
LESS=-Ri less /tmp/discourse-debug.txt

但首先,请确保您知道以下前三条命令!!!

使用上述命令(称为 'less')查看文件时需要知道的命令:
q              -- 退出
/error<ENTER>  -- 搜索单词 'error'
n              -- 搜索下一个匹配项
g              -- 跳转到文件开头
f              -- 向前翻页
b              -- 向后翻页
G              -- 跳转到文件末尾
2 个赞

请确保 Doctor 高亮显示的设置已正确填写且不为空。

例如:DISCOURSE_HOSTNAME: mydomain.com(注意分隔符应为 : 而不是 =

您可以使用在线 YML 验证器检查语法:http://www.yamllint.com/

该文件完全没有被修改……它和之前正常工作时完全一样:
我逐行检查过,没有错误……

以下是内容:

## 这是 Discourse Docker 容器的全功能独立模板
##
## 修改此文件后,您必须重新构建
## /var/discourse/launcher rebuild app
##
## 编辑时请*非常*小心!
## YAML 文件对空白字符或缩进错误极其敏感!
## 必要时请访问 http://www.yamllint.com/ 验证此文件

templates:
  - "templates/postgres.template.yml"
  - "templates/redis.template.yml"
  - "templates/web.template.yml"
  - "templates/web.ratelimited.template.yml"
  - "templates/web.socketed.template.yml"
## 如果您想添加 Lets Encrypt (https),请取消注释以下两行
  - "templates/web.ssl.template.yml"
  - "templates/web.letsencrypt.ssl.template.yml"

## 此容器应暴露哪些 TCP/IP 端口?
## 如果您希望 Discourse 与另一个 Web 服务器(如 Apache 或 nginx)共享端口,
## 请参阅 https://meta.discourse.org/t/17247 了解详情
#expose:#
  - "80:80"   # http
  - "443:443" # https

params:
  db_default_text_search_config: "pg_catalog.english"

  ## 将 db_shared_buffers 设置为总内存的最大 25%。
  ## 将根据检测到的 RAM 由 bootstrap 自动设置,您也可以覆盖
  db_shared_buffers: "256MB"

  ## 可提升排序性能,但会增加每个连接的内存占用
  #db_work_mem: "40MB"

  ## 此容器应使用哪个 Git 修订版本?(默认:tests-passed)
  #version: tests-passed

env:
  LANG: en_US.UTF-8
  # DISCOURSE_DEFAULT_LOCALE: en

  ## 支持多少个并发 Web 请求?取决于内存和 CPU 核心数。
  ## 将根据检测到的 CPU 由 bootstrap 自动设置,您也可以覆盖
  UNICORN_WORKERS: 4

  ## TODO: 此 Discourse 实例将响应的域名
  ## 必需项。Discourse 无法仅使用 IP 地址运行。
  DISCOURSE_HOSTNAME: 'XXXXXXXXXXXX'

  ## 如果您希望容器以与上述指定的相同主机名(-h 选项)启动,请取消注释
  ## (默认值为 "$hostname-$config")
  #DOCKER_USE_HOSTNAME: true

  ## TODO: 初始注册时将设为管理员和开发者的逗号分隔邮箱列表
  ## 示例:'user1@example.com,user2@example.com'
  DISCOURSE_DEVELOPER_EMAILS: 'XXXXXXXXXXXX'

  ## TODO: 用于验证新账户和发送通知的 SMTP 邮件服务器
  # SMTP 地址、用户名和密码均为必需
  # 警告:SMTP 密码中的字符 '#' 可能引发问题!
  DISCOURSE_SMTP_ADDRESS: XXXXXXXXXXXX
  DISCOURSE_SMTP_PORT: 587
  DISCOURSE_SMTP_USER_NAME: XXXXXXXXXXXX
  DISCOURSE_SMTP_PASSWORD: "XXXXXXXXXXXX"
  DISCOURSE_SMTP_ENABLE_START_TLS: false           # (可选,默认为 true)

  ## 如果您添加了 Lets Encrypt 模板,请取消注释以下行以获取免费 SSL 证书
  LETSENCRYPT_ACCOUNT_EMAIL: XXXXXXXXXXXX

  ## 此 Discourse 实例的 http 或 https CDN 地址(配置为拉取)
  ## 请参阅 https://meta.discourse.org/t/14857 了解详情
  #DISCOURSE_CDN_URL: https://discourse-cdn.example.com

## Docker 容器是无状态的;所有数据均存储在 /shared 中
volumes:
  - volume:
      host: /var/discourse/shared/standalone
      guest: /shared
  - volume:
      host: /var/discourse/shared/standalone/log/var-log
      guest: /var/log

## 插件请放在此处
## 请参阅 https://meta.discourse.org/t/19157 了解详情
hooks:
  after_code:
    - exec:
        cd: $home/plugins
        cmd:
          - git clone https://github.com/discourse/docker_manager.git
          - git clone https://github.com/discourse/discourse-plugin-linkedin-auth.git
          - git clone https://github.com/discourse/discourse-oauth2-basic.git
          - git clone https://github.com/discourse/discourse-solved.git
          - git clone https://github.com/discourse/discourse-voting.git
          - git clone https://github.com/discourse/discourse-assign.git
          - git clone https://github.com/discourse/discourse-staff-notes.git
          - git clone https://github.com/discourse/discourse-checklist.git
          - git clone https://github.com/discourse/discourse-social-share.git
          - git clone https://github.com/rcfox/Discourse-LinkedIn-Sharing-Button.git
          - git clone https://github.com/BeXcellent/discourse-allowiframe.git

## 构建后运行的任何自定义命令
run:
  - exec: echo "开始自定义命令"
  ## 如果您想设置首次注册的“发件人”邮箱地址,请取消注释并修改:
  ## 收到首次注册邮件后,请重新注释该行。它只需运行一次。
  #- exec: rails r "SiteSetting.notification_email='info@unconfigured.discourse.org'"
  - exec: echo "自定义命令结束"}

尝试删除主机名和开发者邮箱中的 ' 字符

XXXXXXXXXXXX

为什么要注释掉这个命令?

#expose:#
  - "80:80"   # http
  - "443:443" # https

这解释了错误输出:

cat: 80:80: 没有那个文件或目录
cat: 443:443: 没有那个文件或目录
5 个赞

但我需要那些行留在那里!

Read what I said. You have added a #.

1 个赞

应为:

expose:
  - "80:80"   # http
  - "443:443" # https
6 个赞

我并没有让事情变得如此简单,因为如果有人需要思考:如果这是真的,那么这类错误是如何发生的?

2 个赞