Capistrano deploy.rb文件的记录


# 在redhat 内核中不需要sudo 方式运行。
set :use_sudo, false # Do not use sudo ro run command.

set :domain, 'www.firebirds.com'
set :application, 'ruby_on_rails'
set :user, 'root' # connect to server use this variable. # 连接app服务器,并执行命令

set :repository, "svn://172.10.12.8/www/ror/trunk"

set :port, 8888 # connect server use ssh with this port# ssh连接app服务器的端口号.

set :deploy_to, "/var/www/ror" # deploy to server location


# set :scm, :subversion
set :scm_username, 'xxx'

set :scm_password, proc{Capistrano::CLI.password_prompt('SVN pass:')} # 在出现SVN pass: 时输入svn密码. # 在第一次用过后,svn shell会记住此密码,下次可不用。

# control mongrel_cluster
#require 'mongrel_cluster/recipes'
#set :mongrel_conf, "/etc/mongrel_cluster/spare.yml"

role :app, "172.10.12.8"
role :web, "172.10.12.8"
role :db, "172.10.12.8", :primary => true

# app, web, db 都 在同一台机器上如下即可
#server "172.10.12.8", :app, :web, :db, :primary => true

set :deploy_via, :export # 在服务器上连接到源码库里去更新
# set :deploy_via, :copy # 在本地打包上传至服务器

set :runner, user # excute command with the front of user defined.


# Does not look like you are using the fastcgi processes that reaper is
# designed to restart in the setup you described. In your cap script set
# them to false. EG set :spinner, "false". See the manual for details.
set :spinner, "false" # 使用fascgi 的话,把此行注释

#after 'deploy', 'deploy:cleanup' # hock after deploy
#after 'deploy:migrations', 'deploy:cleanup' # hock after deploy:migrations




在用capistrano 进行部署的时候,会希望专用一个web app来管理 这些部署 应用程序如:ccrb
那么ssh 也需要自动登陆出服务器上,如下:但这样不够安全,最好的是不定期的生成ssh密钥;
如:
客户机要想自动登陆到服务器192.168.188.199 上.
1 . 在客户机上制作密钥
2. 把密钥拷至服务器上,追加到.ssh/authorized_keys 文件中.


[size=large] 以下操作在 客户机 上进行[/size]
[code="python"]
# ssh-keygen -t dsa
Generating public/private dsa key pair.
Enter file in which to save the key (/root/.ssh/id_dsa):
Enter passphrase (empty for no passphrase): # 回车
Enter same passphrase again: # 回车
Your identification has been saved in /root/.ssh/id_dsa.
Your public key has been saved in /root/.ssh/id_dsa.pub.
The key fingerprint is:
ad:85:bddb5:ddr:a544c:fc:ef:57:dd:4b:ef:a9:8a:db root@~

# cd /root/.ssh/id_dsa
id_dsa id_dsa.pub
# scp -P 65534 /root/.ssh/id_dsa.pub root@192.168.188.199:/root/.ssh/

[/code]

[size=large]
在远程服务器上 完成
[/size]

cd .ssh
umask 077
cat ./id_rsa.pub >> authorized_keys



回到客户机上用 ssh 192.168.188.199 -p65534
此时不用输密码即可登陆到服务器上.


http://snippets.dzone.com/tags/rails
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值