为 Dokku 使用远程 git 存储库
Use remote git repository for Dokku
我已经通过 Dokku 部署了我的应用程序。它易于使用且很有帮助。但在 Dokku 中,您需要在 git 中添加新的遥控器。例如,
git remote add dokku dokku@dokku.me:app
但是,我想使用我的 github.com 存储库。我应该将我的项目推送到 master 分支,我的托管应用程序应该更新。
我怎样才能做到?
dokku
远程用于部署到您的服务器。您可以使用您的 github.com 存储库作为您的 origin
遥控器来处理您的代码。
创建 origin
github.com 远程(如果尚未创建),然后将您的代码推送到它。进行更改时,请在此处检查您的代码。
当您准备好将最新更改部署到托管应用程序时,您将使用 git push dokku master
推送到 dokku
。
Continuous Deployment with Codeship and Dokku
以下步骤将帮助您成功地从 Codeship 部署到 Dokku。这不会花很长时间来实施。您只需要来自您的 Codeship 项目的 public ssh 密钥和下面的 bash 脚本。
保存 Codeship 项目的 public 密钥。它位于“项目设置”>“常规设置”中。
在项目 repo 中创建一个标签为 tmp 的文件夹,然后将 ssh 密钥保存为 codeship_projectname.pub。
粘贴时确保所有内容都在一行中,而不是多行。
在控制台中使用以下命令将 public 密钥添加到您的 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 服务器。
我已经通过 Dokku 部署了我的应用程序。它易于使用且很有帮助。但在 Dokku 中,您需要在 git 中添加新的遥控器。例如,
git remote add dokku dokku@dokku.me:app
但是,我想使用我的 github.com 存储库。我应该将我的项目推送到 master 分支,我的托管应用程序应该更新。
我怎样才能做到?
dokku
远程用于部署到您的服务器。您可以使用您的 github.com 存储库作为您的 origin
遥控器来处理您的代码。
创建 origin
github.com 远程(如果尚未创建),然后将您的代码推送到它。进行更改时,请在此处检查您的代码。
当您准备好将最新更改部署到托管应用程序时,您将使用 git push dokku master
推送到 dokku
。
Continuous Deployment with Codeship and Dokku
以下步骤将帮助您成功地从 Codeship 部署到 Dokku。这不会花很长时间来实施。您只需要来自您的 Codeship 项目的 public ssh 密钥和下面的 bash 脚本。
保存 Codeship 项目的 public 密钥。它位于“项目设置”>“常规设置”中。
在项目 repo 中创建一个标签为 tmp 的文件夹,然后将 ssh 密钥保存为 codeship_projectname.pub。
粘贴时确保所有内容都在一行中,而不是多行。
在控制台中使用以下命令将 public 密钥添加到您的 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 服务器。