- 浏览: 131490 次
- 性别:
- 来自: 深圳
文章分类
最新评论
-
kqy929:
最近我也在使用spree-0.9.4,准备改定下。但发现,性能 ...
rails plugins 做一个电子商务系统 -
山雨欲来风满楼:
ruby的这个程序没有时间戳,好像 logger都没有时间戳, ...
logger (ruby) -
dazuiba:
很不可思议,照常理,这个是一个很常见的应用场景,为什么EXTJ ...
combo values in Editor Grid Panels combo值显示问题 -
xu_ch:
有没有helper?
(ruby)String Extensions(字符串、首字母大写,复数单数转换) -
panboxian_2008:
class Publisher(models.Model):
...
ruby 语言 手记
# 在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 文件中.
以下操作在 客户机 上进行
[root@ ~]# 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@~ [root@ ~]# cd /root/.ssh/id_dsa id_dsa id_dsa.pub [root@ ~]# scp -P 65534 /root/.ssh/id_dsa.pub root@192.168.188.199:/root/.ssh/
在远程服务器上 完成
cd .ssh umask 077 cat ./id_rsa.pub >> authorized_keys
回到客户机上用 ssh 192.168.188.199 -p65534
此时不用输密码即可登陆到服务器上.
http://snippets.dzone.com/tags/rails
评论
1 楼
xu_wccq
2008-11-20
# This defines a deployment "recipe" that you can feed to capistrano # (http://manuals.rubyonrails.com/read/book/17). It allows you to automate # (among other things) the deployment of your application. # ============================================================================= # REQUIRED VARIABLES # ============================================================================= # You must always specify the application and repository for every recipe. The # repository must be the URL of the repository you want this recipe to # correspond to. The deploy_to path must be the path on each machine that will # form the root of the application path. set :application, "CruiseControl.rb" set :repository, "svn://rubyforge.org/var/svn/cruisecontrolrb/trunk" # ============================================================================= # ROLES # ============================================================================= # You can define any number of roles, each of which contains any number of # machines. Roles might include such things as :web, or :app, or :db, defining # what the purpose of each machine is. You can also specify options that can # be used to single out a specific subset of boxes in a particular role, like # :primary => true. role :web, "localhost" #role :app, "app01.example.com", "app02.example.com", "app03.example.com" #role :db, "db01.example.com", :primary => true #role :db, "db02.example.com", "db03.example.com" # ============================================================================= # OPTIONAL VARIABLES # ============================================================================= # set :deploy_to, "/path/to/deployment" # defaults to "/u/apps/#{application}" # set :user, "flippy" # defaults to the currently logged in user # set :scm, :darcs # defaults to :subversion # set :svn, "/path/to/svn" # defaults to searching the PATH # set :darcs, "/path/to/darcs" # defaults to searching the PATH # set :cvs, "/path/to/cvs" # defaults to searching the PATH # set :gateway, "gate.host.com" # default to no gateway # ============================================================================= # SSH OPTIONS # ============================================================================= # ssh_options[:keys] = %w(/path/to/my/key /path/to/another/key) # ssh_options[:port] = 25 # ============================================================================= # TASKS # ============================================================================= # Define tasks that run on all (or only some) of the machines. You can specify # a role (or set of roles) that each task should be executed on. You can also # narrow the set of servers to a subset of a role by specifying options, which # must match the options given for the servers to select (like :primary => true) # Tasks may take advantage of several different helper methods to interact # with the remote server(s). These are: # # * run(command, options={}, &block): execute the given command on all servers # associated with the current task, in parallel. The block, if given, should # accept three parameters: the communication channel, a symbol identifying the # type of stream (:err or :out), and the data. The block is invoked for all # output from the command, allowing you to inspect output and act # accordingly. # * sudo(command, options={}, &block): same as run, but it executes the command # via sudo. # * delete(path, options={}): deletes the given file or directory from all # associated servers. If :recursive => true is given in the options, the # delete uses "rm -rf" instead of "rm -f". # * put(buffer, path, options={}): creates or overwrites a file at "path" on # all associated servers, populating it with the contents of "buffer". You # can specify :mode as an integer value, which will be used to set the mode # on the file. # * render(template, options={}) or render(options={}): renders the given # template and returns a string. Alternatively, if the :template key is given, # it will be treated as the contents of the template to render. Any other keys # are treated as local variables, which are made available to the (ERb) # template.
发表评论
-
sliceHost rails 空间 ror 主机
2009-02-27 23:17 1574sliceHost 注册购买虚拟主机. https://man ... -
ror opensource project开源rails应用
2009-02-05 11:17 2577warehouse 版本管理相关 http://www ... -
rails plugins 做一个电子商务系统
2009-01-20 16:49 2063第一阶段: 把以下三个rails插件跑起来。 spre ... -
ruby 小case
2009-01-07 10:08 0ruby 处理读取Excel 文件 .http://rc.or ... -
ruby 杂记
2009-01-05 14:17 1015匹配网站中的脚本<script src="pu ... -
"No such file to load" 解决策略, ruby on rails 开发注意事项
2008-10-29 18:16 7960服务器运行时解决 ... -
rails魔术字段的实现 ,alias_method_chain用法,for classmethod
2008-07-01 18:03 3244Encapsulates the common pattern ... -
redcloth 安装至ruby on rails 项目中
2008-06-27 22:45 17881. 拷贝redcloth.rb到ror的lib目录内。 ... -
rails route
2008-06-26 11:55 1638# ==== Relying on named ... -
ruby 日期
2008-06-25 12:38 1777difference = Time.now - time ... -
使用include中嵌Hash取出一个多层次的对象关联数据
2008-05-22 16:09 1143使用include中嵌Hash取出一个多层次的对象关联数据. ... -
多对多关联数据存储ROR
2008-04-22 10:16 1194Sku MODEL : class Sku < Ac ... -
HowToRunBackgroundJobsInRails--ap4r
2008-04-09 16:59 1055http://ap4r.rubyforge.org/wiki/ ... -
一个表单提交多条记录的处理(Ruby on Rails)
2008-04-07 21:34 2588使用的是一个一对多关联,代码如下:view: partial ... -
render 页面javascript调用
2008-04-03 17:18 3906情景: 在使用 rail 中的 自动完成功能 auto_c ... -
ajax auto_complete_field
2008-03-26 15:56 5# DEPRECATION WARNING: This met ... -
123
2008-03-25 17:06 323123333 -
Single table inheritance:单表继承
2008-03-07 16:34 1579Single table inheritance:单 ... -
RJS Reference
2008-01-29 08:53 2233JavaScriptGenerator 摘自:《OReill ... -
ruby 语言 手记
2008-01-16 16:32 1580Mixin 中的实例变量: 解决mixin多重继承中共享变量 ...
相关推荐
将此添加到您的deploy.rb文件中: set :graphite_url, "your/graphite/event/url" require "graphite-notify/capistrano" 要求 石墨: : 招数 由于这是一个capistrano任务,因此可以直接调用它: cap graphite:...
Capistrano +通知中心capistrano-nc集成了Capistrano和OS X Notification Center。... 如果此行为不适合您,则可以通过编辑deploy.rb将nc:finished deploy.rb挂接到任何自定义任务: after `your:t
5. 修改 config/deploy/staging.rb 文件 四、Capistrano 3 的配置文件 Capistrano 3 的配置文件主要包括以下几个文件: * Capfile:胶水文件,用于导入各种第三方库。 * config/deploy.rb:主配置文件,所有在...
CapistranoDb任务| 将数据库...安装将其添加为宝石: gem "capistrano-db-tasks" , require : false 添加到config / deploy.rb: require 'capistrano-db-tasks'# if you haven't already specifiedset :rails_env , "p
Capistrano 2 维护扩展 这个 gem 只是将最近删除的deploy:web:disable和deploy:web:enable任务提供给您的 ... 并将这一行放入您的 deploy.rb 文件中: require 'capistrano/maintenance' 现在,您可以禁用网络: c
使用 Capistrano 和 Composer 的 WordPress 部署机制将 repo 克隆到本地机器更改 config/deploy/production.rb 和 config/deploy/staging.rb 文件以匹配您的服务器凭据(IP 地址、用户、角色、路径) 调整 composer....
$ bundle或将其自己安装为: $ gem install capistrano-rocket-chat在您的Capfile中添加以下行: require 'capistrano/rocket_chat' 将包含webhook令牌的rocket.chat Webhook URL添加到您的deploy.rb文件中:...
建造gem build capistrano-s3copy-awscli.gemspecgem install --local capistrano-s3copy-awscli-[version].gem用法在您的deploy.rb文件中,我们需要告诉Capistrano采用我们的新策略: require 'capistrano-s3copy-...
请注意,任何 require 都应放在 Capfile 中,而不是 config/deploy.rb 中。 符号链接 您可能想要符号链接 Phoenix 共享文件和目录,例如: # deploy.rb set :linked_files, fetch(:linked_files, []).push('...
##要求Capistrano> = 2.5.5(与Capistrano 3不兼容) ##安装在Gemfile中 gem 'capistrano' , '~> 2.15.5' gem 'thunder_punch' , '~> 0.1.0'end ###简单设置在config / deploy.rb中 # deploy recipes - these ...
它将在 config/god/#{role} 中寻找脚本,编译它们并将它们部署到 God_deploy_dir公约您可以通过set :god_roles, [:app,:web]在config/deploy.rb或config/deploy/ENVIRONMENT.rb capistrano 部署文件中覆盖默认值。...
gem 'capistrano', '~> 3.4.0' " > Gemfilebundle installbundle updatecap install Capistrano全部设置完毕后,以该存储库中的文件为例,配置/config/deploy.rb和/config/deploy/production.rb 。部署技巧创建要...
Capistrano :: Resque ::游泳池 Capistrano集成,用于resque-pool 。 安装 将此行添加到您的应用程序的Gemfile中: ...# config/deploy/production.rb server 'background.example.com', roles: [:w
gem 'capistrano-friday' 然后执行: $ bundle 或将其自己安装为: $ gem install capistrano-friday用法在Capfile中要求使用任务: # Capfilerequire 'capistrano/friday' 在您的config/deploy.rb (或config/...
Capistrano ::凤凰 Phoenix与Capistrano的整合 ... 可配置选项(在deploy.rb中) set :phoenix_role -> { :some_role } #default {:app} set :phoenix_mix_env -> 'prod' #default fetch(:mix_env)
安装将此行添加到您的应用程序的Gemfile中: gem 'capistrano-recipes' , :git => 'https://github.com/auxilium/capistrano-recipes.git' 在您的deploy.rb需要所有或某些配方 # require all recipesrequire '...
卡皮斯特拉诺::狂欢Capistrano 3 的 Spree Commerce 特定任务。安装将此行添加到应用程序的 Gemfile 中... enabled = false 然后将任务添加到您的deploy.rb : after 'deploy:updated' , 'deface:precompile'贡献分叉吧
您可以通过复制 config/deploy/local.rb 文件并为您自己的服务器添加凭据来添加要部署到的服务器。 LISSA 部署已经带有本地服务器配置,可用于将 LISSA Kickstart 部署到使用设置的 Vagrant 框。 设置服务器后,...
说明 帽食谱的小集合。 用法 ...3a. 根据需要添加到deploy.rb选择脚本¶ ↑ load ( 'lib/recipes/backup.rb' ) load ( 'lib/recipes/certify.rb' ) 3b. 添加所有的脚本¶ ↑ Dir [ 'lib/recipes/*
Capistrano-shoryuken Shoryuken与Capistrano集成。 松散地基于capistrano-sidekiq 安装 将此行添加到您的应用程序的Gemfile中: ... # config/deploy.rb # Whether or not to hook into the default de