Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9130161
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T07:54:33+00:00 2026-06-17T07:54:33+00:00

I used to be a .NET guy, and enjoyed using a nightly build system

  • 0

I used to be a .NET guy, and enjoyed using a nightly build system (continuous integration) called CruiseControl.NET to automatically deploy my applications to my staging environment each night.

Now that I’ve made the jump to Ruby on Rails and GitHub, I’ve found myself a little confused about how to setup an equivalent automated, nightly build system. I want to do things right, the Rails way, but I could use a push in the right direction.

Here’s what I’m using…

  • Ruby on Rails 3.2.9 (with asset pipeline)
  • RVM
  • Apache + Passenger
  • MySQL
  • Ubuntu 12.04 (staging server OS)
  • GitHub (SCM)

I’m looking for a system/solution that fulfills these requirements: (Ideally utilizing Capistrano…)

  • Deploy the latest commit from my ‘master’ branch in my GitHub repository to my staging server.
  • One-click build on-demand: I want to click a button or link to force a deploy (or re-deploy) at any time
  • Have the capability to run custom commands on the staging server as a part of the deploy (i.e. ‘bundle install’, restart Apache, etc…)
  • Automatic deploy daily or after a commit on GitHub (optional)

And because I’d never ask this question without doing some research first, here are some relevant resources I’ve found, but haven’t been able to decipher:

  • Automatic Deployment via Git
  • Deploying Rails 3 apps with Capistrano

Suggestions, anyone? Thanks!

  • David
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-17T07:54:34+00:00Added an answer on June 17, 2026 at 7:54 am

    Well, it turns out there is alot of good information out there regarding how to use Capistrano for this purpose (including Prakash’s reference), but none of it seems to be fully comprehensive.

    After many hours of picking through guide, after forum, after stack overflow question, I managed to fulfill most of my goals. To save time for others, I will try to provide answers and information that I found in the context of my original question.


    UPDATE:

    It turns out I was looking for Jenkins all along: it’s a perfect (an even an improved) analog to the CruiseControl build server application I had used before. Jenkins is a web application that kicks off builds on a scheduled basis or, with plugins, commit events. It doesn’t include functionality to actually deploy my Rails app, so that’s where Capistrano steps in. Using Jenkins’ “shell execute” build task to trigger Capistrano deploys, I was able to accomplish all of my goals above.

    Take a look at this guide for more detail.


    ORIGINAL POST:

    First off, Capistrano can work for the purpose of build system, however, it is not at all similar to CruiseControl.

    CruiseControl is:

    • A web application, that is run on a machine that serves as a ‘build server’
    • Any user may visit the web app to run builds; the user does not have to have anything setup or configured on their end… it’s just a webpage.
    • The interface also provides functions for logs, blame, scheduled builds, etc…

    Capistrano is:

    • Not an application or service, but a gem that works like rake; it bears similar functionality to the Ant and Nant scripts used by CruiseControl for the purpose of deploying.
    • Capistrano is run on a user’s local machine (typically the Rails app folder), and requires configuration on their end to run
    • It directly connects from the user’s machine to the remote server via SSH to perform deploys (this may not be preferable if you don’t want to grant users SSH access to the remote server)
    • Commands are run through a console i.e. cap deploy (this is as close as it gets to ‘one click’ deploys.)
    • It does produce logs, perform rollbacks etc.
    • It does not kick-off scheduled builds on its own (using cron was suggested)

    In regards to my original requirements…

    Deploy the latest commit from my ‘master’ branch in my GitHub repository to my staging server.

    Configuring Capistrano’s deploy.rb file will accomplish this.

    One-click build on-demand: I want to click a button or link to force a deploy (or re-deploy) at any time

    All Capistrano deploys are done through ‘force’: you run ‘cap deploy’ in your console manually

    Have the capability to run custom commands on the staging server as a part of the deploy (i.e. ‘bundle install’, restart Apache, etc…)

    Configuring Capistrano’s deploy.rb file will accomplish this. Most of these commands are included out of the box.

    Automatic deploy daily or after a commit on GitHub (optional)

    I haven’t figured this one out yet… a cron job might be the best way to do this.

    Setting up Capistrano

    Start with this tutorial from GitHub first. In your Rails App folder, you should end up with a Capfile and config/deploy.rb file.

    To save you some time, copy and paste these files, and tweak the settings to your needs.
    The files below are configured for:

    • Deployment to a test environment
    • GitHub
    • RVM based Rails
    • Using an explicit version of Ruby and gemset
    • Including untracked files (i.e. a database.yml file you didn’t commit to SCM)
    • Using Rails asset pipeline
    • Running migrate and seed with each deploy
    • Restarting Apache based Passenger with each deploy

    Capfile

    # Set this if you use a particular version of Ruby or Gemset
    set :rvm_ruby_string, 'ruby-1.9.3-p286@global'
    #set :rvm_ruby_string, ENV['GEM_HOME'].gsub(/.*\//,"") # Read from local system
    
    require "bundler/capistrano"
    # Uncomment this if you're using RVM
    require "rvm/capistrano"
    
    load 'deploy'
    # Uncomment if you are using Rails' asset pipeline
    load 'deploy/assets'
    load 'config/deploy' # remove this line to skip loading any of the default tasks
    

    config/deploy.rb

    # BEGIN RUBY CONFIG
    # You can manually override path variables here
    # set :default_environment, {
    #     'PATH' => "/usr/local/bin:/bin:/usr/bin:/bin:/<ruby-dir>/bin",
    #     'GEM_HOME' => '<ruby-dir>/lib/ruby/gems/1.8',
    #     'GEM_PATH' => '<ruby-dir>lib/ruby/gems/1.8',
    #     'BUNDLE_PATH' => '<ruby-dir>/lib/ruby/gems/1.8/gems'  
    # }
    # This changes the default RVM bin path
    # set :rvm_bin_path, "~/bin"
    
    # If your remote server doesn't have a ~/.rvm directory, but is installed
    # at the /usr/local/rvm path instead, use this line
    set :rvm_type, :system
    # END RUBY CONFIG
    
    default_run_options[:pty] = true  # Must be set for the password prompt
                                      # from git to work
    
    # BEGIN MULTIPLE ENVIRONMENT DEPLOYS
    # Read the following URL if you need to deploy to different environments (test, development, etc)
    # https://github.com/capistrano/capistrano/wiki/2.x-Multistage-Extension
    # set :stages, %w(production test)
    # set :default_stage, "test"
    # require 'capistrano/ext/multistage'
    # END MULTIPLE ENVIRONMENT DEPLOYS
    
    # BEGIN APPLICATION VARS
    set :application, "yourapp"
    set :rails_env, 'test'
    # END APPLICATION VARS
    
    # BEGIN PATH DEFINITIONS
    set(:releases_path)     { File.join(deploy_to, version_dir) }
    set(:shared_path)       { File.join(deploy_to, shared_dir) }
    set(:current_path)      { File.join(deploy_to, current_dir) }
    set(:release_path)      { File.join(releases_path, release_name) }
    # END PATH DEFINITIONS
    
    # BEGIN SCM VARS
    set :repository, "git@github.com:yourgithubuser/yourrepository.git"  # Your clone URL
    set :scm, "git"
    set :scm_username, "yourgithubuser"
    set :scm_password, proc{Capistrano::CLI.password_prompt('GitHub password:')}  # The deploy user's password
    set :branch, "master"
    # END SCM VARS
    
    
    # BEGIN SERVER VARS
    set :user, "ubuntu"  # The server's user for deploys
    role :web, "dev.#{application}" # The location of your web server i.e. dev.myapp.com
    role :app, "dev.#{application}" # The location of your app server i.e. dev.myapp.com
    role :db, "dev.#{application}", :primary => true  # The location of your DB server i.e. dev.myapp.com
    
    set :deploy_to, "/home/#{user}/www/#{application}"
    set :deploy_via, :remote_cache
    # Uncomment this if you want to store your Git SSH keys locally and forward
    # Else, it uses keys in the remote server's .ssh directory
    # ssh_options[:forward_agent] = true
    # END SERVER VARS
    
    # BEGIN ADDITIONAL TASKS
    before "deploy:start" do
      deploy.migrate
      deploy.seed
    end
    
    before "deploy:restart" do
      deploy.migrate
      deploy.seed
    end
    
    # Some files that the Rails app needs are too sensitive to store in SCM
    # Instead, manually upload these files to your <Rails app>/shared folder
    # then the following code can be used to generate symbolic links to them,
    # so that your rails app may use them.
    # In this example below, I link 'shared/config/database.yml' and 'shared/db/seed_data/moderators.csv'
    before "deploy:assets:precompile" do
      run ["ln -nfs #{shared_path}/config/settings.yml #{release_path}/config/settings.yml",
           "ln -nfs #{shared_path}/config/database.yml #{release_path}/config/database.yml",
           "mkdir -p #{release_path}/db/seed_data",
           "ln -nfs #{shared_path}/db/seed_data/moderators.csv #{release_path}/db/seed_data/moderators.csv",
           "ln -fs #{shared_path}/uploads #{release_path}/uploads"
      ].join(" && ")
    end
    
    namespace :deploy do
      # Define seed task (call 'cap deploy:seed')
      desc "Reload the database with seed data"
      task :seed do
        run "cd #{current_path}; bundle exec rake db:seed RAILS_ENV=#{rails_env}"
      end
    
      # If you are using Passenger mod_rails uncomment this:
      task :start do ; end
      task :stop do ; end
      task :restart, :roles => :app, :except => { :no_release => true } do
        run "#{try_sudo} touch #{File.join(current_path,'tmp','restart.txt')}"
      end
    end
    # END ADDITIONAL TASKS
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Since I'm a C#-/.NET-guy, I'm used to explicit interface implementations - like so: public
I often write .net applications that only support one instance. Formerly I used .net-remoting
I have successfully used protobuf-net.dll in console and WPF applications. However, when I tried
I have problems during serialization/deserialization. I'm using a WCF service (that used .NET framework)
Brief Summary: We are using Tridion 2009 SP1, however we never used .NET templating,
I'm using NET 2.0 WinForms for my C# application. Previously I used .NET 4.0
I'm using WinForms .NET 2.0 for my application. Previously, I used NET 4.0 to
I'm a .Net guy and used to csproj/vbproj files being the central repository for
I am used to working on C# .NET windows applications. I am interested in
I have used php.net and followed the documentation for creating a SOAP request using

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.