Using Capistrano to write Ruby and deploy Iteration

Source: Internet
Author: User

 
If you want to write ruby code on your own and deploy it at any time, you can view it everywhere. The heroku domain name is unfriendly and slow in China, so I think of capistrano, so I started learning... 



Capistrano

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


Capistrano new version installation

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

Http://capistranorb.com/

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


Just complete the installation and generate the capfile...

$ Bundle exec cap install


Detailed Configuration:

$ 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




Better Syntax:

$ 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 # Check your new command


Ssh should first avoid rsa password-free login. This is a digress, which can be Baidu;

There is also a way to explain how to deploy the rails project. For example, passag and unicorn won't be difficult;

Of course, you need hosts, domain names, and so on;

Now let's take a look at this. The host login and operation commands have all been reached. Later, sort out the notes and add some more...

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.