Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>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.</p> <p>The primary benefits of hosting assets on S3 and using the <code>config.action_controller.asset_host</code> directive include (among others):</p> <ul> <li>allowing additional simultaneous downloads of assets</li> <li>serving assets from a cookie-free domain</li> </ul> <p>Rather than using s3, you can use the <a href="http://aws.amazon.com/cloudfront/">CloudFront CDN</a> 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:</p> <p><strong>Create a new CloudFront distribution</strong></p> <ol> <li>Delivery Method should be <em>Download</em></li> <li>Choose <em>Custom Origin</em> and point it to your web server</li> <li>For <em>Distribution Details</em> you can add addition CNAME records such as <code>cdn01.mydomain.com</code> etc.</li> <li><em>Default Root Object</em> can be left empty</li> </ol> <p>If your site is served over SSL, you will need to use the <code>x12whx1751nfir.cloudfront.net</code> 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.</p> <p>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. </p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload