我正在尝试使用saltstack和capistrano在ec2上创建运行我的rails应用程序 .
这是我迄今为止成功完成的工作 . 使用salt cloud和salt master我可以创建一个新的minion实例并设置应用程序运行所需的一切,即ruby,rails,unicorn,mysql等 .
我为capistrano做了正确的配置 . 当我尝试部署时,我看到以下错误 .
DEBUG [ed84c6ab] Command: ( GIT_ASKPASS=/bin/echo GIT_SSH=/pathto/git-ssh.sh /usr/bin/env git ls-remote -h git@github.com:somehost/somerepo.git )
DEBUG [ed84c6ab] Warning: Permanently added 'github.com,ip' (RSA) to the list of known hosts.
DEBUG [ed84c6ab] Permission denied (publickey).
DEBUG [ed84c6ab] fatal: Could not read from remote repository.
DEBUG [ed84c6ab]
DEBUG [ed84c6ab] Please make sure you have the correct access rights
DEBUG [ed84c6ab] and the repository exists.
DEBUG [ed84c6ab] Finished in 12.600 seconds with exit status 128 (failed).
所以这意味着从我当地的capistrano能够连接到minion但是当它试图检查git repo它失败了 .
我知道这种情况正在发生,因为minion的ssh公钥没有添加到github .
所以目标是 . 运行salt cloud以创建实例运行salt highstate以安装app运行capistrano deploy所需的所有内容以启动应用程序
我也想自动化github授权过程 . 我的意思是一旦minion被创建,minion应该能够克隆git repo而无需任何人工干预 .
我很困惑,这可以通过capistrano或saltstack来完成 .
1 回答
我使用github ssh转发来实现这一目标 . 这是我所做的改变 .
为github启用ssh forwarding的步骤
然后在capistrano deploy.rb文件中通过添加
forward_agent: true
配置ssh转发