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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T08:37:19+00:00 2026-05-23T08:37:19+00:00

I cannot seem to get Capistrano to play nicely with AmazonRDS. I’ve looked all

  • 0

I cannot seem to get Capistrano to play nicely with AmazonRDS. I’ve looked all over the place for any info on setting this up correctly, but haven’t found any. Right now, when I cap deploy, the process times out.

This is my deploy.rb:

set :deploy_to, "/opt/bitnami/apps/annarbortshirtcompany.com/cms/" 
set :scm, :git
set :repository,  "ssh://user@ec2-repository.compute-1.amazonaws.com/~/repo/cms.git"
set :deploy_via, :remote_cache

set :user, "user"
ssh_options[:keys] = [File.join(ENV["HOME"], "EC2", "admin.pem")]
ssh_options[:forward_agent] = true
set :branch, "master"
set :use_sudo, true

set :location, "ec2-webserver.compute-1.amazonaws.com"
role :web, location
role :app, location
role :db, "cmsinstance.c7r8frl6npxn.us-east-1.rds.amazonaws.com", :primary => true

# If you are using Passenger mod_rails uncomment this:
namespace :deploy do
  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

The username for the RDS database instance differs from the SSH username set here, but is defined in my database.yml. I figure that this is probably not being read by capistrano, but have no idea how to make that happen.

When I “cap deploy”:

ubuntu@ubuntu-VirtualBox:~/RailsApps/cms$ cap deploy
  * executing `deploy'
  * executing `deploy:update'
 ** transaction: start
  * executing `deploy:update_code'
    updating the cached checkout on all servers
    executing locally: "git ls-remote ssh://user@ec2-repository.compute-1.amazonaws.com/~/repo/cms.git master"
    command finished in 1590ms
  * executing "if [ -d /app-directory/shared/cached-copy ]; then cd /app-directory/shared/cached-copy && git fetch -q origin && git fetch --tags -q origin && git reset -q --hard ffc4ec7762566f801c4a9140aa3980dc71e3d06f && git clean -q -d -x -f; else git clone -q  ssh://user@ec2-repository.amazonaws.com/~/repo/cms.git /app-directory/shared/cached-copy && cd /app-directory/shared/cached-copy && git checkout -q -b deploy ffc4ec7762566f801c4a9140aa3980dc71e3d06f; fi"
    servers: ["ec2-webserver.compute-1.amazonaws.com", "dbinstance.us-east1.rds.amazonaws.com"]
*** [deploy:update_code] rolling back
  * executing "rm -rf /app-directory/releases/20110607161612; true"
    servers: ["ec2-webserver.compute-1.amazonaws.com", "dbinstance.us-east1.rds.amazonaws.com"]
 ** [deploy:update_code] exception while rolling back: Capistrano::ConnectionError, connection failed for: dbinstance.us-east1.rds.amazonaws.com (Errno::ETIMEDOUT: Connection timed out - connect(2))
    connection failed for: dbinstance.us-east1.rds.amazonaws.com (Errno::ETIMEDOUT: Connection timed out - connect(2))

Why would it want to “update the cached checkout on all servers”? The DB server shouldn’t even be needed at this point. I am stumped at how to fix this. Hopefully someone can point me in the right direction!

  • 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-23T08:37:20+00:00Added an answer on May 23, 2026 at 8:37 am

    I had this exactly problem and struggled with it for what I’m embarrassed to say was a good 5 or 6 hours. In the end, when I realized what the problem was I felt like smacking myself because I knew this once but had forgotten it. Here’s the crux of the problem, starting with this part of deploy.rb:

    set :location, "ec2-webserver.compute-1.amazonaws.com"
    role :web, location
    role :app, location
    role :db, "cmsinstance.c7r8frl6npxn.us-east-1.rds.amazonaws.com", :primary => true
    

    When you define the machine roles for Capistrano, you’re not actually identifying which machines will play a particular role…rather, you’re identifying on which machines the Capistrano code will run when applying a deployment recipe for a role. So, when you define the :db role, you want to point to your EC2 instance, not the RDS instance. You can’t ssh into the RDS machine, so it’s impossible for Capistrano to run a recipe there. Instead, point :db to the same machine as you’re pointing :web and :app, i.e.

    set :location, "ec2-webserver.compute-1.amazonaws.com"
    role :web, location
    role :app, location
    role :db, location, :primary => true
    

    How does the RDS machine then have any involvement? Well, it’s the database.yml file that dictates which machine is actually running the RDBMS where the SQL needs to be executed. You just need to be sure you’re setting the host: value for the target database, e.g.:

    production:
      adapter: mysql2
      encoding: utf8
      reconnect: false
      database: <your_db>_production
      pool: 5
      username: <username>
      password: <password>
      host: cmsinstance.c7r8frl6npxn.us-east-1.rds.amazonaws.com
    

    Make sense?

    I hope this save someone else the frustration I experienced.

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

Sidebar

Related Questions

I cannot seem to get this to work. Any thoughts? <html xmlns=http://www.w3.org/1999/xhtml> <head> <meta
I am using PDO and prepared statements, but i cannot seem to get any
I'm terribly new to SQL, and cannot seem to get the desired information out,
I cannot seem to debug my JavaScript code with Firebug. The play button is
I cannot seem to get a nested form to generate in a rails view
I cannot seem to get a message from drupal_set_message when a user registers on
I cannot seem to get the Maven Glassfish plugin working for the life of
I cannot seem to get how this is done. I've read a bit about
I cannot seem to get the following to work directory <- ./ files.15x16 <-
I cannot seem to get this right, I am trying to modify a field

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.