【问题标题】:Use remote git repository for Dokku为 Dokku 使用远程 git 存储库
【发布时间】:2018-01-22 06:53:06
【问题描述】:

我已经通过 Dokku 部署了我的应用程序。它易于使用且很有帮助。但在 Dokku 中,您需要在 git 中添加新的遥控器。例如,

git remote add dokku dokku@dokku.me:app

但是,我想使用我的 github.com 存储库。我应该将我的项目推送到 master 分支,并且我的托管应用程序应该更新。

我该怎么做?

【问题讨论】:

    标签: git continuous-deployment dokku


    【解决方案1】:

    dokku 远程用于部署到您的服务器。您可以使用您的 github.com 存储库作为您的 origin 远程处理您的代码。

    创建origin github.com 远程(如果尚未创建),并将您的代码推送到它。进行更改时在此处检查您的代码。

    当您准备好将最新更改部署到托管应用程序时,您将使用 git push dokku master 推送到 dokku

    【讨论】:

      【解决方案2】:

      Continuous Deployment with Codeship and Dokku

      以下步骤将帮助您成功从 Codeship 部署到 Dokku。这不会花很长时间来实施。您只需要 Codeship 项目中的公共 ssh 密钥和下面的 bash 脚本。

      保存 Codeship 项目的公钥。它位于项目设置 > 常规设置中。

      在项目 repo 中创建一个标记为 tmp 的文件夹,然后将 ssh 密钥保存为 codeship_projectname.pub。

      确保粘贴时所有内容都在一行而不是多行。

      在控制台中使用以下命令将公钥添加到您的 dokku 服务器。 ​

      cat tmp/codeship_projectname.pub | ssh root@dokkuinstance.com "sudo sshcommand acl-add dokku codeship_projectname" 
      

      在 Codeship 中,转到项目设置 > 部署。配置您的部署管道。

      添加新的自定义脚本。

      将以下行添加到自定义脚本中。

      #!/bin/sh
      git fetch --unshallow || true
      git fetch origin "+refs/heads/*:refs/remotes/origin/*"
      # checkout a remote branch with
      # git checkout -b test origin/test
      git remote add dokku dokku@dokkuinstance.com:projectname
      git push dokku master
      

      现在,每次您在 Codeship 上构建时,它都应该部署到您的 Dokku 服务器。

      Here's a tutorial on my blog. Hope this helps!

      【讨论】:

        猜你喜欢
        • 2011-09-12
        • 2015-01-18
        • 2010-10-09
        • 2012-11-28
        • 1970-01-01
        • 2020-07-13
        • 2017-04-29
        • 2013-04-13
        相关资源
        最近更新 更多