无法使用 capistrano -- 提示输入我不确定的密码

发布于 2024-09-28 23:31:26 字数 1560 浏览 8 评论 0原文

我的开发机器上的 ruby​​:ruby 1.8.7 (2010-01-10 patchlevel 249) [i486-linux] 我的开发机器上的 capistrano:Capistrano v2.5.5 开发机器上的操作系统:ubuntu 10.04 桌面版

服务器是在 ubuntu 服务器 64 位 10.04 上运行的 Amazon Web 服务实例 服务器上的 ruby​​:ruby 1.8.7(2010-01-10 补丁级别 249)[x86_64-linux] Capistrano v2.5.5

deploy.rb: http://gist.github.com/643504

我想要什么要做: 我希望能够部署在我的服务器 /var/www 中的 2 个不同文件夹上。 1 个文件夹是 example.com 例如,1 个文件夹是 example.biz

,.biz 是暂存文件夹,.com 是生产文件夹。

我还将有两个不同的数据库。 1 用于暂存 1 用于生产

我想使用 capistrano 在我的生产文件夹和暂存文件夹上部署代码。

为了部署暂存文件夹,我希望能够 1)仅在服务器上对暂存文件夹执行 git pull 。 2) 运行 bash 脚本来恢复临时数据库。脚本被编写并放置在暂存文件夹中。

对于生产文件夹,我只想能够在服务器上仅针对生产文件夹执行 git pull 。

紧急问题: 1)现在,当我测试我的代码时,我无法在服务器上仅针对暂存文件夹执行 git pull 。

我在我的开发机器上运行了这个命令。

cap staging 部署时

提示我输入我不确定的密码。

我所看到的截图 http://picasaweb.google.com/kimcity/Screenshots#5531588545516293762

请帮助

我已经尝试过这个 capistrano 密码提示

并且我在 ~/.ssh 中执行了以下操作 vi config

插入了以下文本

Host production
  Hostname example.com
  User username_of_server
  ForwardAgent yes

Host staging
  Hostname example.biz
  User username_of_server
  ForwardAgent yes

Host *
  ForwardAgent no

仍然对我不起作用。

潜在问题: 1)如果我在deploy.rb中犯了任何错误,这可能会导致我想要实现的目标进一步出现其他问题,请告诉我。

ruby on my development machine:ruby 1.8.7 (2010-01-10 patchlevel 249) [i486-linux]
capistrano on my development machine: Capistrano v2.5.5
OS on development machine: ubuntu 10.04 desktop edition

server is Amazon web service instance running on ubuntu server 64 bit 10.04
ruby on server: ruby 1.8.7 (2010-01-10 patchlevel 249) [x86_64-linux]
Capistrano v2.5.5

deploy.rb: http://gist.github.com/643504

what i want to do:
i want to be able to deploy on 2 different folders in /var/www in my server.
1 folder is for example.com
1 folder is for example.biz

the .biz is staging and .com is production.

i will also have 2 different databases. 1 for staging 1 for production

i want to use capistrano to deploy code on my production folder AND staging folder.

for deploying staging folder, i want to be able to
1) do a git pull at the server for the staging folder ONLY.
2) run a bash script that will restore the staging database. script is written and placed inside the staging folder.

for production folder, i just want to be able to do a git pull at the server for production folder ONLY.

IMMEDIATE issues:
1) right now as i test my code i am unable to do a git pull at the server for staging folder ONLY.

i ran this command in my devt machine.

cap staging deploy

i get prompted for a password i am not sure of.

screenshot of what i saw
http://picasaweb.google.com/kimcity/Screenshots#5531588545516293762

Please help

I have tried this capistrano password prompt

and i did the following in my ~/.ssh
vi config

inserted the following text

Host production
  Hostname example.com
  User username_of_server
  ForwardAgent yes

Host staging
  Hostname example.biz
  User username_of_server
  ForwardAgent yes

Host *
  ForwardAgent no

Still does not work for me.

Potential issues:
1) if i make any mistakes in my deploy.rb that may cause other issues further down the road towards what i want to achieve, please let me know.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

唱一曲作罢 2024-10-05 23:31:26

假设安装不是问题等,

假设您想要进行以下设置,

并且您想这样做:

从您的笔记本电脑运行“cap production deploy”并让您的服务器 git 从以下位置提取最新代码像 github.com 或 projectlocker.com 这样的公共存储库,

关键是您需要在您的服务器上创建一个用于部署的用户帐户。

让我们将此用户帐户称为“部署”(不带引号)。

1)确保“部署”具有您笔记本电脑的公钥。 (假设您已经为笔记本电脑创建了密钥对)

您的笔记本电脑的公钥是一长串文本,应该位于 /home/deploy/.ssh/authorized_keys 中,

如果文件夹或文件不存在,则创建它们。

2) 检查您是否可以使用笔记本电脑上的deploy@server ssh 进入服务器。如果这有效,则意味着您已正确完成 1)。

3) 生成用于在您的服务器计算机上“部署”的密钥对。

4) 访问github.com或projectlocker并将3)中密钥对的公钥放在网站上。

5) 转到服务器上的工作文件夹。如果该文件夹中还没有 .git,请执行 git init。运行 git pull [email protected]:abc.git 或任何您的 git 存储库网址是。

6) 如果您成功从 github 或 projectlocker 的公共存储库中提取最新代码,则步骤 3 和 4 已正确完成。

7) 现在确保您的deploy.rb 中有以下内容

# set server user account responsible
set :user, "deploy"

# Deploy via a remote repository cache. In git's case, it 
# does a "git fetch" on the remote cache before moving it into place
# can change this to :copy but apparently :remote_cache is faster
set :deploy_via, :remote_cache

8) 运行“cap production deploy:setup”,因为您将是第一次部署。

9) 随后运行“上限生产部署”。

assuming installation is not an issue etc,

assuming that you want to have the following setup,

and that you want to do it this way:

run "cap production deploy" from your laptop and have your server git pull the latest code from a public repository like github.com or projectlocker.com

the key thing is that you need to create a user account ON YOUR SERVER that is meant for deployment.

let us call this user account 'deploy' without the quotes.

1) make sure that 'deploy' has the public key of your laptop. (assuming you already have created a key pair for your laptop)

the public key of your laptop is a long sequence of text that should be in /home/deploy/.ssh/authorized_keys

create the folders or file if they do not exist.

2) check that you can ssh into the server using deploy@server from your laptop. if this works, it means that you have done 1) correctly.

3) generate keypair for 'deploy' at your server machine.

4) go to github.com or projectlocker and place the public key of the keypair in 3) over at the website.

5) go to your working folder at server. Do a git init if you did not already have a .git inside that folder. run git pull [email protected]:abc.git or whatever your git repo url is.

6) if you succeed to pull your latest code from the public repo at github or projectlocker, steps 3 and 4 were correctly done.

7) now ensure that you have the following in your deploy.rb

# set server user account responsible
set :user, "deploy"

# Deploy via a remote repository cache. In git's case, it 
# does a "git fetch" on the remote cache before moving it into place
# can change this to :copy but apparently :remote_cache is faster
set :deploy_via, :remote_cache

8) run "cap production deploy:setup" because you are going to deploy for the very first time.

9) run "cap production deploy" subsequently.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文