无需重建应用即可添加 Discourse 站点及 multisite.yml 问题

我开始折腾 Discourse 的多站点实例,想知道除了通过在 app.yml 中定义站点钩子外,是否有一种方法可以将此配置为外部文件(例如 multisite.yml,但放在主机 VPS 上而不是 Docker 容器内,至少可以从主机进行配置),或者是否可以通过一个 shell 脚本在数据库表中定义 Discourse 论坛。

我还想知道,是否有命令行或其他方法可以在不重建整个应用的情况下添加新站点?

hooks:
  after_postgres:
     # 这里需要为每个站点数据库进行设置,而不是 b_discourse
     - exec: sudo -u postgres createdb b_discourse || exit 0
     - exec:
          stdin: |
            grant all privileges on database b_discourse to discourse;
          cmd: sudo -u postgres psql b_discourse
          raise_on_fail: false

     - exec: /bin/bash -c 'sudo -u postgres psql b_discourse <<< "alter schema public owner to discourse;"'
     - exec: /bin/bash -c 'sudo -u postgres psql b_discourse <<< "create extension if not exists hstore;"'
     - exec: /bin/bash -c 'sudo -u postgres psql b_discourse <<< "create extension if not exists pg_trgm;"'

  after_code:
    - exec:
        cd: $home/plugins
        cmd:
          - mkdir -p plugins
          - git clone https://github.com/discourse/docker_manager.git
  before_bundle_exec:
    - file:
        path: $home/config/multisite.yml
        contents: |
         secondsite:
           adapter: postgresql
           database: b_discourse
           pool: 25
           timeout: 5000
           host_names:
             - sub.domain.tld

  after_bundle_exec:
    - exec: cd /var/www/discourse && sudo -H -E -u discourse bundle exec rake multisite:migrate

Discourse 多站点对我来说是新的,但我已经设置过 MediaWiki 多站点并且对此很熟悉。