问题
Is anyone aware of a tool that will automatically deploy a Rails app static assets to Rackspace Cloud Files or Amazon Cloud Front?
In my perfect world capistrano would automatically upload everything in javascripts, stylesheets, and images then override the default image_tag and script_tags to route to the appropriate CDN path.
It would be great if the deploy task created a new container with each deploy like cap creates a new release directory, or maybe it should use the same containers and keep a cached file with the hashes of all the deployed assets and only deploy new assets to take advantage of long CDN TTLs.
回答1:
I'm not aware of anything, but you could probably script something to do this without too much work.
The Fog gem provides an agnostic API for pushing files to Amazon S3 and Rackspace Cloud files, among others.
回答2:
I haven't done it myself yet, but I think it can be done with rsync as a capistrano task.
Have look at this.
http://railscasts.com/episodes/133-capistrano-tasks
回答3:
I have previously used Rackspace Cloud Files CloudFuse for Linux http://www.rackspace.com/knowledge_center/article/mounting-rackspace-cloud-files-to-linux-using-cloudfuse.
It allows you to mount your cloud files containers so that they can be written using standard file system operations, which makes for simple scripting in your deploy scripts. You'll obviously want to take care of keeping the machine that does this secure.
来源:https://stackoverflow.com/questions/6379380/rails-capistrano-tool-to-deploy-static-assets-to-rackspace-cloud-files-or-amazon