当前位置:  开发笔记 > 编程语言 > 正文

在Chef中部署私人仓库:我的部署密钥出错了什么?

如何解决《在Chef中部署私人仓库:我的部署密钥出错了什么?》经验,为你挑选了1个好方法。

我正在使用厨师来部署rails/node应用程序.当我从公共github存储库部署时,所有部署都很好.我想从私有github存储库部署,但我很难这样做.这是我目前正在做的事情

cd ~/.ssh                        # change directory to my .ssh directory
ssh-keygen -f'deploy_key' -N ''  # create a deploy_key key pair without a passphrase
cat deploy_key.pub | pbcopy      # copy the public key into my clipboard

-go to https://github.com/HairyMezican/PrivateRepoName/admin/keys
-click on 'Add another deploy key'
-type 'deploy_key' into 'Title' field
- ?V (paste command) into 'Key' field
-click 'Add Key'

tr "\n" "#" < deploy_key | sed 's/#/\\n/g' | pbcopy      #copy the private key into my clipboard, except with all of the newlines replaced with a slash-n
cd ~/chef-repo                                           #change over the the chef repo directory

mate data_bags/apps/my_app.json                          #edit the appropriate data bag in TextMate
--set the following couple of lines before saving
-"repository": "https://HairyMezican@github.com/HairyMezican/PrivateRepoName.git",
-"deploy_key": "?V (paste command into here)",

knife data bag from file apps data_bags/apps/my_app.json                        #upload the databag to my chef server
ssh root@12.34.56.789 "mkdir ~/.ssh"                                            #create a ssh directory on my remote server
scp ~/.ssh/id_dsa root@12.34.56.789:.ssh/                                       #copy my private key over to the ssh directory on the remote server
cat ~/.ssh/id_dsa.pub | ssh root@12.34.56.789 'cat - >> ~/.ssh/authorized_keys' #add my public key into the authorized keys list on the remote server
knife bootstrap 12.34.56.789 -dubuntu10.04-gems -rrole[myapp]                   #tell my chef server to bootstrap the remote server

一切顺利,直到引导过程尝试从私有存储库进行部署.它显示了这个:

12.34.56.789 [Sat, 03 Dec 2011 01:41:42 +0000] INFO: Processing deploy_revision[myapp] action deploy (application::rails line 155)
12.34.56.789 Password:

然后几乎冻结(技术上,我仍然可以键入,但我输入的任何内容都不会影响脚本),直到10分钟后

12.34.56.789 [Sat, 03 Dec 2011 01:51:51 +0000] ERROR: deploy_revision[myapp] (application::rails line 155) has had an error
12.34.56.789 [Sat, 03 Dec 2011 01:51:51 +0000] ERROR: deploy_revision[myapp] (/var/chef/cache/cookbooks/application/recipes/rails.rb:155:in `from_file') had an error:
12.34.56.789 deploy_revision[myapp] (application::rails line 155) had an error: command timed out:

然后它在stdout和stderr中列出一个空白输出,并在其中尝试运行该命令的堆栈跟踪

我做错了什么以及如何从私有存储库进行部署?



1> 小智..:

如果这是一个私人仓库,你应该使用你的git仓库的SSH路径,该路径也以git@github.com开头.

git@github.com:HairyMezican/PrivateRepoName.git

推荐阅读
谢谢巷议
这个屌丝很懒,什么也没留下!
DevBox开发工具箱 | 专业的在线开发工具网站    京公网安备 11010802040832号  |  京ICP备19059560号-6
Copyright © 1998 - 2020 DevBox.CN. All Rights Reserved devBox.cn 开发工具箱 版权所有