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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T17:18:13+00:00 2026-05-26T17:18:13+00:00

I have 3 separate staging servers set up in capistrano (and may have more

  • 0

I have 3 separate staging servers set up in capistrano (and may have more at some point). For example:

staging.example.com
staging2.example.com
staging3.example.com

The capfile for each specifies the same environment though:

set :rails_env, 'staging'

… and in `config/environments/staging.rb I’ve had to define default url options:

config.action_mailer.default_url_options = { host: 'staging.example.com' }

Unfortunately this eventually results in using the wrong server at some point. For example, while testing on staging2 you could get an email with “staging” set in the url… click it without thinking and then you’re on the wrong server.

I didn’t want to add a separate environment file for each staging server since there may be quite a few at some point and this is really the only change that is different per server, since it’s the hostname.

Is there any way to get around this without using a separate environment file per staging host? Is it possible to use capistrano’s :web setting as the host url?

role :web, "staging2.example.com"
  • 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-05-26T17:18:14+00:00Added an answer on May 26, 2026 at 5:18 pm

    I ended up using an APP_CONFIG variable loaded from a yml file on each server as described in this related question: Re-source .bashrc when restarting unicorn?

    Also, the original idea for the APP_CONFIG came from Railscast #226.

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

Sidebar

Related Questions

I have an environment config file that I'm using to separate dev from staging
I'm trying to set up forms authentication across multiple servers and subdomains. I have
We have 3 separate environments: a production ,a staging and an archive/backup environment A)
Do I need to have separate/multiple workers to run multiple websites (each with a
What's the best way to have separate CSS for IE and other browsers? I'm
In my ASP.NET application I have separate projects for the Data, Business and UI
I have web application which we deployed in a production . We have separate
I use subversion to manage my yii website (php framework) and have separate backend
I am trying to integrate CAS on Liferay. I have separate CAS server running
We have two separate web-apps, say 'retailUI' and 'bulkUI'. These two are basically two

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.