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 126143
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T05:16:15+00:00 2026-05-11T05:16:15+00:00

I have a system in production that has several servers in several roles. I

  • 0

I have a system in production that has several servers in several roles. I would like to test a new app server by deploying to that specific server, without having to redeploy to every server in production. Is there a way to ask Capistrano to deploy to a specific server? Ideally I’d like to be able to run something like

cap SERVER=app2.example.com ROLE=app production deploy 

if I just wanted to deploy to app2.example.com.

Thanks!

[update] I tried the solution suggested by wulong by executing:

cap HOSTS=app2.server.hostname ROLE=app qa deploy  

but capistrano seemed be trying to execute tasks for other roles on that server in addition to app tasks. Maybe I need to update my version of cap (I’m running v2.2.0)?

  • 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. 2026-05-11T05:16:16+00:00Added an answer on May 11, 2026 at 5:16 am

    I ended up posting a question on the capistrano users list here, and got the following response from Jamis (edited a bit by me here for clarity):


    Try the HOSTS environment variable:

    cap HOSTS=app2.example.com production deploy 

    Note that doing this will treat app2 as being in every role, not just whichever role(s) it happens to be declared in.

    If what you want is to do a regular deploy, but only act on app2, and only as app2 is declared in your recipe file, you can use the HOSTFILTER variable instead:

    cap HOSTFILTER=app2.example.com production deploy  

    […]

    Consider this concrete example. Suppose your script defines three servers, A, B, and C. And it defines a task, ‘foo’, that (by default) wants to run on A and B, but not C. Like this:

    role :app, 'A', 'B' role :web, 'C'  task :foo, :roles => :app do   run 'echo hello' end 

    Now, if you do cap foo, it will run the echo command on both A and B.

    If you do cap HOSTS=C foo, it will run the echo command on C, regardless of the :roles parameter to the task.

    If you do cap HOSTFILTER=C foo, it will not run the echo command at all, because the intersection of (A B) and (C) is an empty set. (There are no hosts in foo’s host list that match C.)

    If you do cap HOSTFILTER=A foo, it will run the echo command on only A, because (A B) intersected with (A) is (A).

    Lastly, if you do cap HOSTFILTER=A,B,C foo, it will run the echo command on A and B (but not C), because (A B) intersected with (A B C) is (A B).

    To summarize: HOSTS completely overrides the hosts or roles declaration of the task, and forces everything to run against the specified host(s). The HOSTFILTER, on the other hand, simply filters the existing hosts against the given list, choosing only those servers that are already in the tasks server list.

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

Sidebar

Related Questions

I have an asp.net app that uses System.IO.Path.GetTempFileName() for temporary files. In the production
I have a system sitting on a Master Server, that is periodically transferring quite
I have a google app engine app that has been running for some time,
I have an Glassfish ESB based CASA app running in production system (Win 2k3)
I have a production system which has a button to go a quoting system
I have a Ruby on Rails app that has a scheduled job I execute
I have a simple ASP.NET hosted WCF Service that has several methods that all
I have a system I'm working on that has almost all of its logic
I have an intermittent problem in a production system that I haven't been able
I have a program on my production server, that returned this error: My main

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.