Tôi đang sử dụng đầu bếp để triển khai ứng dụng đường ray/nút. Mọi thứ diễn ra tốt đẹp khi tôi triển khai từ kho lưu trữ github công khai. Mặc dù vậy, tôi muốn triển khai từ kho lưu trữ github riêng và đang gặp sự cố. Dưới đây là những gì tôi hiện đang thực hiệnTriển khai một repo riêng trong Chef: Tôi đang làm gì sai với khóa triển khai của mình?
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://[email protected]/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 [email protected] "mkdir ~/.ssh" #create a ssh directory on my remote server
scp ~/.ssh/id_dsa [email protected]:.ssh/ #copy my private key over to the ssh directory on the remote server
cat ~/.ssh/id_dsa.pub | ssh [email protected] '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
Mọi thứ đều ổn cho đến khi quá trình khởi động cố gắng triển khai từ kho lưu trữ riêng tư. và nó sẽ hiển thị này:
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:
và sau đó hầu như bị đóng băng lên (về mặt kỹ thuật, tôi vẫn có thể gõ, nhưng không có gì tôi gõ ảnh hưởng đến kịch bản), cho đến khi 10 phút sau
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:
Nó sau đó liệt kê một trống đầu ra trong stdout và stderr, và một dấu vết ngăn xếp của nó cố gắng để chạy lệnh
Tôi đang làm gì sai và làm cách nào tôi có thể triển khai từ một kho lưu trữ riêng tư?
Có vẻ như khóa ssh của bạn đang yêu cầu diễn giải sao cho nó có thể kết nối với github. Bạn có thể thử tạo lại khóa mà không diễn giải và sau đó sử dụng không? ** Lưu ý: không sử dụng cách diễn giải trong khóa ssh là rủi ro bảo mật ** –