CSC/ECE 517 Fall 2013/ch1 1w09 hs

From Expertiza_Wiki
Revision as of 19:53, 16 September 2013 by Smairpa (talk | contribs) (→‎SHILPA)
Jump to navigation Jump to search

Code Deployment and Release Management with Rails

Code Deployment or Software Deployment and Release management with Ruby on Rails uses various tools such as Capistrano, Heroku, Mina, Vlad, Inploy etc. These automated tools are frameworks used to write and execute commands in parallel remote machines and thus ease the process of deployment and management of various applications.

Introduction

Deployment is a process of transferring your application onto a production server to make it available for other users. This process involves various activities and transitions between them. Though the general guidelines remain the same, the specific requirements vary with each software system.



Why Automation?

S

Deployment Automation Deliver your applications faster and with fewer errors using UrbanCode's software deployment automation tool: UrbanCode Deploy. Define your software deployment process and apply it across all of your environments consistently every time. With UrbanCode Deploy's automated application deployment platform, manual deployments become a thing of the past. Manual deployments are slow and error prone Deployment of a real world application is a complex and all-too-often manual process. IT deployment instructions are typically found in multiple documents, spread across several groups and may be incomplete, requiring tribal knowledge in order to be executed successfully. Components of the application may need to be deployed in some specific order to any number of environments, from early testing, user acceptance, and staging, to production, performance, and disaster recovery. The manual deployment process must be repeated for each environment. Manually-introduced errors are common and costly.

Read more at: http://www.urbancode.com/html/solutions/deployment-automation.html

Deployment Automation tools

Capistrano

Capistrano is a Ruby program that gives you a set of advanced tools to deploy web applications to your servers. With Capistrano it’s also possible to deploy to many machines at once. Capistrano offers many advanced options and can be used to deploy many kinds of applications.

It supports the scripting and execution of arbitrary tasks, and includes a set of sane-default deployment workdflows.

Capistrano can be used to:

Reliably deploy web application to any number of machines simultaneously, in sequence or as a rolling set

  • To automate audits of any number of machines (checking login logs, enumerating uptimes, and/or applying security patches)
  • To script arbitrary workflows over SSH
  • To automate common tasks in software teams.
  • To drive infrastructure provisioning tools such as chef-solo, Ansible or similar.

Capistrano is also very scriptable, and can be integrated with any other Ruby software to form part of a larger too.

Installing Capistrano

General Usage The following commands will clone Capistrano at the latest v3 revision, and will build the gem and install it locally.

$ gem install capistrano --pre --trust-policy HighSecurity

Or grab the bleeding edge head from:

$ git clone -b v3 https://github.com/capistrano/capistrano.git $ cd capistrano $ gem build *.gemspec $ gem install *.gem Signed Rubygems As Capistrano is a signed gem, you should always be careful to use the --trust-policy flag when installing Gems, or since Bundler 1.3 you should use the same flag:

$ gem install capistrano --pre --trust-policy HighSecurity $ bundle install --trust-policy HighSecurity If you get a message that looks like:

ERROR: While executing gem ... (Gem::Security::Exception) unsigned gems are not allowed by the High Security policy Then please complain to your Gem author, and have them start signing their Gems.

(More information about using Bundler with signed gems)

Usage in a Rails project Add the following lines to the Gemfile to the :development group ideally.

group :development do

 gem 'capistrano-rails', '~> 0.0.7'

end There will be a Gem released via rubygems.org, but as most people are still using Capistrano v2.x, the v3 release will not be pushed to rubygems.org just yet give people a chance to lock their version in their Gemfile.

The Capistrano-Rails Gem includes extras specifically designed for Ruby on Rails, specifically:

Asset Pipeline Support Gem Bundler Support Database Migration Support The documentation for these components can be found in their, respective, READMEs. However for the most part, to get the best, and most sensible results, simply require these files:

require 'capistrano/rails/assets' require 'capistrano/rails/gem-bundler' require 'capistrano/rails/database-migrations' Help! I was using Capistrano `v2.x` and I didn't want to upgrade!

If you are using Capistrano `v2.x.x` and have also installed Capistrano `v3` by mistake, then you can lock your Gem version for Capistrano at something like: gem 'capistrano', '~> 2.15' # Or whatever patch release you are using This is the pessimistic operator which installs the closest matching version, at the time of writing this would install 2.15.4, and any other point-release in the 2.15.x family without the risk of accidentally upgrading to v3.

Heroku

Vlad

Comparison between Capistrano/Heroku/Vlad

Criteria Capistrano Heroku Vlad
"Take some more [[tea]]," the March Hare said to Alice, very earnestly.

"I've had '''nothing''' yet," Alice replied in an offended tone, "so I can't take more."

"You mean you can't take ''less''?" said the Hatter. "It's very easy to take ''more'' than nothing."
<p>"Take some more <a title="Tea" href="/wiki/Tea">tea</a>," the March Hare said to Alice, very earnestly.</p>

<p>"I've had <strong>nothing</strong> yet," Alice replied in an offended tone, "so I can't take more."</p>

<p>"You mean you can't take <em>less</em>?" said the Hatter. "It's very easy to take <em>more</em> than nothing."</p>

"Take some more tea," the March Hare said to Alice, very earnestly.

"I've had nothing yet," Alice replied in an offended tone, "so I can't take more."

"You mean you can't take less?" said the Hatter. "It's very easy to take more than nothing."

Conclusion

References

technet.microsoft.com

<references/>

See Also