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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T19:07:32+00:00 2026-05-25T19:07:32+00:00

We have a Rails 3.1 app that allows users to upload photos to Amazon

  • 0

We have a Rails 3.1 app that allows users to upload photos to Amazon S3. Since we’re using S3 in production I’d like to automatically (on cap deploy) also upload the precompiled assets (application.js & application.css & images) to our S3 bucket where they’ll be served. Simple enough.

Beyond setting config.action_controller.asset_host = "http://assets.example.com"

In short, I’m looking for some examples of a working “recipe” for Capistrano to do so but can’t seem to find any modern (3.1 asset pipeline compatible) ones. We are successfully precompiling the assets but how to move them to S3? And, ideally, only the ones that have changed?

“Meat” of current “recipe”:

...

after "deploy:update_code", "deploy:pipeline_precompile"
before "deploy:finalize_update", "deploy:copy_database_config"

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

  # copy database.yml into project
  task :copy_database_config do
    production_db_config = "/path_to_config/#{application}.yml"
    run "cp #{production_db_config} #{current_release}/config/database.yml"
    `puts "replaced database.yml with live copy"`
  end
  task :pipeline_precompile do
    run "cd #{release_path}; RAILS_ENV=production bundle exec rake assets:precompile"
  end
end
  • 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-25T19:07:33+00:00Added an answer on May 25, 2026 at 7:07 pm

    While this doesn’t directly answer the question of uploading your assets to S3 on deploy, I think the following approach may address your goals and be a little simpler to implement.

    The primary benefits of hosting assets on S3 and using the config.action_controller.asset_host directive include (among others):

    • allowing additional simultaneous downloads of assets
    • serving assets from a cookie-free domain

    Rather than using s3, you can use the CloudFront CDN to achieve the same benefits. The new rails asset pipeline plays very nicely with CloudFront. Here are the steps I am currently using in production:

    Create a new CloudFront distribution

    1. Delivery Method should be Download
    2. Choose Custom Origin and point it to your web server
    3. For Distribution Details you can add addition CNAME records such as cdn01.mydomain.com etc.
    4. Default Root Object can be left empty

    If your site is served over SSL, you will need to use the x12whx1751nfir.cloudfront.net style hostname as custom certificates are not available yet as they are with ELB and your users will see certificate hostname mismatch errors. If you don’t use SSL, you can use the either the default hostname or any CNAMEs prodvided.

    Once this is setup, the initial object requests will be fetched from your server and placed within CloudFront. The digest fingerprints generated by the asset pipeline will handle your requirement for only sending assets which have changed.

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

Sidebar

Related Questions

I have a Rails app that allows users to build up a network structure
I have a Rails app which allows users to upload Excel files which need
I'm building an app in Rails that allows users to upload images to their
I have a rails app I am working on that allows users to create
I have a rails 3 app that allows users to share files by uploading
I have built a Ruby on Rails app that allows users to track workouts.
I am developing a rails app that allows users to post, much like facebook
I have built a ruby on rails app that allows for users to track
I am building an app using Rails 3 that allows users to submit videos.
I have a Rails app that is served by Apache and Passenger, using only

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.