在自托管网站上安装插件

@Discourse,如果您想更新指南,这是可行的代码:

要使用您自己的 SSH 密钥访问私有存储库,请按照以下步骤操作:

  1. 将私有 SSH 密钥放在 /var/discourse/shared/standalone/identity/id_rsa(或容器可访问的其他位置;如果您选择其他位置,请记住在下面的模板中相应地更新路径)。

  2. 使用以下模板添加您的插件:

hooks:
  after_code:
    - exec:
        cd: $home/plugins
        cmd:
          # 设置私有存储库访问
          - chown $(whoami) /shared/identity/id_rsa && chmod 600 /shared/identity/id_rsa
          - git config --global core.sshCommand "ssh -o StrictHostKeyChecking=no -o IdentitiesOnly=yes -i /shared/identity/id_rsa"

          # 我的私有插件
          - git clone git@example.com:repo/private-discourse-plugin.git

          # 取消设置访问
          - git config --global --unset core.sshCommand
5 个赞