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

  • SEARCH
  • Home
  • 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 8407041
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T23:16:32+00:00 2026-06-09T23:16:32+00:00

I am trying to deploy a Ruby On Rails app to both staging and

  • 0

I am trying to deploy a Ruby On Rails app to both staging and then production using Capistrano.

The only difference between the two is the :domain and the :repository

I have followed this guide here: https://github.com/capistrano/capistrano/wiki/2.x-Multistage-Extension

I have searched around the net and all I find are articles that basically rehash what I have above.

I have tried just setting the :domain and :repository in the config/deploy/staging.rb and config/deploy/production.rb

I have checked my spellings to make sure I spelt the sub-dirs correctly and the names of the files.

Reading this article: staging and live app with capistrano it looks like I should just be able to declare the differences here.

It doesn’t look like the staging.rb file is actually being read. I changed my “deploy.rb” to have a single swear word as the first line, “cap deploy” gives me the expected error.

If I put a single swear word on the first line of “staging.rb” or “production.rb” I get the same error:

`method_missing': undefined local variable or method `domain'

The line in question is:

role :web, domain

because the value is not being picked up. But surely it should fail on the single swear word in staging.rb or production.rb and not run at all?

If I move the :domain and :repository back into the main “deploy.rb” file I get the error with the swear word. So it would seem that I can’t set variables in the “staging.rg” and “production.rb” files but just complete tasks.

Any help would be much appreciated or do you think I should just take the pizza delivery job …

deploy.rb:

require 'capistrano/ext/multistage'
set :stages, %w(production staging)
set :default_stage, "staging"

set :user, 'dave'

set :applicationdir, "~/rails/example.com"

set :scm, 'git'

set :git_enable_submodules, 1 # if you have vendored rails
set :branch, 'master'
set :git_shallow_clone, 1
set :scm_verbose, true

set :keep_releases, 5
after "deploy:update", "deploy:cleanup"

# roles (servers)
role :web, domain
role :app, domain
role :db,  domain, :primary => true

after "deploy", "deploy:migrate"

# deploy config
set :deploy_to, applicationdir
set :deploy_via, :export
# set :rake, 'bundle exec rake'

# additional settings
default_run_options[:pty] = true  # Forgo errors when deploying from windows
set :ssh_options, {:forward_agent => true}
#ssh_options[:keys] = %w(/home/user/.ssh/id_rsa)            # If you are using ssh_keysset :chmod755, "app config db lib public vendor script script/* public/disp*"set :use_sudo, false


# Passenger
namespace :deploy do
   task :start do ; end
   task :stop do ; end
   task :restart, :roles => :app, :except => { :no_release => true } do
      run " touch #{File.join(current_path,'tmp','restart.txt')}"
   end
end

And my config/deploy/staging.rb file:

set :domain, 'example.com'
set :repository,  "ssh://dave@example.com/~/rails/chamonix-mont-blanc.net"

If I put the :domain and :repository in the main “deploy.rb” it all works fine and dandy.

  • 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-09T23:16:32+00:00Added an answer on June 9, 2026 at 11:16 pm

    Move roles to your staging.rb file so that it looks like

    set :domain, 'example.com'
    
    role :web, domain
    role :app, domain
    role :db,  domain, :primary => true
    
    set :repository,  "ssh://dave@example.com/~/rails/chamonix-mont-blanc.net"
    

    Remove roles code from deploy.rb. Also, you’ll have to modify your production.rb similarly.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm currently trying to deploy an Ruby on Rails 3.0.9 app on a production
I'm trying to deploy my rails application by using Passenger and Capistrano on Dreamhost.
I am trying to deploy a rails app on webbyapp. I am using sunspot
I'm trying to deploy a Rails app that uses Bundler via Capistrano. Running cap
I'm trying to deploy a simple Ruby on Rails app to dreamhost but I'm
I'm trying to deploy a small rails3 app to a FreeBSD host using capistrano
I'm trying to deploy a simple skeleton Rails 3.0.5 (and Ruby 1.9.2) app to
I'm trying to deploy an app on engine yard. I'm using rails 2.3.5 and
I'm trying to deploy a ruby on rails app to dotcloud. The app is
I'm trying to deploy my Rails 3.0 app. I use rvm and ruby 1.9.2

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.