zoukankan      html  css  js  c++  java
  • 使用 Capistrano 和写作 Ruby 迭代边缘部署

    
    
    
    想边自己写ruby代码,边部署随时能够到处查看,heroku域名又不友好,速度在国内又慢。于是乎想起来capistrano,于是学起 ...


    capistrano 一点入门认知

    https://www.evernote.com/shard/s6/sh/72a2b7c8-d531-4efc-9e16-ac82af2a92b7/e54fca8a9e7014ad87c79e7a7a5538c4


    capistrano 新版的安装

    http://capistranorb.com/documentation/getting-started/preparing-your-application/

    http://capistranorb.com/

    # Deploy in Gemfile
    gem 'capistrano', '~> 3.2.0'


    完毕安装即可。并生成capfile等即可了 ...

    $bundle exec cap install


    具体配置:

    $vim config/deploy/production.rb

    ## content
     11 server 'qzi.me', roles: [:demo], port:1234, user: 'qzi'
     12 task :uptime do |host|
     13     on roles(:demo), in: :parallel do
     14           uptime = capture(:uptime)
     15           hostname =  capture(:hostname)
     16               puts "#{hostname} reports: #{uptime}"
     17     end
     18 end

    $ cap production uptime




    更优写法:

    $vim config/deploy/production.rb

    server 'qzi.me', roles: [:demo], port: 1234, user: ‘qzi’


    $ vim lib/capistrano/tasks/test.rake

    desc "check the uptime on the host"
    task :uptime do |host|
        on roles(:demo), in: :parallel do
              uptime = capture(:uptime)
              hostname =  capture(:hostname)
                  puts "#{hostname} reports: #{uptime}"
        end

    end 


    $cap -T    # 能够查到你新增加的命令了


    ssh 本身先弄免rsa免password登陆。这个是题外话,能够百度之;

    还有就是rails 项目怎么部署解释起来得另外去学,比方passenger, unicorn 等都不会非常难;

    当然自己要有主机, 域名之类的;

    临时先这样吧。主机登陆和操作命令都已经点到,以后把笔记再整理一通过与一些撞在了一起 ...

    版权声明:本文博客原创文章,博客,未经同意,不得转载。

  • 相关阅读:
    Sql Server 2005开发新特性笔记
    动态调用Web Service(ZT)
    web.config详解(配置文件节点说明)
    SQL分页语句
    在SQL Server 2005数据库中更改数据架构
    [转]在WinForm应用程序中实现自动升级
    DataGrid 导出 EXCEL(简单,实用)
    在WinForm中使用WebServices来实现软件自动升级(AutoUpdate)(C#)
    工作小结TextBox为密码框赋值技巧,CSS溢出显示省略号方法
    自动更新程序源码下载(C#.Net)
  • 原文地址:https://www.cnblogs.com/gcczhongduan/p/4615214.html
Copyright © 2011-2022 走看看