user3291025
user3291025

Reputation: 1117

Heroku: Rails app static assets too large to upload app, how to serve assets

My assets file is too large to upload my Rails app to heroku (I am getting the error 'slug size is too large'). I have many images in my app. Heroku recommends against using S3, and instead recommends Cloudfront CDN - https://devcenter.heroku.com/articles/using-amazon-cloudfront-cdn

Cloudfront is set up to get the assets from the heroku app. However, if I can't upload the app to heroku, Cloudfront will not see the assets to serve them. In this case, should I store the assets in S3 buckets, then serve them through Cloudfront, or take a different approach?

Thanks.

Upvotes: 0

Views: 220

Answers (1)

Liyan Chang
Liyan Chang

Reputation: 8051

You've got the right idea.

  1. Upload the files to S3.
  2. Set up Cloudfront for delivery.

If I were you, I'd start with part 1 only. The reason that Heroku recommends Cloudfront is that it will be able to serve the files much faster then S3. However, debugging issues is so much easier with just S3 since changes propagate instantly and it reduces one layer of indirection. On you're comfortable with S3, then add in Cloudfront for extra speed!

Upvotes: 1

Related Questions